@@ -2721,9 +2721,15 @@ private function curl_request($url, $use_ipv6 = false) {
27212721 return $ response ;
27222722 }
27232723
2724- private function make_acme_vhost ($ server_name , $ server = 'apache ' , $ restart = true ) {
2724+ private function make_acme_vhost ($ server = 'apache ' ) {
27252725 global $ conf ;
27262726
2727+ if ($ conf ['hostname ' ] !== 'localhost ' && $ conf ['hostname ' ] !== '' ) {
2728+ $ server_name = $ conf ['hostname ' ];
2729+ } else {
2730+ $ server_name = exec ('hostname -f ' );
2731+ }
2732+
27272733 $ use_template = 'apache_acme.conf.master ' ;
27282734 $ use_symlink = '999-acme.conf ' ;
27292735 $ use_name = 'acme.conf ' ;
@@ -2759,15 +2765,6 @@ private function make_acme_vhost($server_name, $server = 'apache', $restart = tr
27592765 if (!@is_link ($ vhost_conf_enabled_dir .'' . $ use_symlink )) {
27602766 symlink ($ vhost_conf_dir .'/ ' . $ use_name , $ vhost_conf_enabled_dir .'/ ' . $ use_symlink );
27612767 }
2762- if ($ restart === true ) {
2763- if ($ conf [$ server ]['installed ' ] == true && $ conf [$ server ]['init_script ' ] != '' ) {
2764- if ($ this ->is_update ) {
2765- system ($ this ->getinitcommand ($ conf [$ server ]['init_script ' ], 'force-reload ' ).' &> /dev/null || ' . $ this ->getinitcommand ($ conf [$ server ]['init_script ' ], 'restart ' ).' &> /dev/null ' );
2766- } else {
2767- system ($ this ->getinitcommand ($ conf [$ server ]['init_script ' ], 'restart ' ).' &> /dev/null ' );
2768- }
2769- }
2770- }
27712768 }
27722769
27732770 public function make_ispconfig_ssl_cert () {
@@ -2899,15 +2896,22 @@ public function make_ispconfig_ssl_cert() {
28992896 // first of all create the acme vhosts if not existing
29002897 if ($ conf ['nginx ' ]['installed ' ] == true ) {
29012898 swriteln ('Using nginx for certificate validation ' );
2902- $ this -> make_acme_vhost ( $ hostname , 'nginx ' ) ;
2899+ $ server = 'nginx ' ;
29032900 } elseif ($ conf ['apache ' ]['installed ' ] == true ) {
29042901 swriteln ('Using apache for certificate validation ' );
29052902 if ($ this ->is_update == false && @is_link ($ vhost_conf_enabled_dir .'/000-ispconfig.conf ' )) {
29062903 $ restore_conf_symlink = true ;
29072904 unlink ($ vhost_conf_enabled_dir .'/000-ispconfig.conf ' );
29082905 }
2906+ $ server = 'apache ' ;
2907+ }
29092908
2910- $ this ->make_acme_vhost ($ hostname , 'apache ' );
2909+ if ($ conf [$ server ]['installed ' ] == true && $ conf [$ server ]['init_script ' ] != '' ) {
2910+ if ($ this ->is_update ) {
2911+ system ($ this ->getinitcommand ($ conf [$ server ]['init_script ' ], 'force-reload ' ).' &> /dev/null || ' . $ this ->getinitcommand ($ conf [$ server ]['init_script ' ], 'restart ' ).' &> /dev/null ' );
2912+ } else {
2913+ system ($ this ->getinitcommand ($ conf [$ server ]['init_script ' ], 'restart ' ).' &> /dev/null ' );
2914+ }
29112915 }
29122916
29132917 $ issued_successfully = false ;
@@ -3005,9 +3009,6 @@ public function make_ispconfig_ssl_cert() {
30053009 }
30063010 }
30073011 } else {
3008- if ($ conf ['apache ' ]['installed ' ] == true ) {
3009- $ this ->make_acme_vhost ($ hostname , 'apache ' , false ); // we need this config file but we don't want apache to be restarted at this point
3010- }
30113012 if ($ ip_address_match ) {
30123013 // the directory already exists so we have to assume that it was created previously
30133014 $ issued_successfully = true ;
0 commit comments