From 90ce11e0ff6e8de093666b630d2cd96e658ef430 Mon Sep 17 00:00:00 2001 From: Till Brehm Date: Thu, 22 Feb 2018 16:47:08 +0100 Subject: [PATCH] Improved dovecot config file editing. --- install/dist/lib/debian60.lib.php | 5 ++++- install/dist/lib/fedora.lib.php | 7 +++++++ install/lib/installer_base.lib.php | 5 ++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/install/dist/lib/debian60.lib.php b/install/dist/lib/debian60.lib.php index 57fb193440..0cd7116568 100644 --- a/install/dist/lib/debian60.lib.php +++ b/install/dist/lib/debian60.lib.php @@ -111,7 +111,10 @@ class installer extends installer_base { } if(version_compare($dovecot_version,2.2) >= 0) { // Dovecot > 2.2 does not recognize !SSLv2 anymore on Debian 9 - replaceLine($config_dir.'/'.$configfile, 'ssl_protocols = !SSLv2 !SSLv3', 'ssl_protocols = !SSLv3', 1, 0); + $content = file_get_contents($config_dir.'/'.$configfile); + $content = str_replace('!SSLv2','',$content); + file_put_contents($config_dir.'/'.$configfile,$content); + unset($content); } } else { if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian6_dovecot.conf.master')) { diff --git a/install/dist/lib/fedora.lib.php b/install/dist/lib/fedora.lib.php index 8aa75c9d07..418c47c670 100644 --- a/install/dist/lib/fedora.lib.php +++ b/install/dist/lib/fedora.lib.php @@ -443,6 +443,13 @@ class installer_dist extends installer_base { if(version_compare($dovecot_version,2.1) < 0) { removeLine($config_dir.'/'.$configfile, 'ssl_protocols ='); } + if(version_compare($dovecot_version,2.2) >= 0) { + // Dovecot > 2.2 does not recognize !SSLv2 anymore on Debian 9 + $content = file_get_contents($config_dir.'/'.$configfile); + $content = str_replace('!SSLv2','',$content); + file_put_contents($config_dir.'/'.$configfile,$content); + unset($content); + } replaceLine($config_dir.'/'.$configfile, 'postmaster_address = postmaster@example.com', 'postmaster_address = postmaster@'.$conf['hostname'], 1, 0); replaceLine($config_dir.'/'.$configfile, 'postmaster_address = webmaster@localhost', 'postmaster_address = postmaster@'.$conf['hostname'], 1, 0); } else { diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php index 6db51c3522..421afa3fc7 100644 --- a/install/lib/installer_base.lib.php +++ b/install/lib/installer_base.lib.php @@ -1292,7 +1292,10 @@ class installer_base { } if(version_compare($dovecot_version,2.2) >= 0) { // Dovecot > 2.2 does not recognize !SSLv2 anymore on Debian 9 - replaceLine($config_dir.'/'.$configfile, 'ssl_protocols = !SSLv2 !SSLv3', 'ssl_protocols = !SSLv3', 1, 0); + $content = file_get_contents($config_dir.'/'.$configfile); + $content = str_replace('!SSLv2','',$content); + file_put_contents($config_dir.'/'.$configfile,$content); + unset($content); } } -- GitLab