diff options
author | Simon Rettberg | 2017-05-04 16:50:35 +0200 |
---|---|---|
committer | Simon Rettberg | 2017-05-04 16:50:35 +0200 |
commit | 71baea4fa255912113ad3067b74de72d2f09ce7f (patch) | |
tree | 8cf6300b48b56cfc1c0274e1bd7d94c30325882a /modules-available/webinterface/page.inc.php | |
parent | [systemstatus] Put logs in tabbed view (diff) | |
download | slx-admin-71baea4fa255912113ad3067b74de72d2f09ce7f.tar.gz slx-admin-71baea4fa255912113ad3067b74de72d2f09ce7f.tar.xz slx-admin-71baea4fa255912113ad3067b74de72d2f09ce7f.zip |
[webinterface] Add separate option to enable HSTS
Diffstat (limited to 'modules-available/webinterface/page.inc.php')
-rw-r--r-- | modules-available/webinterface/page.inc.php | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/modules-available/webinterface/page.inc.php b/modules-available/webinterface/page.inc.php index 93d659f0..5207420a 100644 --- a/modules-available/webinterface/page.inc.php +++ b/modules-available/webinterface/page.inc.php @@ -5,6 +5,7 @@ class Page_WebInterface extends Page const PROP_REDIRECT = 'webinterface.https-redirect'; const PROP_TYPE = 'webinterface.https-type'; + const PROP_HSTS = 'webinterface.https-hsts'; protected function doPreprocess() { @@ -42,6 +43,7 @@ class Page_WebInterface extends Page $task = $this->setRedirectMode(); break; } + Property::set(self::PROP_HSTS, Request::post('usehsts', false, 'string') === 'on' ? 'True' : 'False'); if (isset($task['id'])) { Session::set('https-id', $task['id']); Util::redirect('?do=WebInterface&show=httpsupdate' . $off); @@ -65,11 +67,13 @@ class Page_WebInterface extends Page } $type = Property::get(self::PROP_TYPE); $force = Property::get(self::PROP_REDIRECT) === 'True'; + $hsts = Property::get(self::PROP_HSTS) === 'True'; $https = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off'; $exists = file_exists('/etc/lighttpd/server.pem'); $data = array( 'httpsUsed' => $https, - 'redirect_checked' => ($force ? 'checked' : '') + 'redirect_checked' => ($force ? 'checked' : ''), + 'hsts_checked' => ($hsts ? 'checked' : '') ); // Type should be 'off', 'generated', 'supplied' if ($type === 'off') { |