diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php index 6a4d771e16b184ac23af5d3335d436c98176856a..e95c3e3e9c56f22342eed710ba387a7f74c6e9ef 100644 --- a/install/lib/installer_base.lib.php +++ b/install/lib/installer_base.lib.php @@ -967,6 +967,11 @@ class installer_base { $this->error("The postfix configuration directory '$config_dir' does not exist."); } + //* Get postfix version + exec('postfix -d mail_version 2>&1', $out); + $postfix_version = preg_replace('/.*=\s*/', '', $out[0]); + unset($out); + //* mysql-virtual_domains.cf $this->process_postfix_config('mysql-virtual_domains.cf'); @@ -1093,6 +1098,26 @@ class installer_base { $postconf_tpl = strtr($postconf_tpl, $postconf_placeholders); $postconf_commands = array_filter(explode("\n", $postconf_tpl)); // read and remove empty lines + //* Merge version-specific postfix config + if(version_compare($postfix_version , '2.5', '>=')) { + $configfile = 'postfix_2-5.conf'; + $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master'); + $content = strtr($content, $postconf_placeholders); + $postconf_commands = array_merge($postconf_commands, array_filter(explode("\n", $content))); + } + if(version_compare($postfix_version , '2.10', '>=')) { + $configfile = 'postfix_2-10.conf'; + $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master'); + $content = strtr($content, $postconf_placeholders); + $postconf_commands = array_merge($postconf_commands, array_filter(explode("\n", $content))); + } + if(version_compare($postfix_version , '3.0', '>=')) { + $configfile = 'postfix_3-0.conf'; + $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master'); + $content = strtr($content, $postconf_placeholders); + $postconf_commands = array_merge($postconf_commands, array_filter(explode("\n", $content))); + } + //* These postconf commands will be executed on installation only if($this->is_update == false) { $postconf_commands = array_merge($postconf_commands, array( diff --git a/install/tpl/postfix_2-10.conf.master b/install/tpl/postfix_2-10.conf.master new file mode 100644 index 0000000000000000000000000000000000000000..d77f37e0a07bdedea1d15c629a07c871ba496b0c --- /dev/null +++ b/install/tpl/postfix_2-10.conf.master @@ -0,0 +1,5 @@ +# Postfix configuration for version 2.10 and up +smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination + +# This is supported in version 2.9, but lets not create another conf file for it +address_verify_sender_ttl = 15686s diff --git a/install/tpl/postfix_2-5.conf.master b/install/tpl/postfix_2-5.conf.master new file mode 100644 index 0000000000000000000000000000000000000000..398dc6393c251dd66ddd619e489b75a06724dc31 --- /dev/null +++ b/install/tpl/postfix_2-5.conf.master @@ -0,0 +1,11 @@ +# Postfix configuration for version 2.5 and up +in_flow_delay = ${stress?3}${stress:1}s +smtp_connect_timeout = ${stress?10}${stress:30}s +smtp_helo_timeout = ${stress?10}${stress:60}s +smtp_mail_timeout = ${stress?10}${stress:60}s +smtpd_error_sleep_time = ${stress?1}${stress:2}s +smtpd_hard_error_limit = ${stress?1}${stress:10} +smtpd_recipient_overshoot_limit = ${stress?60}${stress:600} +smtpd_soft_error_limit = ${stress?2}${stress:5} +smtpd_timeout = ${stress?10}${stress:60}s + diff --git a/install/tpl/postfix_3-0.conf.master b/install/tpl/postfix_3-0.conf.master new file mode 100644 index 0000000000000000000000000000000000000000..a185eb6dade492adc2a13f36bd2804149409d57f --- /dev/null +++ b/install/tpl/postfix_3-0.conf.master @@ -0,0 +1,11 @@ +# Postfix configuration for version 3.0 and up +in_flow_delay = ${stress?{3}:{1}}s +smtp_connect_timeout = ${stress?{10}:{30}}s +smtp_helo_timeout = ${stress?{10}:{60}}s +smtp_mail_timeout = ${stress?{10}:{60}}s +smtpd_error_sleep_time = ${stress?{1}:{2}}s +smtpd_hard_error_limit = ${stress?{1}:{10}} +smtpd_recipient_overshoot_limit = ${stress?{60}:{600}} +smtpd_soft_error_limit = ${stress?{2}:{5}} +smtpd_timeout = ${stress?{10}:{60}}s +