@@ -2417,7 +2417,7 @@ public function make_ispconfig_ssl_cert() {
24172417 // Check if LE SSL folder for the hostname existed
24182418 // Then create standalone LE SSL certs for this server
24192419 $ le_live_dir = '/etc/letsencrypt/live/ ' . $ hostname ;
2420- if (!@is_dir ($ le_live_dir ) && in_array ($ srv_ip , $ dns_ips )) {
2420+ if (!@is_dir ($ le_live_dir ) && in_array ($ svr_ip , $ dns_ips )) {
24212421
24222422 // If it is nginx webserver
24232423 if ($ conf ['nginx ' ]['installed ' ] == true )
@@ -2445,7 +2445,7 @@ public function make_ispconfig_ssl_cert() {
24452445 if (!@is_dir ($ install_dir .'/interface/ssl ' )) mkdir ($ install_dir .'/interface/ssl ' , 0755 , true );
24462446
24472447 // If the LE SSL certs for this hostname exists
2448- if (is_dir ($ le_live_dir ) && in_array ($ srv_ip , $ dns_ips )) {
2448+ if (is_dir ($ le_live_dir ) && in_array ($ svr_ip , $ dns_ips )) {
24492449
24502450 // Backup existing ispserver ssl files
24512451 $ date = new DateTime ();
@@ -2460,6 +2460,44 @@ public function make_ispconfig_ssl_cert() {
24602460 // Build ispserver.pem file and chmod it
24612461 exec ("cat $ ssl_key_file $ ssl_crt_file > $ ssl_pem_file; chmod 600 $ ssl_pem_file " );
24622462
2463+
2464+
2465+ // Extend LE SSL certs to postfix
2466+ if ($ conf ['postfix ' ]['installed ' ] == true && strtolower ($ this ->simple_query ('Symlink ISPConfig LE SSL certs to postfix? ' , array ('y ' , 'n ' ), 'y ' )) == 'y ' )) {
2467+
2468+ // Define folder, file(s)
2469+ $ cf = $ conf ['postfix ' ];
2470+ $ postfix_dir = $ cf ['config_dir ' ];
2471+ if (!is_dir ($ postfix_dir )) $ this ->error ("The postfix configuration directory ' $ postfix_dir' does not exist. " );
2472+ $ smtpd_crt = $ postfix_dir .'/smtpd.cert ' ;
2473+ $ smtpd_key = $ postfix_dir .'/smtpd.key ' ;
2474+
2475+ // Backup existing postfix ssl files
2476+ if (file_exists ($ smtpd_crt )) rename ($ smtpd_crt , $ smtpd_crt . '- ' .$ date ->format ('YmdHis ' ) . '.bak ' );
2477+ if (file_exists ($ smtpd_key )) rename ($ smtpd_key , $ smtpd_key . '- ' .$ date ->format ('YmdHis ' ) . '.bak ' );
2478+
2479+ // Create symlink to ISPConfig SSL files
2480+ symlink ($ ssl_crt_file , $ smtpd_crt );
2481+ symlink ($ ssl_key_file , $ smtpd_key );
2482+ }
2483+
2484+ // Extend LE SSL certs to pureftpd
2485+ if ($ conf ['pureftpd ' ]['installed ' ] == true && strtolower ($ this ->simple_query ('Symlink ISPConfig LE SSL certs to pureftpd? Creating dhparam file takes some times. ' , array ('y ' , 'n ' ), 'y ' )) == 'y ' ) {
2486+
2487+ // Define folder, file(s)
2488+ $ pureftpd_dir = '/etc/ssl/private ' ;
2489+ if (!is_dir ($ pureftpd_dir )) mkdir ($ pureftpd_dir , 0755 , true );
2490+ $ pureftpd_pem = $ pureftpd_dir .'/pure-ftpd.pem ' ;
2491+
2492+ // Backup existing postfix ssl files
2493+ if (file_exists ($ pureftpd_pem )) rename ($ pureftpd_pem , $ pureftpd_pem . '- ' .$ date ->format ('YmdHis ' ) . '.bak ' );
2494+
2495+ // Create symlink to ISPConfig SSL files
2496+ symlink ($ ssl_pem_file , $ pureftpd_pem );
2497+ if (!file_exists ("$ pureftpd_dir/pure-ftpd-dhparams.pem " ))
2498+ exec ("cd $ pureftpd_dir; openssl dhparam -out dhparam4096.pem 4096; ln -sf dhparam4096.pem pure-ftpd-dhparams.pem " );
2499+ }
2500+
24632501 } else {
24642502
24652503 // We can still use the old self-signed method
0 commit comments