Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
bobimicroweber committed May 11, 2024
1 parent f3e898f commit 0af593e
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 14 deletions.
38 changes: 38 additions & 0 deletions web/Modules/Email/ldap-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
services:
phyre-mail-server:
image: ghcr.io/docker-mailserver/docker-mailserver:latest
container_name: mailserver
# Provide the FQDN of your mail server here (Your DNS MX record should point to this value)
hostname: mail.test.phyrepanel.com
ports:
- "25:25"
- "465:465"
- "587:587"
- "993:993"
volumes:
- ./docker-data/dms/mail-data/:/var/mail/
- ./docker-data/dms/mail-state/:/var/mail-state/
- ./docker-data/dms/mail-logs/:/var/log/mail/
- ./docker-data/dms/config/:/tmp/docker-mailserver/
- /etc/localtime:/etc/localtime:ro
environment:
- ACCOUNT_PROVISIONER=LDAP
- LDAP_SERVER_HOST=ldap # your ldap container/IP/ServerName
- LDAP_SEARCH_BASE=ou=people,dc=localhost,dc=localdomain
- LDAP_BIND_DN=cn=admin,dc=localhost,dc=localdomain
- LDAP_BIND_PW=admin
- LDAP_QUERY_FILTER_USER=(&(mail=%s)(mailEnabled=TRUE))
- LDAP_QUERY_FILTER_GROUP=(&(mailGroupMember=%s)(mailEnabled=TRUE))
- LDAP_QUERY_FILTER_ALIAS=(|(&(mailAlias=%s)(objectClass=PostfixBookMailForward))(&(mailAlias=%s)(objectClass=PostfixBookMailAccount)(mailEnabled=TRUE)))
- LDAP_QUERY_FILTER_DOMAIN=(|(&(mail=*@%s)(objectClass=PostfixBookMailAccount)(mailEnabled=TRUE))(&(mailGroupMember=*@%s)(objectClass=PostfixBookMailAccount)(mailEnabled=TRUE))(&(mailalias=*@%s)(objectClass=PostfixBookMailForward)))
- DOVECOT_PASS_FILTER=(&(objectClass=PostfixBookMailAccount)(uniqueIdentifier=%n))
- DOVECOT_USER_FILTER=(&(objectClass=PostfixBookMailAccount)(uniqueIdentifier=%n))
- ENABLE_SASLAUTHD=1
- SASLAUTHD_MECHANISMS=ldap
- SASLAUTHD_LDAP_SERVER=ldap
- SASLAUTHD_LDAP_BIND_DN=cn=admin,dc=localhost,dc=localdomain
- SASLAUTHD_LDAP_PASSWORD=admin
- SASLAUTHD_LDAP_SEARCH_BASE=ou=people,dc=localhost,dc=localdomain
- SASLAUTHD_LDAP_FILTER=(&(objectClass=PostfixBookMailAccount)(uniqueIdentifier=%U))
- POSTMASTER_ADDRESS=postmaster@localhost.localdomain
restart: always
4 changes: 0 additions & 4 deletions web/Modules/Email/shell-scripts/install-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,4 @@ sudo apt-get update

sudo apt-get install docker-compose docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y





echo "Done!"
20 changes: 10 additions & 10 deletions web/app/Models/Backup.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,34 +98,34 @@ public function checkBackup()
shell_exec('cd '.$tempValidatePath.' && unzip -o '.$this->file_path);

$validateDatabaseFile = $tempValidatePath.'/database.sql';
$validateEnvFile = $tempValidatePath.'/.env';
$validatePhyreConfigFile = $tempValidatePath.'/phyre-config.ini';

$errorsBag = [];
if (! file_exists($validateDatabaseFile)) {
$errorsBag[] = 'Database file not found';
}
if (! file_exists($validateEnvFile)) {
$errorsBag[] = 'Env file not found';
if (! file_exists($validatePhyreConfigFile)) {
$errorsBag[] = 'Phyre config file not found';
}
if (count($errorsBag) > 0) {
$this->status = 'failed';
$this->backup_log = 'Backup failed. Database or env file missing.';
$this->backup_log = 'Backup failed. Database or phyre config file missing.';
$this->save();
return [
'status' => 'failed',
'message' => 'Backup failed. Database or env file missing.',
'message' => 'Backup failed. Database or phyre config file missing.',
'errors' => $errorsBag
];
}
$originalEnvContent = file_get_contents(base_path().'/.env');
$backupEnvContent = file_get_contents($validateEnvFile);
if ($originalEnvContent != $backupEnvContent) {
$errorsBag[] = 'Env file content mismatch';
$originalPhyreConfigContent = file_get_contents(base_path().'/phyre-config.ini');
$backupPhyreConfigContent = file_get_contents($validatePhyreConfigFile);
if ($originalPhyreConfigContent != $backupPhyreConfigContent) {
$errorsBag[] = 'Phyre config content mismatch';
}

if (count($errorsBag) > 0) {
$this->status = 'failed';
$this->backup_log = 'Backup failed. Database or env file content mismatch.';
$this->backup_log = 'Backup failed. Database or phyre config file content mismatch.';
$this->save();
return [
'status' => 'failed',
Expand Down

0 comments on commit 0af593e

Please sign in to comment.