From ec05c84f4daadb713222dd95b82de6b9a307427a Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Thu, 12 Jan 2023 09:40:35 +0100 Subject: [PATCH 01/20] check whether let's encrypt is enabled at all and correct acme-alias configuration file if necessary/selected Signed-off-by: Michael Kaufmann --- lib/Froxlor/Cli/ValidateAcmeWebroot.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/lib/Froxlor/Cli/ValidateAcmeWebroot.php b/lib/Froxlor/Cli/ValidateAcmeWebroot.php index f2aab971..ede5cd9f 100644 --- a/lib/Froxlor/Cli/ValidateAcmeWebroot.php +++ b/lib/Froxlor/Cli/ValidateAcmeWebroot.php @@ -56,6 +56,11 @@ final class ValidateAcmeWebroot extends CliCommand $io = new SymfonyStyle($input, $output); + if ((int) Settings::Get('system.leenabled') == 0) { + $io->info("Let's Encrypt not activated in froxlor settings."); + $result = self::INVALID; + } + if ($result == self::SUCCESS) { $yestoall = $input->getOption('yes-to-all') !== false; $helper = $this->getHelper('question'); @@ -67,6 +72,26 @@ final class ValidateAcmeWebroot extends CliCommand $upd_stmt = Database::prepare("UPDATE domain_ssl_settings SET expirationdate=NULL WHERE `domainid` = :did"); $acmesh_dir = dirname(Settings::Get('system.acmeshpath')); $acmesh_challenge_dir = Settings::Get('system.letsencryptchallengepath'); + + if ($acmesh_challenge_dir != Froxlor::getInstallDir()) { + $io->warning([ + "ACME challenge docroot from settings differs from the current installation directory.", + "Settings: '" . $acmesh_challenge_dir . "'", + "Default/recommended value: '" . Froxlor::getInstallDir() . "'", + ]); + $question = new ConfirmationQuestion('Fix ACME challenge docroot setting? [yes] ', true, '/^(y|j)/i'); + if ($yestoall || $helper->ask($input, $output, $question)) { + Settings::Set('system.letsencryptchallengepath', Froxlor::getInstallDir()); + $former_value = $acmesh_challenge_dir; + $acmesh_challenge_dir = Froxlor::getInstallDir(); + // need to update the corresponding acme-alias config-file + $acme_alias_file = Settings::Get('system.letsencryptacmeconf'); + $sed_params = "s@".$former_value."@" . $acmesh_challenge_dir . "@"; + FileDir::safe_exec('sed -i -e "' . $sed_params . '" ' . escapeshellarg($acme_alias_file)); + $count_changes++; + } + } + foreach ($domains as $domain_arr) { $domain = $domain_arr['domain']; $acme_domain_conf = FileDir::makeCorrectFile($acmesh_dir . '/' . $domain . '/' . $domain . '.conf'); From 86852942e02179e1832dc4080fd46f1088deb38c Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Thu, 12 Jan 2023 11:30:52 +0100 Subject: [PATCH 02/20] add missing language-strings for traffic page Signed-off-by: Michael Kaufmann --- lng/de.lng.php | 24 ++++++++--- lng/en.lng.php | 24 ++++++++--- templates/Froxlor/user/traffic.html.twig | 55 ++++++++++++------------ 3 files changed, 65 insertions(+), 38 deletions(-) diff --git a/lng/de.lng.php b/lng/de.lng.php index 56b0dafa..bae849b3 100644 --- a/lng/de.lng.php +++ b/lng/de.lng.php @@ -2124,17 +2124,31 @@ Vielen Dank, Ihr Administrator', ], 'mb' => 'Traffic', 'day' => 'Tag', - 'distribution' => 'FTP | HTTP | Mail', - 'sumhttp' => 'Gesamt HTTP-Traffic', - 'sumftp' => 'Gesamt FTP-Traffic', - 'summail' => 'Gesamt Mail-Traffic', + 'sumtotal' => 'Gesamt Traffic', + 'sumhttp' => 'HTTP-Traffic', + 'sumftp' => 'FTP-Traffic', + 'summail' => 'Mail-Traffic', 'customer' => 'Kunde', - 'trafficoverview' => 'Übersicht Traffic je', + 'trafficoverview' => 'Übersicht Traffic', + 'bycustomers' => 'Traffic nach Kunden', 'details' => 'Details', 'http' => 'HTTP', 'ftp' => 'FTP', 'mail' => 'Mail', 'nocustomers' => 'Es wird mindestens ein Kunde benötigt um die Traffic Statistiken anzuzeigen.', + 'top5customers' => 'Top 5 Kunden', + 'nodata' => 'Keine Daten im angegebenen Zeitraum.', + 'range' => [ + 'last24h' => 'die letzten 24 Std', + 'last7d' => 'die letzten 7 Tage', + 'last30d' => 'die letzten 30 Tage', + 'cm' => 'Aktueller Monat', + 'last3m' => 'die letzten 3 Monate', + 'last6m' => 'die letzten 6 Monate', + 'last12m' => 'die letzten 12 Monate', + 'cy' => 'Aktuelles Jahr', + ], + 'byrange' => 'Nach angegebenem Zeitraum', ], 'translator' => '', 'update' => [ diff --git a/lng/en.lng.php b/lng/en.lng.php index 7e3c87a1..c9deaff0 100644 --- a/lng/en.lng.php +++ b/lng/en.lng.php @@ -2254,18 +2254,32 @@ Yours sincerely, your administrator', 'total' => 'Total', ], 'mb' => 'Traffic', - 'distribution' => 'FTP | HTTP | Mail', - 'sumhttp' => 'Total HTTP-Traffic', - 'sumftp' => 'Total FTP-Traffic', - 'summail' => 'Total Mail-Traffic', + 'sumtotal' => 'Total traffic', + 'sumhttp' => 'HTTP traffic', + 'sumftp' => 'FTP traffic', + 'summail' => 'Mail traffic', 'customer' => 'Customer', 'domain' => 'Domain', - 'trafficoverview' => 'Traffic summary by', + 'trafficoverview' => 'Traffic summary', + 'bycustomers' => 'Traffic by customers', 'details' => 'Details', 'http' => 'HTTP', 'ftp' => 'FTP', 'mail' => 'Mail', 'nocustomers' => 'You need at least one customer to view the traffic reports.', + 'top5customers' => 'Top 5 customers', + 'nodata' => 'No data for given range found.', + 'range' => [ + 'last24h' => 'last 24 hours', + 'last7d' => 'last 7 days', + 'last30d' => 'last 30 days', + 'cm' => 'Current month', + 'last3m' => 'last 3 months', + 'last6m' => 'last 6 months', + 'last12m' => 'last 12 months', + 'cy' => 'Current year', + ], + 'byrange' => 'Specified by range', ], 'translator' => '', 'update' => [ diff --git a/templates/Froxlor/user/traffic.html.twig b/templates/Froxlor/user/traffic.html.twig index ef7723b8..c835bc40 100644 --- a/templates/Froxlor/user/traffic.html.twig +++ b/templates/Froxlor/user/traffic.html.twig @@ -18,14 +18,14 @@