diff options
author | Simon Rettberg | 2024-10-11 15:43:17 +0200 |
---|---|---|
committer | Simon Rettberg | 2024-10-11 15:43:17 +0200 |
commit | ccc7cf78a7ca8b3349c45706b8b03e1ed6bc44d6 (patch) | |
tree | 261b535912030ac41667ce954093dbe48ea5bc85 /modules-available/webinterface/inc | |
parent | [webinterface] API: Check callbacks immediately on success (diff) | |
download | slx-admin-ccc7cf78a7ca8b3349c45706b8b03e1ed6bc44d6.tar.gz slx-admin-ccc7cf78a7ca8b3349c45706b8b03e1ed6bc44d6.tar.xz slx-admin-ccc7cf78a7ca8b3349c45706b8b03e1ed6bc44d6.zip |
[webinterface] Remove the 'off' option for HTTPS
As we always use a self-signed certificate for client communication, you
cannot really turn off HTTPS, and explicitly generating another
self-signed certificate for slx-admin is rather pointless. So
internally, we actually remove the option for a self-signed certificate,
and rename the "off" option to using a self-signed one.
Diffstat (limited to 'modules-available/webinterface/inc')
-rw-r--r-- | modules-available/webinterface/inc/acme.inc.php | 2 | ||||
-rw-r--r-- | modules-available/webinterface/inc/webinterface.inc.php | 16 |
2 files changed, 3 insertions, 15 deletions
diff --git a/modules-available/webinterface/inc/acme.inc.php b/modules-available/webinterface/inc/acme.inc.php index f12ceb2e..446c0e45 100644 --- a/modules-available/webinterface/inc/acme.inc.php +++ b/modules-available/webinterface/inc/acme.inc.php @@ -96,7 +96,7 @@ class Acme return; if (Taskmanager::isFailed($task)) { if (($args['user'] ?? null) === null) { - EventLog::warning('Automatic ACME renewal of HTTPS certificate failed', json_encode($task, JSON_PRETTY_PRINT)); + EventLog::warning('Automatic ACME renewal of HTTPS certificate failed', print_r($task, true)); } Property::set(self::PROP_ERROR, $task['data']['error'] ?? 'Unknown error'); } else { diff --git a/modules-available/webinterface/inc/webinterface.inc.php b/modules-available/webinterface/inc/webinterface.inc.php index 035b94e6..d50acd50 100644 --- a/modules-available/webinterface/inc/webinterface.inc.php +++ b/modules-available/webinterface/inc/webinterface.inc.php @@ -88,7 +88,7 @@ class WebInterface return; } if (Taskmanager::isFailed($task)) { - EventLog::failure($data['message'], json_encode($task, JSON_PRETTY_PRINT)); + EventLog::failure('TASK FAILED: ' . $data['message'], print_r($task, true)); return; } EventLog::info($data['message']); @@ -97,19 +97,10 @@ class WebInterface public static function tmDisableHttps(): ?string { - Property::set(WebInterface::PROP_HSTS, 'off'); - $task = Taskmanager::submit('LighttpdHttps', []); - self::registerCallback($task, 'off', 'HTTPS disabled'); - return $task['id'] ?? null; - } - - public static function tmGenerateRandomCert(): ?string - { $task = Taskmanager::submit('LighttpdHttps', [ - 'proxyip' => Property::getServerIp(), 'redirect' => self::isHttpsRedirectEnabled(), ]); - self::registerCallback($task, 'generated', 'Self-signed HTTPS certificate generated'); + self::registerCallback($task, 'off', 'Disabling HTTPS, switching to self-signed certificate'); return $task['id'] ?? null; } @@ -117,7 +108,6 @@ class WebInterface { $key = preg_replace('/[\r\n]+/', "\n", $key); $cert = preg_replace('/[\r\n]+/', "\n", $cert); - Property::set(WebInterface::PROP_TYPE, $type); $task = Taskmanager::submit('LighttpdHttps', [ 'importcert' => $cert, 'importkey' => $key, @@ -129,8 +119,6 @@ class WebInterface public static function tmSetHttpRedirectMode(): ?string { - if (Property::get(WebInterface::PROP_TYPE) === 'off') - return null; $task = Taskmanager::submit('LighttpdHttps', array( 'redirectOnly' => true, 'redirect' => self::isHttpsRedirectEnabled(), |