summaryrefslogtreecommitdiffstats
path: root/modules-available
diff options
context:
space:
mode:
authorSimon Rettberg2024-10-16 11:07:07 +0200
committerSimon Rettberg2024-10-16 11:07:07 +0200
commit2a3e8b9c062c9578c30d385525d59db6fac34294 (patch)
treed9597f2a2e980d6f97ca97c15a9f2069ea2f5001 /modules-available
parent[statistics] Make ML-version a link (diff)
downloadslx-admin-2a3e8b9c062c9578c30d385525d59db6fac34294.tar.gz
slx-admin-2a3e8b9c062c9578c30d385525d59db6fac34294.tar.xz
slx-admin-2a3e8b9c062c9578c30d385525d59db6fac34294.zip
[webinterface] Double ACME renew interval, improve error handling
Diffstat (limited to 'modules-available')
-rw-r--r--modules-available/webinterface/hooks/cron.inc.php2
-rw-r--r--modules-available/webinterface/inc/acme.inc.php15
2 files changed, 14 insertions, 3 deletions
diff --git a/modules-available/webinterface/hooks/cron.inc.php b/modules-available/webinterface/hooks/cron.inc.php
index cc30ed05..baedfa4c 100644
--- a/modules-available/webinterface/hooks/cron.inc.php
+++ b/modules-available/webinterface/hooks/cron.inc.php
@@ -1,5 +1,5 @@
<?php
-if (mt_rand(1, 36) === 1 && Property::get(WebInterface::PROP_TYPE) === 'acme') {
+if (mt_rand(1, 72) === 1 && Property::get(WebInterface::PROP_TYPE) === 'acme') {
Acme::renew();
} \ No newline at end of file
diff --git a/modules-available/webinterface/inc/acme.inc.php b/modules-available/webinterface/inc/acme.inc.php
index 446c0e45..3f5e76a0 100644
--- a/modules-available/webinterface/inc/acme.inc.php
+++ b/modules-available/webinterface/inc/acme.inc.php
@@ -94,13 +94,24 @@ class Acme
{
if (!Taskmanager::isFinished($task))
return;
- if (Taskmanager::isFailed($task)) {
+ $otherError = false;
+ if (isset($task['data']['error'])) {
+ // This should never happen, so make it an error
+ if (strpos($task['data']['error'], " is not an issued domain, skipping.") !== false) {
+ $otherError = true;
+ }
+ }
+ if (Taskmanager::isFailed($task) || $otherError) {
if (($args['user'] ?? null) === null) {
EventLog::warning('Automatic ACME renewal of HTTPS certificate failed', print_r($task, true));
}
Property::set(self::PROP_ERROR, $task['data']['error'] ?? 'Unknown error');
} else {
- EventLog::info('ACME issue/renewal of HTTPS certificate by ' . ($args['user'] ?? 'automatic cronjob'));
+ // If the cronjob called us and there is nothing to do, suppress the event log entry
+ if (($args['user'] ?? null) !== null
+ || strpos($task['data']['error'] ?? '', 'Skipping. Next renewal time is: ') === false) {
+ EventLog::info('ACME issue/renewal of HTTPS certificate by ' . ($args['user'] ?? 'automatic cronjob'), print_r($task, true));
+ }
Property::set(self::PROP_ERROR, false);
}
}