Merge remote-tracking branch 'origin' into gnous
This commit is contained in:
491 files changed
+36108
-8685
No files matched your search
@@ -25,6 +25,8 @@ skip-host-cache
|
||||
skip-name-resolve
|
||||
log-warnings = 0
|
||||
event_scheduler = 1
|
||||
interactive_timeout = 3610
|
||||
wait_timeout = 3610
|
||||
|
||||
[client]
|
||||
default-character-set = utf8mb4
|
||||
|
||||
@@ -27,7 +27,7 @@ maximal_backoff_time = 1800s
|
||||
maximal_queue_lifetime = 5d
|
||||
delay_warning_time = 4h
|
||||
message_size_limit = 104857600
|
||||
milter_default_action = accept
|
||||
milter_default_action = tempfail
|
||||
milter_protocol = 6
|
||||
minimal_backoff_time = 300s
|
||||
plaintext_reject_code = 550
|
||||
|
||||
@@ -17,3 +17,4 @@
|
||||
/.*light-house-traffic.*/i
|
||||
/.*newsletterplus.*/i
|
||||
/.*X-Chpo.*/i
|
||||
/.*List-Unsubscribe:.*@nl\..*/i
|
||||
@@ -26,9 +26,8 @@ catch (PDOException $e) {
|
||||
}
|
||||
|
||||
// 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 @@ if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && (strtotime($_SERVER['HTTP_IF_MO
|
||||
} 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 @@ function parse_email($email) {
|
||||
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 @@ function wl_by_sogo() {
|
||||
}
|
||||
// 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;
|
||||
|
||||
@@ -26,7 +26,7 @@ custom_select {
|
||||
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
|
||||
|
||||
@@ -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 @@ rspamd_config:register_symbol({
|
||||
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
|
||||
|
||||
Reference in new issue
Block a user