Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add mail conf task #1238

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
add mail conf task
boonkerz committed Feb 19, 2024
commit 558f8158aefa97c14cf32f39be30ac5c9f1afc03
8 changes: 4 additions & 4 deletions actions/admin/settings/150.mail.php
Original file line number Diff line number Diff line change
@@ -144,8 +144,8 @@
'settinggroup' => 'system',
'varname' => 'mda_conf_dir',
'type' => 'text',
'string_type' => 'filedir',
'default' => '/etc/dovecot/conf.d',
'string_type' => 'confdir',
'default' => '/etc/dovecot/conf.d/',
'save_method' => 'storeSettingField',
'requires_reconf' => ['mail']
],
@@ -188,8 +188,8 @@
'settinggroup' => 'system',
'varname' => 'mta_conf_dir',
'type' => 'text',
'string_type' => 'filedir',
'default' => '/etc/postfix',
'string_type' => 'confdir',
'default' => '/etc/postfix/',
'save_method' => 'storeSettingField',
'requires_reconf' => ['mail']
],
14 changes: 11 additions & 3 deletions install/updates/froxlor/update_2.2.inc.php
Original file line number Diff line number Diff line change
@@ -97,11 +97,19 @@
Update::showUpdateStep("Adding new settings");
Settings::AddNew("system.le_renew_services", "");
Settings::AddNew("system.le_renew_hook", "systemctl restart postfix dovecot proftpd");
Update::lastStepStatus(0);

Froxlor::updateToDbVersion('202401090');
}

if (Froxlor::isDatabaseVersion('202401090')) {

Update::showUpdateStep("Adding new settings");
Settings::AddNew("system.mda_reload_command", "service dovecot reload");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a new update section with a new db-version is required or users on that version will not get the updates

Settings::AddNew("system.mda_conf_dir", "/etc/dovecot/conf.d");
Settings::AddNew("system.mda_conf_dir", "/etc/dovecot/conf.d/");
Settings::AddNew("system.mta_reload_command", "service postfix reload");
Settings::AddNew("system.mta_conf_dir", "/etc/postfix");
Settings::AddNew("system.mta_conf_dir", "/etc/postfix/");
Update::lastStepStatus(0);

Froxlor::updateToDbVersion('202401090');
Froxlor::updateToDbVersion('202402190');
}
2 changes: 1 addition & 1 deletion lib/Froxlor/Cron/Http/LetsEncrypt/AcmeSh.php
Original file line number Diff line number Diff line change
@@ -634,7 +634,7 @@ private static function runAcmeSh(array $certrow, array $domains, &$cronlog = nu
}
if (Settings::IsInList('system.le_renew_services', 'dovecot')) {
// custom config for dovecot
$dovecot_conf = Settings::Get('system.mda_conf_dir') . '/99-froxlor.ssl.conf';
$dovecot_conf = FileDir::makeCorrectFile(Settings::Get('system.mda_conf_dir') . '99-froxlor.ssl.conf');
$ssl_content = <<<EOSSL
# Autogenerated configuration by froxlor.
# Do not manually edit this file as it will be overwritten.
2 changes: 1 addition & 1 deletion lib/Froxlor/Cron/Mail/Dovecot.php
Original file line number Diff line number Diff line change
@@ -89,7 +89,7 @@ private function getSSLConf($domain)
public function writeConfigs()
{
if($this->content !== "") {
$vhosts_filename = Settings::Get('system.mda_conf_dir') .'/99-froxlor-vhost.ssl.conf';
$vhosts_filename = FileDir::makeCorrectFile(Settings::Get('system.mda_conf_dir') . '99-froxlor-vhost.ssl.conf');
$vhosts_file = '# ' . basename($vhosts_filename) . "\n" . '# Created ' . date('d.m.Y H:i') . "\n" . '# Do NOT manually edit this file, all changes will be deleted after the next domain change at the panel.' . "\n" . "\n" . $this->content;
$vhosts_file_handler = fopen($vhosts_filename, 'w');
fwrite($vhosts_file_handler, $vhosts_file);
2 changes: 1 addition & 1 deletion lib/Froxlor/Cron/Mail/Postfix.php
Original file line number Diff line number Diff line change
@@ -84,7 +84,7 @@ private function getSSLConf($domain)
public function writeConfigs()
{
if($this->content !== "") {
$vhosts_filename = Settings::Get('system.mta_conf_dir') .'/'.$this->postFixMapFile;
$vhosts_filename = FileDir::makeCorrectFile(Settings::Get('system.mta_conf_dir') . $this->postFixMapFile);
FileDir::safe_exec('postconf -e tls_server_sni_maps=hash:'.$vhosts_filename);
$vhosts_file = '# ' . basename($vhosts_filename) . "\n" . '# Created ' . date('d.m.Y H:i') . "\n" . '# Do NOT manually edit this file, all changes will be deleted after the next domain change at the panel.' . "\n" . "\n" . $this->content;
$vhosts_file_handler = fopen($vhosts_filename, 'w');