From d9331cca61c24de435a0edbf5a07adf3da2e80b7 Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Fri, 18 Sep 2020 11:49:26 +0200 Subject: [PATCH] check for fallback of ssl-certificate in ips/ports correctly of lets encrypt is used Signed-off-by: Michael Kaufmann --- lib/Froxlor/Cron/Http/Apache.php | 3 ++- lib/Froxlor/Cron/Http/Lighttpd.php | 3 ++- lib/Froxlor/Cron/Http/Nginx.php | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/Froxlor/Cron/Http/Apache.php b/lib/Froxlor/Cron/Http/Apache.php index 6bc3e4b9..41c0816e 100644 --- a/lib/Froxlor/Cron/Http/Apache.php +++ b/lib/Froxlor/Cron/Http/Apache.php @@ -413,7 +413,8 @@ class Apache extends HttpConfigBase $this->virtualhosts_data[$vhosts_filename] .= $this->processSpecialConfigTemplate($row_ipsandports['ssl_specialsettings'], $domain, $row_ipsandports['ip'], $row_ipsandports['port'], $row_ipsandports['ssl'] == '1') . "\n"; } - if ($row_ipsandports['ssl_cert_file'] == '' || ! file_exists($row_ipsandports['ssl_cert_file'])) { + // check for required fallback + if (($row_ipsandports['ssl_cert_file'] == '' || ! file_exists($row_ipsandports['ssl_cert_file'])) && (Settings::Get('system.le_froxlor_enabled') == '0' || $this->froxlorVhostHasLetsEncryptCert() == false)) { $row_ipsandports['ssl_cert_file'] = Settings::Get('system.ssl_cert_file'); if (! file_exists($row_ipsandports['ssl_cert_file'])) { // explicitly disable ssl for this vhost diff --git a/lib/Froxlor/Cron/Http/Lighttpd.php b/lib/Froxlor/Cron/Http/Lighttpd.php index 5698ee0c..fda3b6bc 100644 --- a/lib/Froxlor/Cron/Http/Lighttpd.php +++ b/lib/Froxlor/Cron/Http/Lighttpd.php @@ -188,7 +188,8 @@ class Lighttpd extends HttpConfigBase $this->lighttpd_data[$vhost_filename] .= $this->processSpecialConfigTemplate($row_ipsandports['ssl_specialsettings'], $domain, $row_ipsandports['ip'], $row_ipsandports['port'], $row_ipsandports['ssl'] == '1') . "\n"; } - if ($row_ipsandports['ssl_cert_file'] == '' || ! file_exists($row_ipsandports['ssl_cert_file'])) { + // check for required fallback + if (($row_ipsandports['ssl_cert_file'] == '' || ! file_exists($row_ipsandports['ssl_cert_file'])) && (Settings::Get('system.le_froxlor_enabled') == '0' || $this->froxlorVhostHasLetsEncryptCert() == false)) { $row_ipsandports['ssl_cert_file'] = Settings::Get('system.ssl_cert_file'); if (! file_exists($row_ipsandports['ssl_cert_file'])) { // explicitly disable ssl for this vhost diff --git a/lib/Froxlor/Cron/Http/Nginx.php b/lib/Froxlor/Cron/Http/Nginx.php index 4325bb15..977b1341 100644 --- a/lib/Froxlor/Cron/Http/Nginx.php +++ b/lib/Froxlor/Cron/Http/Nginx.php @@ -155,7 +155,8 @@ class Nginx extends HttpConfigBase // we know whether it's an ssl vhost or not $ssl_vhost = false; if ($row_ipsandports['ssl'] == '1') { - if ($row_ipsandports['ssl_cert_file'] == '' || ! file_exists($row_ipsandports['ssl_cert_file'])) { + // check for required fallback + if (($row_ipsandports['ssl_cert_file'] == '' || ! file_exists($row_ipsandports['ssl_cert_file'])) && (Settings::Get('system.le_froxlor_enabled') == '0' || $this->froxlorVhostHasLetsEncryptCert() == false)) { $row_ipsandports['ssl_cert_file'] = Settings::Get('system.ssl_cert_file'); if (! file_exists($row_ipsandports['ssl_cert_file'])) { // explicitly disable ssl for this vhost