git subrepo commit mailcow/src/mailcow-dockerized
subrepo: subdir: "mailcow/src/mailcow-dockerized"
merged: "308860af"
upstream: origin: "https://github.com/mailcow/mailcow-dockerized.git"
branch: "master"
commit: "3f1a5af8"
git-subrepo: version: "0.4.5"
origin: "???"
commit: "???"
Change-Id: I5d51c14b45db54fe706be40a591ddbfcea50d4b0
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 39aa7fe..69a20af 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
@@ -3,7 +3,6 @@
/.*episerver.*/i
/.*supergewinne.*/i
/List-Unsubscribe.*nbps\.eu/i
-/X-Mailer: AWeber.*/i
/.*regiofinder.*/i
/.*EmailSocket.*/i
/List-Unsubscribe:.*respread.*/i
diff --git a/mailcow/src/mailcow-dockerized/data/conf/rspamd/local.d/groups.conf b/mailcow/src/mailcow-dockerized/data/conf/rspamd/local.d/groups.conf
index 9ca3409..f77d8a4 100644
--- a/mailcow/src/mailcow-dockerized/data/conf/rspamd/local.d/groups.conf
+++ b/mailcow/src/mailcow-dockerized/data/conf/rspamd/local.d/groups.conf
@@ -18,6 +18,9 @@
"ENCRYPTED_CHAT" {
score = -20.0;
}
+ "SOGO_CONTACT" {
+ score = -99.0;
+ }
}
group "MX" {
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 47373d9..daaa79b 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
@@ -16,8 +16,7 @@
backend = "http";
url = "http://nginx:9081/pushover.php";
selector = "mailcow_rcpt";
- # Only return msgid, do not parse the full message
- formatter = "msgid";
+ formatter = "json";
meta_headers = true;
}
}
diff --git a/mailcow/src/mailcow-dockerized/data/conf/rspamd/local.d/neural.conf b/mailcow/src/mailcow-dockerized/data/conf/rspamd/local.d/neural.conf
deleted file mode 100644
index f4658db..0000000
--- a/mailcow/src/mailcow-dockerized/data/conf/rspamd/local.d/neural.conf
+++ /dev/null
@@ -1,24 +0,0 @@
-rules {
- "LONG" {
- train {
- max_trains = 200;
- max_usages = 20;
- max_iterations = 25;
- learning_rate = 0.01,
- }
- symbol_spam = "NEURAL_SPAM_LONG";
- symbol_ham = "NEURAL_HAM_LONG";
- ann_expire = 45d;
- }
- "SHORT" {
- train {
- max_trains = 100;
- max_usages = 10;
- max_iterations = 15;
- learning_rate = 0.01,
- }
- symbol_spam = "NEURAL_SPAM_SHORT";
- symbol_ham = "NEURAL_HAM_SHORT";
- ann_expire = 7d;
- }
-}
diff --git a/mailcow/src/mailcow-dockerized/data/conf/rspamd/local.d/neural_group.conf b/mailcow/src/mailcow-dockerized/data/conf/rspamd/local.d/neural_group.conf
deleted file mode 100644
index fca5cec..0000000
--- a/mailcow/src/mailcow-dockerized/data/conf/rspamd/local.d/neural_group.conf
+++ /dev/null
@@ -1,18 +0,0 @@
-symbols = {
- "NEURAL_SPAM_LONG" {
- weight = 3.7; # sample weight
- description = "Neural network spam (long)";
- }
- "NEURAL_HAM_LONG" {
- weight = -4.0; # sample weight
- description = "Neural network ham (long)";
- }
- "NEURAL_SPAM_SHORT" {
- weight = 2.5; # sample weight
- description = "Neural network spam (short)";
- }
- "NEURAL_HAM_SHORT" {
- weight = -2.0; # sample weight
- description = "Neural network ham (short)";
- }
-}
diff --git a/mailcow/src/mailcow-dockerized/data/conf/rspamd/lua/ivm-sg.lua b/mailcow/src/mailcow-dockerized/data/conf/rspamd/lua/ivm-sg.lua
deleted file mode 100644
index 6642fe4..0000000
--- a/mailcow/src/mailcow-dockerized/data/conf/rspamd/lua/ivm-sg.lua
+++ /dev/null
@@ -1,61 +0,0 @@
--- Thanks to https://raw.githubusercontent.com/fatalbanana
-
-local lua_maps = require 'lua_maps'
-local rspamd_regexp = require 'rspamd_regexp'
-local rspamd_util = require 'rspamd_util'
-
-local ivm_sendgrid_ids = lua_maps.map_add_from_ucl(
- 'https://www.invaluement.com/spdata/sendgrid-id-dnsbl.txt',
- 'set',
- 'Invaluement Service Provider DNSBL: Sendgrid IDs'
-)
-
-local ivm_sendgrid_envfromdomains = lua_maps.map_add_from_ucl(
- 'https://www.invaluement.com/spdata/sendgrid-envelopefromdomain-dnsbl.txt',
- 'set',
- 'Invaluement Service Provider DNSBL: Sendgrid envelope domains'
-)
-
-local cb_id = rspamd_config:register_symbol({
- name = 'IVM_SENDGRID',
- callback = function(task)
- -- Is it Sendgrid?
- local sg_hdr = task:get_header('X-SG-EID')
- if not sg_hdr then return end
-
- -- Get original envelope from
- local env_from = task:get_from{'smtp', 'orig'}
- if not env_from then return end
-
- -- Check normalised domain in domains list
- if ivm_sendgrid_envfromdomains and ivm_sendgrid_envfromdomains:get_key(rspamd_util.get_tld(env_from[1].domain)) then
- task:insert_result('IVM_SENDGRID_DOMAIN', 1.0)
- end
-
- -- Check ID in ID list
- local lp_re = rspamd_regexp.create_cached([[^bounces\+(\d+)-]])
- local res = lp_re:search(env_from[1].user, true, true)
- if not res then return end
- if ivm_sendgrid_ids and ivm_sendgrid_ids:get_key(res[1][2]) then
- task:insert_result('IVM_SENDGRID_ID', 1.0)
- end
- end,
- description = 'Invaluement Service Provider DNSBL: Sendgrid',
- type = 'callback',
-})
-
-rspamd_config:register_symbol({
- name = 'IVM_SENDGRID_DOMAIN',
- parent = cb_id,
- group = 'ivmspdnsbl',
- score = 8.0,
- type = 'virtual',
-})
-
-rspamd_config:register_symbol({
- name = 'IVM_SENDGRID_ID',
- parent = cb_id,
- group = 'ivmspdnsbl',
- score = 8.0,
- type = 'virtual',
-})
diff --git a/mailcow/src/mailcow-dockerized/data/conf/rspamd/meta_exporter/pushover.php b/mailcow/src/mailcow-dockerized/data/conf/rspamd/meta_exporter/pushover.php
index a5e8334..10265d1 100644
--- a/mailcow/src/mailcow-dockerized/data/conf/rspamd/meta_exporter/pushover.php
+++ b/mailcow/src/mailcow-dockerized/data/conf/rspamd/meta_exporter/pushover.php
@@ -47,12 +47,14 @@
}
$headers = getallheaders();
+$json_body = json_decode(file_get_contents('php://input'));
$qid = $headers['X-Rspamd-Qid'];
$rcpts = $headers['X-Rspamd-Rcpt'];
$sender = $headers['X-Rspamd-From'];
$ip = $headers['X-Rspamd-Ip'];
$subject = $headers['X-Rspamd-Subject'];
+$messageid= $json_body->message_id;
$priority = 0;
$symbols_array = json_decode($headers['X-Rspamd-Symbols'], true);
@@ -65,6 +67,20 @@
}
}
+$sender_address = $json_body->header_from[0];
+$sender_name = '-';
+if (preg_match('/(?<name>.*?)<(?<address>.*?)>/i', $sender_address, $matches)) {
+ $sender_address = $matches['address'];
+ $sender_name = trim($matches['name'], '"\' ');
+}
+
+$to_address = $json_body->header_to[0];
+$to_name = '-';
+if (preg_match('/(?<name>.*?)<(?<address>.*?)>/i', $to_address, $matches)) {
+ $to_address = $matches['address'];
+ $to_name = trim($matches['name'], '"\' ');
+}
+
$rcpt_final_mailboxes = array();
// Loop through all rcpts
@@ -229,9 +245,16 @@
$post_fields = array(
"token" => $api_data['token'],
"user" => $api_data['key'],
- "title" => sprintf("%s", str_replace(array('{SUBJECT}', '{SENDER}'), array($subject, $sender), $title)),
+ "title" => sprintf("%s", str_replace(
+ array('{SUBJECT}', '{SENDER}', '{SENDER_NAME}', '{SENDER_ADDRESS}', '{TO_NAME}', '{TO_ADDRESS}', '{MSG_ID}'),
+ array($subject, $sender, $sender_name, $sender_address, $to_name, $to_address, $messageid), $title)
+ ),
"priority" => $priority,
- "message" => sprintf("%s", str_replace(array('{SUBJECT}', '{SENDER}'), array($subject, $sender), $text))
+ "message" => sprintf("%s", str_replace(
+ array('{SUBJECT}', '{SENDER}', '{SENDER_NAME}', '{SENDER_ADDRESS}', '{TO_NAME}', '{TO_ADDRESS}', '{MSG_ID}', '\n'),
+ array($subject, $sender, $sender_name, $sender_address, $to_name, $to_address, $messageid, PHP_EOL), $text)
+ ),
+ "sound" => $attributes['sound'] ?? "pushover"
);
if ($attributes['evaluate_x_prio'] == "1" && $priority == 1) {
$post_fields['expire'] = 600;