From eae236864fddd9753da68d0dbac622ff68aac55e Mon Sep 17 00:00:00 2001 From: Till Brehm <tbrehm@ispconfig.org> Date: Mon, 15 Jul 2019 17:09:30 +0200 Subject: [PATCH] Fixed #5340 Debian 10 warnings about deprecated dovecot config and missing dh params file. --- install/dist/lib/debian60.lib.php | 26 ++++++++++++++++++++++++ install/tpl/debian6_dovecot2.conf.master | 2 ++ 2 files changed, 28 insertions(+) diff --git a/install/dist/lib/debian60.lib.php b/install/dist/lib/debian60.lib.php index 0cd7116568..022d358932 100644 --- a/install/dist/lib/debian60.lib.php +++ b/install/dist/lib/debian60.lib.php @@ -116,6 +116,32 @@ class installer extends installer_base { file_put_contents($config_dir.'/'.$configfile,$content); unset($content); } + if(version_compare($dovecot_version,2.3) >= 0) { + // Remove deprecated setting(s) + removeLine($config_dir.'/'.$configfile, 'ssl_protocols ='); + + // Check if we have a dhparams file and if not, create it + if(!file_exists('/etc/dovecot/dh.pem')) { + swriteln('Creating new DHParams file, this takes several minutes. Do not interrupt the script.'); + if(file_exists('/var/lib/dovecot/ssl-parameters.dat')) { + // convert existing ssl parameters file + $command = 'dd if=/var/lib/dovecot/ssl-parameters.dat bs=1 skip=88 | openssl dhparam -inform der > /etc/dovecot/dh.pem'; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + } else { + /* + Create a new dhparams file. We use 2048 bit only as it simply takes too long + on smaller systems to generate a 4096 bit dh file (> 30 minutes). If you need + a 4096 bit file, create it manually before you install ISPConfig + */ + $command = 'openssl dhparam -out /etc/dovecot/dh.pem 2048'; + caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command"); + } + } + } else { + // remove settings which are not supported in Dovecot < 2.3 + removeLine($config_dir.'/'.$configfile, 'ssl_min_protocol ='); + removeLine($config_dir.'/'.$configfile, 'ssl_dh ='); + } } else { if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian6_dovecot.conf.master')) { copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian6_dovecot.conf.master', $config_dir.'/'.$configfile); diff --git a/install/tpl/debian6_dovecot2.conf.master b/install/tpl/debian6_dovecot2.conf.master index db6e0bfbe2..f13bbd53df 100644 --- a/install/tpl/debian6_dovecot2.conf.master +++ b/install/tpl/debian6_dovecot2.conf.master @@ -6,7 +6,9 @@ log_timestamp = "%Y-%m-%d %H:%M:%S " mail_privileged_group = vmail ssl_cert = </etc/postfix/smtpd.cert ssl_key = </etc/postfix/smtpd.key +ssl_dh = </etc/dovecot/dh.pem ssl_protocols = !SSLv2 !SSLv3 +ssl_min_protocol = TLSv1 mail_max_userip_connections = 100 passdb { args = /etc/dovecot/dovecot-sql.conf -- GitLab