Skip to content

Commit 4a95363

Browse files
author
Marius Burkard
committed
- allow return code 2 on acme (non-changed domain)
1 parent 73e6c72 commit 4a95363

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

server/lib/classes/letsencrypt.inc.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,10 @@ public function request_certificates($data, $server_type = 'apache') {
376376
unset($aliasdomains);
377377

378378
$letsencrypt_cmd = '';
379+
$allow_return_codes = null;
379380
if($use_acme) {
380381
$letsencrypt_cmd = $this->get_acme_command($temp_domains, $key_file, $bundle_file, $crt_file);
382+
$allow_return_codes = array(2);
381383
} else {
382384
$letsencrypt_cmd = $this->get_certbot_command($temp_domains);
383385
}
@@ -388,7 +390,7 @@ public function request_certificates($data, $server_type = 'apache') {
388390
$app->log("Create Let's Encrypt SSL Cert for: $domain", LOGLEVEL_DEBUG);
389391
$app->log("Let's Encrypt SSL Cert domains: $cli_domain_arg", LOGLEVEL_DEBUG);
390392

391-
$success = $app->system->_exec($letsencrypt_cmd);
393+
$success = $app->system->_exec($letsencrypt_cmd, $allow_return_codes);
392394
} else {
393395
$app->log("Migration mode active, skipping Let's Encrypt SSL Cert creation for: $domain", LOGLEVEL_DEBUG);
394396
$success = true;

server/lib/classes/system.inc.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1672,14 +1672,24 @@ function mkdirpath($path, $mode = 0755, $user = '', $group = '') {
16721672

16731673
}
16741674

1675-
function _exec($command) {
1675+
function _exec($command, $return_codes_ok = null) {
16761676
global $app;
1677+
1678+
if(!is_null($return_codes_ok) && !is_array($return_codes_ok)) {
1679+
$return_codes_ok = array($return_codes_ok);
1680+
}
1681+
16771682
$out = array();
16781683
$ret = 0;
16791684
$app->log('exec: '.$command, LOGLEVEL_DEBUG);
16801685
exec($command, $out, $ret);
1681-
if($ret != 0) return false;
1682-
else return true;
1686+
if($ret == 0) {
1687+
return true;
1688+
} elseif(is_array($return_codes_ok) && !empty($return_codes_ok) && in_array($ret, $return_codes_ok)) {
1689+
return true;
1690+
} else {
1691+
return false;
1692+
}
16831693
}
16841694

16851695
//* Check if a application is installed

0 commit comments

Comments
 (0)