From 767ae65946cc2f5519e2d1a595b5a8c3c2a3a571 Mon Sep 17 00:00:00 2001 From: andryyy Date: Mon, 11 May 2020 11:52:02 +0200 Subject: [PATCH] [Web] Allow ratelimit time frame "day"; Allow to create announcements --- data/Dockerfiles/postfix/smtp_last_login.sh | 7 -- data/web/admin.php | 122 +++++++++++--------- data/web/edit.php | 3 + data/web/inc/footer.inc.php | 10 +- data/web/inc/functions.customize.inc.php | 9 ++ data/web/inc/functions.ratelimit.inc.php | 4 +- data/web/inc/header.inc.php | 8 ++ data/web/index.php | 3 + data/web/lang/lang.de.json | 9 ++ data/web/lang/lang.en.json | 9 ++ data/web/modals/mailbox.php | 2 + 11 files changed, 116 insertions(+), 70 deletions(-) delete mode 100755 data/Dockerfiles/postfix/smtp_last_login.sh diff --git a/data/Dockerfiles/postfix/smtp_last_login.sh b/data/Dockerfiles/postfix/smtp_last_login.sh deleted file mode 100755 index 5fd0ac49..00000000 --- a/data/Dockerfiles/postfix/smtp_last_login.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -echo action=OK -exit -while read QUERY; do - logger -t last_login -p mail.info "$QUERY" -done -echo action=OK diff --git a/data/web/admin.php b/data/web/admin.php index 96e4f189..783a9b87 100644 --- a/data/web/admin.php +++ b/data/web/admin.php @@ -117,10 +117,14 @@ if (!isset($_SESSION['gal']) && $license_cache = $redis->Get('LICENSE_STATUS_CAC API
+
+
+

+
@@ -156,7 +160,6 @@ if (!isset($_SESSION['gal']) && $license_cache = $redis->Get('LICENSE_STATUS_CAC
-

@@ -168,52 +171,52 @@ if (!isset($_SESSION['gal']) && $license_cache = $redis->Get('LICENSE_STATUS_CAC
-
-
-

⇄ Read-Write Access

-
-
-
-
- -
- -
-
-
-
- -
-
-
- -
-
-
-
-
-
- -
-
-
-
-

-
- - +
+
+

⇄ Read-Write Access

+
+
+ +
+ +
+
-
- -
-
+
+
+ +
+
+
+ +
+
+
+
+
+
+ +
+
+
+
+
+ + +
+
+
+ +
+
+
@@ -294,7 +297,7 @@ if (!isset($_SESSION['gal']) && $license_cache = $redis->Get('LICENSE_STATUS_CAC
- +
@@ -703,7 +706,7 @@ if (!isset($_SESSION['gal']) && $license_cache = $redis->Get('LICENSE_STATUS_CAC
- +
@@ -840,7 +843,7 @@ if (!isset($_SESSION['gal']) && $license_cache = $redis->Get('LICENSE_STATUS_CAC
- + @@ -885,7 +888,7 @@ if (!isset($_SESSION['gal']) && $license_cache = $redis->Get('LICENSE_STATUS_CAC data-item="quota_notification" data-id="quota_notification" data-api-url='edit/quota_notification' - data-api-attr='{}'> + data-api-attr='{}'> @@ -965,8 +968,8 @@ if (!isset($_SESSION['gal']) && $license_cache = $redis->Get('LICENSE_STATUS_CAC > - - + + Get('LICENSE_STATUS_CAC ?>

- +

- +
@@ -1075,11 +1076,24 @@ if (!isset($_SESSION['gal']) && $license_cache = $redis->Get('LICENSE_STATUS_CAC
+
+
+

+ +

+

+

>

+
+
- +
diff --git a/data/web/edit.php b/data/web/edit.php index 5187b552..f75ca2fc 100644 --- a/data/web/edit.php +++ b/data/web/edit.php @@ -382,6 +382,7 @@ if (isset($_SESSION['mailcow_cc_role'])) { +
@@ -537,6 +538,7 @@ if (isset($_SESSION['mailcow_cc_role'])) { +
@@ -833,6 +835,7 @@ if (isset($_SESSION['mailcow_cc_role'])) { +
diff --git a/data/web/inc/footer.inc.php b/data/web/inc/footer.inc.php index 99663434..b954bca8 100644 --- a/data/web/inc/footer.inc.php +++ b/data/web/inc/footer.inc.php @@ -182,13 +182,9 @@ $(document).ready(function() { diff --git a/data/web/inc/functions.customize.inc.php b/data/web/inc/functions.customize.inc.php index 207eddbf..f4c74d86 100644 --- a/data/web/inc/functions.customize.inc.php +++ b/data/web/inc/functions.customize.inc.php @@ -113,12 +113,18 @@ function customize($_action, $_item, $_data = null) { $apps_name = $_data['apps_name']; $help_text = $_data['help_text']; $ui_footer = $_data['ui_footer']; + $ui_announcement_text = $_data['ui_announcement_text']; + $ui_announcement_type = (in_array($_data['ui_announcement_type'], array('info', 'warning', 'danger'))) ? $_data['ui_announcement_type'] : false; + $ui_announcement_active = (!empty($_data['ui_announcement_active']) ? 1 : 0); try { $redis->set('TITLE_NAME', htmlspecialchars($title_name)); $redis->set('MAIN_NAME', htmlspecialchars($main_name)); $redis->set('APPS_NAME', htmlspecialchars($apps_name)); $redis->set('HELP_TEXT', $help_text); $redis->set('UI_FOOTER', $ui_footer); + $redis->set('UI_ANNOUNCEMENT_TEXT', $ui_announcement_text); + $redis->set('UI_ANNOUNCEMENT_TYPE', $ui_announcement_type); + $redis->set('UI_ANNOUNCEMENT_ACTIVE', $ui_announcement_active); } catch (RedisException $e) { $_SESSION['return'][] = array( @@ -208,6 +214,9 @@ function customize($_action, $_item, $_data = null) { $redis->del('UI_IMPRESS'); } $data['ui_footer'] = ($ui_footer = $redis->get('UI_FOOTER')) ? $ui_footer : false; + $data['ui_announcement_text'] = ($ui_announcement_text = $redis->get('UI_ANNOUNCEMENT_TEXT')) ? $ui_announcement_text : false; + $data['ui_announcement_type'] = ($ui_announcement_type = $redis->get('UI_ANNOUNCEMENT_TYPE')) ? $ui_announcement_type : false; + $data['ui_announcement_active'] = ($redis->get('UI_ANNOUNCEMENT_ACTIVE') == 1) ? 1 : 0; return $data; } catch (RedisException $e) { diff --git a/data/web/inc/functions.ratelimit.inc.php b/data/web/inc/functions.ratelimit.inc.php index efde5ec5..57a78e5f 100644 --- a/data/web/inc/functions.ratelimit.inc.php +++ b/data/web/inc/functions.ratelimit.inc.php @@ -25,7 +25,7 @@ function ratelimit($_action, $_scope, $_data = null) { foreach ($objects as $object) { $rl_value = intval($_data['rl_value']); $rl_frame = $_data['rl_frame']; - if (!in_array($rl_frame, array('s', 'm', 'h'))) { + if (!in_array($rl_frame, array('s', 'm', 'h', 'd'))) { $_SESSION['return'][] = array( 'type' => 'danger', 'log' => array(__FUNCTION__, $_action, $_scope, $_data_log), @@ -85,7 +85,7 @@ function ratelimit($_action, $_scope, $_data = null) { foreach ($objects as $object) { $rl_value = intval($_data['rl_value']); $rl_frame = $_data['rl_frame']; - if (!in_array($rl_frame, array('s', 'm', 'h'))) { + if (!in_array($rl_frame, array('s', 'm', 'h', 'd'))) { $_SESSION['return'][] = array( 'type' => 'danger', 'log' => array(__FUNCTION__, $_action, $_scope, $_data_log), diff --git a/data/web/inc/header.inc.php b/data/web/inc/header.inc.php index 7ecf3d21..79e76de7 100644 --- a/data/web/inc/header.inc.php +++ b/data/web/inc/header.inc.php @@ -138,3 +138,11 @@
+ +
+
+
+ diff --git a/data/web/index.php b/data/web/index.php index f0f622ed..3538c6b6 100644 --- a/data/web/index.php +++ b/data/web/index.php @@ -32,6 +32,9 @@ $_SESSION['index_query_string'] = $_SERVER['QUERY_STRING'];
+ +
+ überwiegen senderabhängige Transport Maps.
\r\n→ Transport Maps ignorieren Mailbox-Einstellungen für ausgehende Verschlüsselung. Eine serverweite TLS-Richtlinie wird jedoch angewendet.
\r\n→ Der Transport erfolgt immer via \"smtp:\".
\r\n→ Adressen, die mit \"/localhost$/\" übereinstimmen, werden immer via \"local:\" transportiert, daher sind sie von einer Zieldefinition \"*\" ausgeschlossen.
\r\n→ Die Authentifizierung wird anhand des \"Next hop\" Parameters ermittelt. Hierbei würde bei einem beispielhaften Wert \"[host]:25\" immer zuerst \"host\" abfragt und erst im Anschluss \"[host]:25\". Dieses Verhalten schließt die gleichzeitige Verwendung von Einträgen der Art \"host\" sowie \"[host]:25\" aus.", "ui_footer": "Footer (HTML zulässig)", + "ui_header_announcement": "Ankündigungen", + "ui_header_announcement_active": "Ankündigung aktivieren", + "ui_header_announcement_content": "Text (HTML zulässig)", + "ui_header_announcement_help": "Die Ankündigungsbox erzeugt einen deutlichen Hinweis für alle Benutzer und auf der Login-Seite der UI.", + "ui_header_announcement_select": "Ankündigungstyp auswählen", + "ui_header_announcement_type": "Typ", + "ui_header_announcement_type_info": "Info", + "ui_header_announcement_type_warning": "Wichtig", + "ui_header_announcement_type_danger": "Sehr wichtig", "ui_texts": "UI Label und Texte", "unban_pending": "ausstehend", "unchanged_if_empty": "Unverändert, wenn leer", diff --git a/data/web/lang/lang.en.json b/data/web/lang/lang.en.json index 7399f8e5..c35088ac 100644 --- a/data/web/lang/lang.en.json +++ b/data/web/lang/lang.en.json @@ -286,6 +286,15 @@ "transport_maps": "Transport Maps", "transports_hint": "→ A transport map entry overrules a sender-dependent transport map.
\r\n→ Outbound TLS policy settings per-user are ignored and can only be enforced by TLS policy map entries.
\r\n→ The transport service for defined transports is always \"smtp:\".
\r\n→ Addresses matching \"/localhost$/\" will always be transported via \"local:\", therefore a \"*\" destination will not apply to those addresses.
\r\n→ To determine credentials for an exemplary next hop \"[host]:25\", Postfix always queries for \"host\" before searching for \"[host]:25\". This behavior makes it impossible to use \"host\" and \"[host]:25\" at the same time.", "ui_footer": "Footer (HTML allowed)", + "ui_header_announcement": "Announcements", + "ui_header_announcement_active": "Set announcement active", + "ui_header_announcement_content": "Text (HTML allowed)", + "ui_header_announcement_help": "The announcement is visible for all logged in users and on the login screen of the UI.", + "ui_header_announcement_select": "Select announcement type", + "ui_header_announcement_type": "Type", + "ui_header_announcement_type_info": "Info", + "ui_header_announcement_type_warning": "Important", + "ui_header_announcement_type_danger": "Very important", "ui_texts": "UI labels and texts", "unban_pending": "unban pending", "unchanged_if_empty": "If unchanged leave blank", diff --git a/data/web/modals/mailbox.php b/data/web/modals/mailbox.php index 66c741bb..e3dcc110 100644 --- a/data/web/modals/mailbox.php +++ b/data/web/modals/mailbox.php @@ -160,6 +160,7 @@ if (!isset($_SESSION['mailcow_cc_role'])) { +
@@ -375,6 +376,7 @@ if (!isset($_SESSION['mailcow_cc_role'])) { +