git subrepo commit (merge) mailcow/src/mailcow-dockerized
subrepo: subdir: "mailcow/src/mailcow-dockerized"
merged: "32243e56"
upstream: origin: "https://github.com/mailcow/mailcow-dockerized.git"
branch: "master"
commit: "e2b4b6f6"
git-subrepo: version: "0.4.3"
origin: "???"
commit: "???"
Change-Id: I51e2016ef5ab88a8b0bdc08551b18f48ceef0aa5
diff --git a/mailcow/src/mailcow-dockerized/data/conf/rspamd/custom/bulk_header.map b/mailcow/src/mailcow-dockerized/data/conf/rspamd/custom/bulk_header.map
index e9dc206..39aa7fe 100644
--- a/mailcow/src/mailcow-dockerized/data/conf/rspamd/custom/bulk_header.map
+++ b/mailcow/src/mailcow-dockerized/data/conf/rspamd/custom/bulk_header.map
@@ -17,3 +17,4 @@
/.*light-house-traffic.*/i
/.*newsletterplus.*/i
/.*X-Chpo.*/i
+/.*List-Unsubscribe:.*@nl\..*/i
diff --git a/mailcow/src/mailcow-dockerized/data/conf/rspamd/dynmaps/settings.php b/mailcow/src/mailcow-dockerized/data/conf/rspamd/dynmaps/settings.php
index 0569db9..274e9da 100644
--- a/mailcow/src/mailcow-dockerized/data/conf/rspamd/dynmaps/settings.php
+++ b/mailcow/src/mailcow-dockerized/data/conf/rspamd/dynmaps/settings.php
@@ -26,9 +26,8 @@
}
// Check if db changed and return header
-/*
-$stmt = $pdo->prepare("SELECT MAX(UNIX_TIMESTAMP(UPDATE_TIME)) AS `db_update_time` FROM information_schema.tables
- WHERE (`TABLE_NAME` = 'filterconf' OR `TABLE_NAME` = 'settingsmap')
+$stmt = $pdo->prepare("SELECT GREATEST(COALESCE(MAX(UNIX_TIMESTAMP(UPDATE_TIME)), 1), COALESCE(MAX(UNIX_TIMESTAMP(CREATE_TIME)), 1)) AS `db_update_time` FROM `information_schema`.`tables`
+ WHERE (`TABLE_NAME` = 'filterconf' OR `TABLE_NAME` = 'settingsmap' OR `TABLE_NAME` = 'sogo_quick_contact' OR `TABLE_NAME` = 'alias')
AND TABLE_SCHEMA = :dbname;");
$stmt->execute(array(
':dbname' => $database_name
@@ -43,7 +42,6 @@
} else {
header('Last-Modified: '.gmdate('D, d M Y H:i:s', $db_update_time).' GMT', true, 200);
}
-*/
function parse_email($email) {
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) return false;
@@ -51,6 +49,30 @@
return array('local' => substr($email, 0, $a), 'domain' => substr($email, $a));
}
+function normalize_email($email) {
+ $email = strtolower(str_replace('/', '\/', $email));
+ $gm = "@gmail.com";
+ if (substr_compare($email, $gm, -strlen($gm)) == 0) {
+ $email = explode('@', $email);
+ $email[0] = str_replace('.', '', $email[0]);
+ $email = implode('@', $email);
+ }
+ $gm_alt = "@googlemail.com";
+ if (substr_compare($email, $gm_alt, -strlen($gm_alt)) == 0) {
+ $email = explode('@', $email);
+ $email[0] = str_replace('.', '', $email[0]);
+ $email[1] = str_replace('@', '', $gm);
+ $email = implode('@', $email);
+ }
+ if (str_contains($email, "+")) {
+ $email = explode('@', $email);
+ $user = explode('+', $email[0]);
+ $email[0] = $user[0];
+ $email = implode('@', $email);
+ }
+ return $email;
+}
+
function wl_by_sogo() {
global $pdo;
$rcpt = array();
@@ -65,7 +87,7 @@
}
// Explicit from, no mime_from, no regex - envelope must match
// mailcow white and blacklists also cover mime_from
- $rcpt[$row['user']][] = str_replace('/', '\/', $contact);
+ $rcpt[$row['user']][] = normalize_email($contact);
}
}
return $rcpt;
diff --git a/mailcow/src/mailcow-dockerized/data/conf/rspamd/local.d/metadata_exporter.conf b/mailcow/src/mailcow-dockerized/data/conf/rspamd/local.d/metadata_exporter.conf
index b6aa150..47373d9 100644
--- a/mailcow/src/mailcow-dockerized/data/conf/rspamd/local.d/metadata_exporter.conf
+++ b/mailcow/src/mailcow-dockerized/data/conf/rspamd/local.d/metadata_exporter.conf
@@ -26,7 +26,7 @@
mailcow_rcpt = <<EOD
return function(task)
local action = task:get_metric_action('default')
- if task:has_symbol('NO_LOG_STAT') or (action == 'reject' or action == 'add header' or action == 'rewrite subject') then
+ if task:has_symbol('NO_LOG_STAT') or (action == 'soft reject' or action == 'reject' or action == 'add header' or action == 'rewrite subject') then
return false
else
if task:get_symbol("RCPT_MAILCOW_DOMAIN") then
diff --git a/mailcow/src/mailcow-dockerized/data/conf/rspamd/local.d/mime_types.conf b/mailcow/src/mailcow-dockerized/data/conf/rspamd/local.d/mime_types.conf
index 5d82982..08a08b6 100644
--- a/mailcow/src/mailcow-dockerized/data/conf/rspamd/local.d/mime_types.conf
+++ b/mailcow/src/mailcow-dockerized/data/conf/rspamd/local.d/mime_types.conf
@@ -14,7 +14,7 @@
ps1 = 4,
ace = 4,
arj = 4,
- cab = 3,
+ cab = 20,
vbs = 20,
hta = 4,
shs = 4,
diff --git a/mailcow/src/mailcow-dockerized/data/conf/rspamd/lua/rspamd.local.lua b/mailcow/src/mailcow-dockerized/data/conf/rspamd/lua/rspamd.local.lua
index b007f09..6318bd2 100644
--- a/mailcow/src/mailcow-dockerized/data/conf/rspamd/lua/rspamd.local.lua
+++ b/mailcow/src/mailcow-dockerized/data/conf/rspamd/lua/rspamd.local.lua
@@ -1,10 +1,3 @@
--- Load sendgrid ID validator, thanks to https://github.com/fatalbanana
-local rspamd_util = require 'rspamd_util'
-local f = '/etc/rspamd/lua/ivm-sg.lua'
-if rspamd_util.file_exists(f) then
- dofile(f)
-end
-
rspamd_config.MAILCOW_AUTH = {
callback = function(task)
local uname = task:get_user()
@@ -500,7 +493,7 @@
type = 'postfilter',
callback = function(task)
local from = task:get_header('From')
- if from and monitoring_hosts:get_key(from) then
+ if from and (monitoring_hosts:get_key(from) or from == "watchdog@localhost") then
task:set_flag('no_log')
task:set_flag('no_stat')
end