@@ -449,6 +449,38 @@ public function configure_dovecot()
449449 file_put_contents ($ config_dir .'/ ' .$ configfile ,$ content );
450450 unset($ content );
451451 }
452+ if (version_compare ($ dovecot_version ,2.3 ) >= 0 ) {
453+ // Remove deprecated setting(s)
454+ removeLine ($ config_dir .'/ ' .$ configfile , 'ssl_protocols = ' );
455+
456+ // Check if we have a dhparams file and if not, create it
457+ if (!file_exists ('/etc/dovecot/dh.pem ' )) {
458+ swriteln ('Creating new DHParams file, this takes several minutes. Do not interrupt the script. ' );
459+ if (file_exists ('/var/lib/dovecot/ssl-parameters.dat ' )) {
460+ // convert existing ssl parameters file
461+ $ command = 'dd if=/var/lib/dovecot/ssl-parameters.dat bs=1 skip=88 | openssl dhparam -inform der > /etc/dovecot/dh.pem ' ;
462+ caselog ($ command .' &> /dev/null ' , __FILE__ , __LINE__ , "EXECUTED: $ command " , "Failed to execute the command $ command " );
463+ } else {
464+ /*
465+ Create a new dhparams file. We use 2048 bit only as it simply takes too long
466+ on smaller systems to generate a 4096 bit dh file (> 30 minutes). If you need
467+ a 4096 bit file, create it manually before you install ISPConfig
468+ */
469+ $ command = 'openssl dhparam -out /etc/dovecot/dh.pem 2048 ' ;
470+ caselog ($ command .' &> /dev/null ' , __FILE__ , __LINE__ , "EXECUTED: $ command " , "Failed to execute the command $ command " );
471+ }
472+ }
473+ //remove #2.3+ comment
474+ $ content = file_get_contents ($ config_dir .'/ ' .$ configfile );
475+ $ content = str_replace ('#2.3+ ' ,'' ,$ content );
476+ file_put_contents ($ config_dir .'/ ' .$ configfile ,$ content );
477+ unset($ content );
478+
479+ } else {
480+ // remove settings which are not supported in Dovecot < 2.3
481+ removeLine ($ config_dir .'/ ' .$ configfile , 'ssl_min_protocol = ' );
482+ removeLine ($ config_dir .'/ ' .$ configfile , 'ssl_dh = ' );
483+ }
452484 replaceLine ($ config_dir .'/ ' .$ configfile , 'postmaster_address = postmaster@example.com ' , 'postmaster_address = postmaster@ ' .$ conf ['hostname ' ], 1 , 0 );
453485 replaceLine ($ config_dir .'/ ' .$ configfile , 'postmaster_address = webmaster@localhost ' , 'postmaster_address = postmaster@ ' .$ conf ['hostname ' ], 1 , 0 );
454486 } else {
0 commit comments