Log Certbot error messages
This commit is contained in:
parent
e77493feda
commit
f372bbbce7
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
$final_message = null;
|
$final_message = null;
|
||||||
|
|
||||||
function output($code, $msg = '') {
|
function output($code, $msg = '', $logs = ['']) {
|
||||||
global $final_message;
|
global $final_message;
|
||||||
$shortCode = $code / 100 % 10;
|
$shortCode = $code / 100 % 10;
|
||||||
$final_message = match ($shortCode) {
|
$final_message = match ($shortCode) {
|
||||||
|
@ -12,7 +12,7 @@ function output($code, $msg = '') {
|
||||||
};
|
};
|
||||||
http_response_code($code);
|
http_response_code($code);
|
||||||
if ($shortCode === 5)
|
if ($shortCode === 5)
|
||||||
error_log("Niver internal error: " . strip_tags($msg));
|
error_log("Niver internal error: " . strip_tags($msg) . implode("\n", $logs));
|
||||||
if ($code !== 200)
|
if ($code !== 200)
|
||||||
executePage();
|
executePage();
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,9 +38,9 @@ if (processForm()) {
|
||||||
|
|
||||||
addSite($_SESSION['username'], $_POST['dir'], $_POST['domain'], "dns", "http");
|
addSite($_SESSION['username'], $_POST['dir'], $_POST['domain'], "dns", "http");
|
||||||
|
|
||||||
exec(CONF['ht']['sudo_path'] . " " . CONF['ht']['certbot_path'] . " certonly --quiet" . (CONF['ht']['letsencrypt_use_production'] ? '' : ' --test-cert') . " --key-type rsa --rsa-key-size 3072 --webroot --webroot-path /srv/niver/acme --domain " . $_POST['domain'], $output, $returnCode);
|
exec('2>&1 ' . CONF['ht']['sudo_path'] . ' ' . CONF['ht']['certbot_path'] . ' certonly' . (CONF['ht']['letsencrypt_use_production'] ? '' : ' --test-cert') . ' --key-type rsa --rsa-key-size 3072 --webroot --webroot-path /srv/niver/acme --domain ' . $_POST['domain'], $output, $returnCode);
|
||||||
if ($returnCode !== 0)
|
if ($returnCode !== 0)
|
||||||
output(500, 'Certbot failed to get a Let\'s Encrypt certificate.');
|
output(500, 'Certbot failed to get a Let\'s Encrypt certificate.', $output);
|
||||||
|
|
||||||
$nginxConf = 'server {
|
$nginxConf = 'server {
|
||||||
listen [' . CONF['ht']['ipv6_listen_address'] . ']:' . CONF['ht']['https_port'] . ' ssl http2;
|
listen [' . CONF['ht']['ipv6_listen_address'] . ']:' . CONF['ht']['https_port'] . ' ssl http2;
|
||||||
|
|
Loading…
Reference in New Issue