@@ -115,6 +115,32 @@ public function configure_dovecot()
115115 file_put_contents ($ config_dir .'/ ' .$ configfile ,$ content );
116116 unset($ content );
117117 }
118+ if (version_compare ($ dovecot_version ,2.3 ) >= 0 ) {
119+ // Remove deprecated setting(s)
120+ removeLine ($ config_dir .'/ ' .$ configfile , 'ssl_protocols = ' );
121+
122+ // Check if we have a dhparams file and if not, create it
123+ if (!file_exists ('/etc/dovecot/dh.pem ' )) {
124+ swriteln ('Creating new DHParams file, this takes several minutes. Do not interrupt the script. ' );
125+ if (file_exists ('/var/lib/dovecot/ssl-parameters.dat ' )) {
126+ // convert existing ssl parameters file
127+ $ command = 'dd if=/var/lib/dovecot/ssl-parameters.dat bs=1 skip=88 | openssl dhparam -inform der > /etc/dovecot/dh.pem ' ;
128+ caselog ($ command .' &> /dev/null ' , __FILE__ , __LINE__ , "EXECUTED: $ command " , "Failed to execute the command $ command " );
129+ } else {
130+ /*
131+ Create a new dhparams file. We use 2048 bit only as it simply takes too long
132+ on smaller systems to generate a 4096 bit dh file (> 30 minutes). If you need
133+ a 4096 bit file, create it manually before you install ISPConfig
134+ */
135+ $ command = 'openssl dhparam -out /etc/dovecot/dh.pem 2048 ' ;
136+ caselog ($ command .' &> /dev/null ' , __FILE__ , __LINE__ , "EXECUTED: $ command " , "Failed to execute the command $ command " );
137+ }
138+ }
139+ } else {
140+ // remove settings which are not supported in Dovecot < 2.3
141+ removeLine ($ config_dir .'/ ' .$ configfile , 'ssl_min_protocol = ' );
142+ removeLine ($ config_dir .'/ ' .$ configfile , 'ssl_dh = ' );
143+ }
118144 } else {
119145 if (is_file ($ conf ['ispconfig_install_dir ' ].'/server/conf-custom/install/debian6_dovecot.conf.master ' )) {
120146 copy ($ conf ['ispconfig_install_dir ' ].'/server/conf-custom/install/debian6_dovecot.conf.master ' , $ config_dir .'/ ' .$ configfile );
0 commit comments