Skip to content

Commit

Permalink
Update installer_base.lib.php
Browse files Browse the repository at this point in the history
Fix ISPConfig code that ignores existing LE SSL certs created in advance using certbot.
  • Loading branch information
ahrasis authored Nov 13, 2022
1 parent 1f1b184 commit ba009f8
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions install/lib/installer_base.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -3207,16 +3207,18 @@ public function make_ispconfig_ssl_cert() {
$acme_version = '--server https://acme-v0' . (($le_version >=0.22) ? '2' : '1') . '.api.letsencrypt.org/directory';
$certonly = 'certonly --agree-tos --non-interactive --expand --rsa-key-size 4096';

// If this is a webserver
if($conf['nginx']['installed'] == true || $conf['apache']['installed'] == true) {
exec("$le_client $certonly $acme_version --authenticator webroot --webroot-path /usr/local/ispconfig/interface/acme --email " . escapeshellarg('postmaster@' . $hostname) . " -d " . escapeshellarg($hostname) . " $renew_hook", $out, $ret);
}
// Else, it is not webserver, so we use standalone
else {
exec("$le_client $certonly $acme_version --standalone --email " . escapeshellarg('postmaster@' . $hostname) . " -d " . escapeshellarg($hostname) . " $hook", $out, $ret);
if((!@is_dir($acme_cert_dir) || !@file_exists($check_acme_file)) && $ip_address_match == true) {
// If this is a webserver
if($conf['nginx']['installed'] == true || $conf['apache']['installed'] == true) {
exec("$le_client $certonly $acme_version --authenticator webroot --webroot-path /usr/local/ispconfig/interface/acme --email " . escapeshellarg('postmaster@' . $hostname) . " -d " . escapeshellarg($hostname) . " $renew_hook", $out, $ret);
}
// Else, it is not webserver, so we use standalone
else {
exec("$le_client $certonly $acme_version --standalone --email " . escapeshellarg('postmaster@' . $hostname) . " -d " . escapeshellarg($hostname) . " $hook", $out, $ret);
}
}

if($ret == 0) {
if($ret == 0 || @is_dir($acme_cert_dir) || @file_exists($check_acme_file)) {
// certbot returns with 0 on issue for already existing certificate

$acme_cert_dir = '/etc/letsencrypt/live/' . $hostname;
Expand Down

0 comments on commit ba009f8

Please sign in to comment.