@@ -2403,19 +2403,19 @@ public function make_ispconfig_ssl_cert() {
24032403 // This hostname can be taken from user entry too
24042404 // But I don't find a way for it yet so...
24052405 // I use this for now ;D
2406- $ hostname = exec ('hostname -f ' );
2406+ if ($ conf ['hostname ' ] !== ('localhost ' || '' ) ) $ hostname = $ conf ['hostname ' ];
2407+ else $ hostname = exec ('hostname -f ' );
2408+
24072409 // Check if LE SSL folder for the hostname existed
24082410 $ le_live_dir = '/etc/letsencrypt/live/ ' . $ hostname ;
2409- // Check if this is web server
2410- $ check_nginx = exec ("dpkg-query -W -f=' \${Status}' nginx 2>/dev/null | grep -c 'ok installed' " );
2411- $ check_apache = exec ("dpkg-query -W -f=' \${Status}' apache2 2>/dev/null | grep -c 'ok installed' " );
2411+
24122412 // We support certbot so create standalone LE SSL certs for this server
24132413 if (!@is_dir ($ le_live_dir )) {
24142414 // If it is nginx webserver
2415- if ( $ check_nginx == 1 )
2415+ if ( $ conf [ ' nginx ' ][ ' installed ' ] == true )
24162416 exec ("certbot certonly --authenticator standalone -d $ hostname --pre-hook 'service nginx stop' --post-hook 'service nginx start' " );
24172417 // If it is apache2 webserver
2418- elseif ( $ check_apache2 == 1 )
2418+ elseif ( $ conf [ ' apache ' ][ ' installed ' ] == true )
24192419 exec ("certbot certonly --authenticator standalone -d $ hostname --pre-hook 'service apache2 stop' --post-hook 'service apache2 start' " );
24202420 // If it is not webserver
24212421 else
@@ -2428,17 +2428,17 @@ public function make_ispconfig_ssl_cert() {
24282428 // Define and check ISPConfig SSL folder
24292429 $ install_dir = $ conf ['ispconfig_install_dir ' ];
24302430 if (!@is_dir ($ install_dir .'/interface/ssl ' )) mkdir ($ install_dir .'/interface/ssl ' , 0755 , true );
2431+
24312432 $ ssl_crt_file = $ install_dir .'/interface/ssl/ispserver.crt ' ;
2432- $ ssl_csr_file = $ install_dir .'/interface/ssl/ispserver.csr ' ;
24332433 $ ssl_key_file = $ install_dir .'/interface/ssl/ispserver.key ' ;
24342434 $ ssl_pem_file = $ install_dir .'/interface/ssl/ispserver.pem ' ;
24352435 $ ssl_bak_file = $ install_dir .'/interface/ssl/ispserver.*.bak ' ;
24362436
24372437 // Delete old then backup existing ispserver ssl files
24382438 if (is_file ($ ssl_bak_file )) exec ("rm $ ssl_bak_file " );
2439- if (is_file ($ ssl_crt_file )) exec ("mv $ ispccrt $ ssl_crt_file-$(date +'%y%m%d%H%M%S).bak " );
2440- if (is_file ($ ssl_key_file )) exec ("mv $ ispccrt $ ssl_key_file-$(date +'%y%m%d%H%M%S).bak " );
2441- if (is_file ($ ssl_pem_file )) exec ("mv $ ispccrt $ ssl_pem_file-$(date +'%y%m%d%H%M%S).bak " );
2439+ if (is_file ($ ssl_crt_file )) exec ("mv $ ssl_crt_file- \ $(date +'%y%m%d%H%M%S).bak " );
2440+ if (is_file ($ ssl_key_file )) exec ("mv $ ssl_key_file- \ $(date +'%y%m%d%H%M%S).bak " );
2441+ if (is_file ($ ssl_pem_file )) exec ("mv $ ssl_pem_file- \ $(date +'%y%m%d%H%M%S).bak " );
24422442
24432443 // Create symlink to LE fullchain and key for ISPConfig
24442444 exec ("ln -sf $ le_live_dir/fullchain.pem $ ssl_crt_file " );
0 commit comments