From ccc7cf78a7ca8b3349c45706b8b03e1ed6bc44d6 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 11 Oct 2024 15:43:17 +0200 Subject: [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. --- modules-available/webinterface/inc/acme.inc.php | 2 +- modules-available/webinterface/inc/webinterface.inc.php | 16 ++-------------- 2 files changed, 3 insertions(+), 15 deletions(-) (limited to 'modules-available/webinterface/inc') 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']); @@ -96,20 +96,11 @@ 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(), -- cgit v1.2.3-55-g7522