@@ -317,8 +317,15 @@ public function request_certificates($data, $server_type = 'apache') {
317317 if ($ this ->get_acme_script ()) {
318318 $ use_acme = true ;
319319 } elseif (!$ this ->get_certbot_script ()) {
320+ $ app ->log ("Unable to find Let's Encrypt client, installing acme.sh. " , LOGLEVEL_DEBUG );
320321 // acme and le missing
321322 $ this ->install_acme ();
323+ if ($ this ->get_acme_script ()) {
324+ $ use_acme = true ;
325+ } else {
326+ $ app ->log ("Unable to install acme.sh. Cannot proceed, no Let's Encrypt client found. " , LOGLEVEL_WARN );
327+ return false ;
328+ }
322329 }
323330
324331 $ tmp = $ app ->letsencrypt ->get_website_certificate_paths ($ data );
@@ -399,11 +406,13 @@ public function request_certificates($data, $server_type = 'apache') {
399406 $ this ->certbot_use_certcommand = false ;
400407 $ letsencrypt_cmd = '' ;
401408 $ allow_return_codes = null ;
409+ $ old_umask = umask (0022 ); # work around acme.sh permission bug, see #6015
402410 if ($ use_acme ) {
403411 $ letsencrypt_cmd = $ this ->get_acme_command ($ temp_domains , $ key_file , $ bundle_file , $ crt_file , $ server_type );
404412 $ allow_return_codes = array (2 );
405413 } else {
406414 $ letsencrypt_cmd = $ this ->get_certbot_command ($ temp_domains );
415+ umask ($ old_umask );
407416 }
408417
409418 $ success = false ;
@@ -420,6 +429,7 @@ public function request_certificates($data, $server_type = 'apache') {
420429 }
421430
422431 if ($ use_acme === true ) {
432+ umask ($ old_umask );
423433 if (!$ success ) {
424434 $ app ->log ('Let \'s Encrypt SSL Cert for: ' . $ domain . ' could not be issued. ' , LOGLEVEL_WARN );
425435 $ app ->log ($ letsencrypt_cmd , LOGLEVEL_WARN );
0 commit comments