Skip to content

Commit e3a1292

Browse files
committed
Update letsencrypt.inc.php as per the discussion at https://git.ispconfig.org/ispconfig/ispconfig3/issues/5030. Already pr'ed and merged in master via https://git.ispconfig.org/ispconfig/ispconfig3/merge_requests/778. Perhaps can be merged with stable too?
1 parent 122ee00 commit e3a1292

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

server/lib/classes/letsencrypt.inc.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,16 @@ public function request_certificates($data, $server_type = 'apache') {
275275
$letsencrypt = explode("\n", shell_exec('which letsencrypt certbot /root/.local/share/letsencrypt/bin/letsencrypt /opt/eff.org/certbot/venv/bin/certbot'));
276276
$letsencrypt = reset($letsencrypt);
277277
if(is_executable($letsencrypt)) {
278-
$letsencrypt_cmd = $letsencrypt . " certonly -n --text --agree-tos --expand --authenticator webroot --server https://acme-v01.api.letsencrypt.org/directory --rsa-key-size 4096 --email postmaster@$domain $cli_domain_arg --webroot-path /usr/local/ispconfig/interface/acme";
278+
$letsencrypt_version = exec($letsencrypt . ' --version 2>&1', $ret, $val);
279+
if(preg_match('/^(\S+|\w+)\s+(\d+(\.\d+)+)$/', $letsencrypt_version, $matches)) {
280+
$letsencrypt_version = $matches[2];
281+
}
282+
if ($letsencrypt_version >=0.22) {
283+
$acme_version = 'https://acme-v02.api.letsencrypt.org/directory';
284+
} else {
285+
$acme_version = 'https://acme-v01.api.letsencrypt.org/directory';
286+
}
287+
$letsencrypt_cmd = $letsencrypt . " certonly -n --text --agree-tos --expand --authenticator webroot --server $acme_version --rsa-key-size 4096 --email postmaster@$domain $cli_domain_arg --webroot-path /usr/local/ispconfig/interface/acme";
279288
$success = $app->system->_exec($letsencrypt_cmd);
280289
}
281290
} else {

0 commit comments

Comments
 (0)