[Rspamd] Add symbol HAM_TRAP or SPAM_TRAP for trap aliases

master
andryyy 2020-10-29 20:29:14 +01:00
parent c586ddd5db
commit d94b5e43ea
No known key found for this signature in database
GPG Key ID: 8EC34FF2794E25EF
2 changed files with 26 additions and 9 deletions

View File

@ -394,13 +394,8 @@ while ($row = array_shift($rows)) {
*/
?>
traps {
ham_trap {
<?php
foreach (ucl_rcpts('spam@localhost', 'mailbox') as $rcpt) {
?>
rcpt = <?=json_encode($rcpt, JSON_UNESCAPED_SLASHES);?>;
<?php
}
foreach (ucl_rcpts('ham@localhost', 'mailbox') as $rcpt) {
?>
rcpt = <?=json_encode($rcpt, JSON_UNESCAPED_SLASHES);?>;
@ -408,7 +403,29 @@ while ($row = array_shift($rows)) {
}
?>
priority = 9;
want_spam = yes;
apply "default" {
symbols_enabled = ["HISTORY_SAVE"];
}
symbols [
"HAM_TRAP"
]
}
spam_trap {
<?php
foreach (ucl_rcpts('spam@localhost', 'mailbox') as $rcpt) {
?>
rcpt = <?=json_encode($rcpt, JSON_UNESCAPED_SLASHES);?>;
<?php
}
?>
priority = 9;
apply "default" {
symbols_enabled = ["HISTORY_SAVE"];
}
symbols [
"SPAM_TRAP"
]
}
<?php
// Start additional content

View File

@ -113,9 +113,9 @@ rspamd_config:register_symbol({
for _,fr in ipairs(from) do
local fr_split = rspamd_str_split(fr['addr'], '@')
if #fr_split == 2 then
if fr_split[1] == 'postmaster' then
if fr_split[1] == 'postmaster' and task:get_user() then
-- no whitelist, keep signatures
task:insert_result(true, 'POSTMASTER_FROM', -2500.0, from_ip_string)
task:insert_result(true, 'POSTMASTER_FROM', -2500.0)
return
end
end