From 19995f4345f41e50387c149e2ccd7be10c772a04 Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Wed, 14 Aug 2024 20:24:24 +0200 Subject: [PATCH 01/12] fix typo in varchar length of selector field of new panel_2fa_tokens table, thx to Davidd Signed-off-by: Michael Kaufmann --- index.php | 3 +++ install/froxlor.sql.php | 4 ++-- install/updates/froxlor/update_2.2.inc.php | 9 +++++++++ lib/Froxlor/Froxlor.php | 2 +- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/index.php b/index.php index 3ee8b9427d..4251ff9eea 100644 --- a/index.php +++ b/index.php @@ -394,6 +394,9 @@ } exit(); } + // not found or invalid, this cookie is useless, get rid of it + unset($_COOKIE['frx_2fa_remember']); + setcookie('frx_2fa_remember', "", time()-3600); } // redirect to code-enter-page diff --git a/install/froxlor.sql.php b/install/froxlor.sql.php index 65769e2017..701cb58812 100644 --- a/install/froxlor.sql.php +++ b/install/froxlor.sql.php @@ -731,7 +731,7 @@ ('panel', 'settings_mode', '0'), ('panel', 'menu_collapsed', '1'), ('panel', 'version', '2.2.0-rc3'), - ('panel', 'db_version', '202407200'); + ('panel', 'db_version', '202408140'); DROP TABLE IF EXISTS `panel_tasks`; @@ -1054,7 +1054,7 @@ DROP TABLE IF EXISTS `panel_2fa_tokens`; CREATE TABLE `panel_2fa_tokens` ( `id` int(11) NOT NULL auto_increment, - `selector` varchar(20) NOT NULL, + `selector` varchar(200) NOT NULL, `token` varchar(200) NOT NULL, `userid` int(11) NOT NULL default '0', `valid_until` int(15) NOT NULL, diff --git a/install/updates/froxlor/update_2.2.inc.php b/install/updates/froxlor/update_2.2.inc.php index e84786c371..27dc4d1581 100644 --- a/install/updates/froxlor/update_2.2.inc.php +++ b/install/updates/froxlor/update_2.2.inc.php @@ -150,3 +150,12 @@ Update::showUpdateStep("Updating from 2.2.0-rc2 to 2.2.0-rc3", false); Froxlor::updateToVersion('2.2.0-rc3'); } + +if (Froxlor::isDatabaseVersion('202407200')) { + + Update::showUpdateStep("Adjusting field in 2fa-token table"); + Database::query("ALTER TABLE `panel_2fa_tokens` CHANGE COLUMN `selector` `selector` varchar(200) NOT NULL;"); + Update::lastStepStatus(0); + + Froxlor::updateToDbVersion('202408140'); +} diff --git a/lib/Froxlor/Froxlor.php b/lib/Froxlor/Froxlor.php index aa06a15d7f..78894a6bb4 100644 --- a/lib/Froxlor/Froxlor.php +++ b/lib/Froxlor/Froxlor.php @@ -34,7 +34,7 @@ final class Froxlor const VERSION = '2.2.0-rc3'; // Database version (YYYYMMDDC where C is a daily counter) - const DBVERSION = '202407200'; + const DBVERSION = '202408140'; // Distribution branding-tag (used for Debian etc.) const BRANDING = ''; From 54cda098c1cd9fdaa09145951a0b3b4fc9ca81e1 Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Thu, 15 Aug 2024 20:11:28 +0200 Subject: [PATCH 02/12] correctly get target filename for jqSpeciallogfileNote action call via ajax, fixes #1267 Signed-off-by: Michael Kaufmann --- templates/Froxlor/assets/js/jquery/domains.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/templates/Froxlor/assets/js/jquery/domains.js b/templates/Froxlor/assets/js/jquery/domains.js index 9e3766ec09..2322c8bd6d 100644 --- a/templates/Froxlor/assets/js/jquery/domains.js +++ b/templates/Froxlor/assets/js/jquery/domains.js @@ -41,8 +41,9 @@ export default function () { $('#speciallogfilenote').remove(); $('#speciallogfile').removeClass('is-invalid'); $('#speciallogverified').val(0); + const cFileName = window.location.pathname.substring(window.location.pathname.lastIndexOf("/")+1); $.ajax({ - url: window.location.pathname.substring(1) + "?page=overview&action=jqSpeciallogfileNote", + url: cFileName + "?page=overview&action=jqSpeciallogfileNote", type: "POST", data: { id: $('input[name=id]').val(), newval: +$('#speciallogfile').is(':checked') From 15d3dd4234d3bf9493814265e80139aa1d50b116 Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Fri, 23 Aug 2024 09:21:54 +0200 Subject: [PATCH 03/12] set version to 2.2.0 for upcoming release Signed-off-by: Michael Kaufmann --- install/froxlor.sql.php | 2 +- install/updates/froxlor/update_2.2.inc.php | 5 +++++ lib/Froxlor/Froxlor.php | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/install/froxlor.sql.php b/install/froxlor.sql.php index 701cb58812..9c45c5d79f 100644 --- a/install/froxlor.sql.php +++ b/install/froxlor.sql.php @@ -730,7 +730,7 @@ ('panel', 'logo_overridecustom', '0'), ('panel', 'settings_mode', '0'), ('panel', 'menu_collapsed', '1'), - ('panel', 'version', '2.2.0-rc3'), + ('panel', 'version', '2.2.0'), ('panel', 'db_version', '202408140'); diff --git a/install/updates/froxlor/update_2.2.inc.php b/install/updates/froxlor/update_2.2.inc.php index 27dc4d1581..8dcf41783a 100644 --- a/install/updates/froxlor/update_2.2.inc.php +++ b/install/updates/froxlor/update_2.2.inc.php @@ -159,3 +159,8 @@ Froxlor::updateToDbVersion('202408140'); } + +if (Froxlor::isFroxlorVersion('2.2.0-rc3')) { + Update::showUpdateStep("Updating from 2.2.0-rc3 to 2.2.0 stable", false); + Froxlor::updateToVersion('2.2.0'); +} diff --git a/lib/Froxlor/Froxlor.php b/lib/Froxlor/Froxlor.php index 78894a6bb4..907e580751 100644 --- a/lib/Froxlor/Froxlor.php +++ b/lib/Froxlor/Froxlor.php @@ -31,7 +31,7 @@ final class Froxlor { // Main version variable - const VERSION = '2.2.0-rc3'; + const VERSION = '2.2.0'; // Database version (YYYYMMDDC where C is a daily counter) const DBVERSION = '202408140'; From bacc6fe0738ebf03811151f5242f6acc803f36f0 Mon Sep 17 00:00:00 2001 From: Lukas Bableck Date: Fri, 23 Aug 2024 11:03:33 +0200 Subject: [PATCH 04/12] Add |raw to h5 in formfields template (#1268) --- templates/Froxlor/form/formfields.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/Froxlor/form/formfields.html.twig b/templates/Froxlor/form/formfields.html.twig index 712ef61cbf..f93b203814 100644 --- a/templates/Froxlor/form/formfields.html.twig +++ b/templates/Froxlor/form/formfields.html.twig @@ -3,7 +3,7 @@ {% if norow == false and (field.type != 'hidden' or (field.type == 'hidden' and field.display is defined and field.display is not empty)) %}
{% if field.prior_infotext is defined and field.prior_infotext|length > 0 %} -
{{ field.prior_infotext }}
+
{{ field.prior_infotext|raw }}
{% endif %} {% if field.label is iterable %}
+ {% if remember_me %}
@@ -29,6 +30,7 @@
+ {% endif %} From 4ea7e10304393a97ccb318e1c468f646647581e8 Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Fri, 30 Aug 2024 10:06:26 +0200 Subject: [PATCH 10/12] set version to 2.2.1 for upcoming release Signed-off-by: Michael Kaufmann --- install/froxlor.sql.php | 2 +- install/updates/froxlor/update_2.2.inc.php | 5 +++++ lib/Froxlor/Froxlor.php | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/install/froxlor.sql.php b/install/froxlor.sql.php index 9c45c5d79f..21add8c97c 100644 --- a/install/froxlor.sql.php +++ b/install/froxlor.sql.php @@ -730,7 +730,7 @@ ('panel', 'logo_overridecustom', '0'), ('panel', 'settings_mode', '0'), ('panel', 'menu_collapsed', '1'), - ('panel', 'version', '2.2.0'), + ('panel', 'version', '2.2.1'), ('panel', 'db_version', '202408140'); diff --git a/install/updates/froxlor/update_2.2.inc.php b/install/updates/froxlor/update_2.2.inc.php index 8dcf41783a..ccabd89150 100644 --- a/install/updates/froxlor/update_2.2.inc.php +++ b/install/updates/froxlor/update_2.2.inc.php @@ -164,3 +164,8 @@ Update::showUpdateStep("Updating from 2.2.0-rc3 to 2.2.0 stable", false); Froxlor::updateToVersion('2.2.0'); } + +if (Froxlor::isFroxlorVersion('2.2.0')) { + Update::showUpdateStep("Updating from 2.2.0 to 2.2.1", false); + Froxlor::updateToVersion('2.2.1'); +} diff --git a/lib/Froxlor/Froxlor.php b/lib/Froxlor/Froxlor.php index 907e580751..92eb1b7048 100644 --- a/lib/Froxlor/Froxlor.php +++ b/lib/Froxlor/Froxlor.php @@ -31,7 +31,7 @@ final class Froxlor { // Main version variable - const VERSION = '2.2.0'; + const VERSION = '2.2.1'; // Database version (YYYYMMDDC where C is a daily counter) const DBVERSION = '202408140'; From 05ca08c5c383d0273719b68c82257c69925c4973 Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Fri, 30 Aug 2024 16:26:55 +0200 Subject: [PATCH 11/12] do not overwrite needed userinfo to avoid successful login when using email 2fa Signed-off-by: Michael Kaufmann --- index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.php b/index.php index a115713414..73b0fff3a6 100644 --- a/index.php +++ b/index.php @@ -111,7 +111,7 @@ // when using email-2fa, remove the one-time-code if ($userinfo['type_2fa'] == '1') { $del_stmt = Database::prepare("UPDATE " . $table . " SET `data_2fa` = '' WHERE `" . $field . "` = :uid"); - $userinfo = Database::pexecute_first($del_stmt, [ + Database::pexecute_first($del_stmt, [ 'uid' => $uid ]); } From 16d77a03cb90a1370f9ca7bc76348b045419c3a2 Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Sat, 31 Aug 2024 08:41:09 +0200 Subject: [PATCH 12/12] fix timestamp matching regex, add lmtp to receving service regex and skip lines not including the main target service name in maillog parser Signed-off-by: Michael Kaufmann --- lib/Froxlor/MailLogParser.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/Froxlor/MailLogParser.php b/lib/Froxlor/MailLogParser.php index 0d6fb9251b..41f36d2e6e 100644 --- a/lib/Froxlor/MailLogParser.php +++ b/lib/Froxlor/MailLogParser.php @@ -104,6 +104,10 @@ private function parsePostfixLog($logFile) unset($matches); $line = fgets($file_handle); + if (strpos($line, 'postfix') === false) { + continue; + } + $timestamp = $this->getLogTimestamp($line); if ($this->startTime < $timestamp) { if (preg_match("/postfix\/qmgr.*(?::|\])\s([A-Z\d]+).*from=?, size=(\d+),/", $line, $matches)) { @@ -112,7 +116,7 @@ private function parsePostfixLog($logFile) "domainFrom" => strtolower($matches[2]), "size" => $matches[3] ]; - } elseif (preg_match("/postfix\/(?:pipe|smtp).*(?::|\])\s([A-Z\d]+).*to=?,/", $line, $matches)) { + } elseif (preg_match("/postfix\/(?:pipe|smtp|lmtp).*(?::|\])\s([A-Z\d]+).*to=?,/", $line, $matches)) { // Postfix to if (array_key_exists($matches[1], $this->mails)) { $this->mails[$matches[1]]["domainTo"] = strtolower($matches[2]); @@ -149,7 +153,7 @@ private function parsePostfixLog($logFile) private function getLogTimestamp($line) { $matches = null; - if (preg_match("/((?:[A-Z]{3}\s{1,2}\d{1,2}|\d{4}-\d{2}-\d{2}) \d{2}:\d{2}:\d{2})/i", $line, $matches)) { + if (preg_match("/((?:[A-Z]{3}\s{1,2}\d{1,2}|\d{4}-\d{2}-\d{2}).\d{2}:\d{2}:\d{2})/i", $line, $matches)) { $timestamp = strtotime($matches[1]); if ($timestamp > ($this->startTime + 60 * 60 * 24)) { return strtotime($matches[1] . " -1 year"); @@ -258,6 +262,10 @@ private function parseDovecotLog($logFile) unset($matches); $line = fgets($file_handle); + if (strpos($line, 'dovecot') === false) { + continue; + } + $timestamp = $this->getLogTimestamp($line); if ($this->startTime < $timestamp) { if (preg_match("/dovecot.*(?::|\]) imap\(.*@([a-z0-9\.\-]+)\)(<\d+><[a-z0-9+\/=]+>)?:.*(?:in=(\d+) out=(\d+)|bytes=(\d+)\/(\d+))/i", $line, $matches)) {