diff options
author | Steve Freegard <steve@stevefreegard.com> | 2017-03-24 19:31:27 +0000 |
---|---|---|
committer | Steve Freegard <steve@stevefreegard.com> | 2017-03-24 19:31:27 +0000 |
commit | 5909eaece4fabe11e3224b9416e142ad0284f55c (patch) | |
tree | c82298ac0b55b7805a1698db37a2c99cbc629788 /src | |
parent | a04efc35197414102796de2ca934c118656f769b (diff) | |
download | rspamd-5909eaece4fabe11e3224b9416e142ad0284f55c.tar.gz rspamd-5909eaece4fabe11e3224b9416e142ad0284f55c.zip |
Add DIRECT_TO_MX rule to once_received plugin
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/lua/once_received.lua | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/plugins/lua/once_received.lua b/src/plugins/lua/once_received.lua index 00161159f..e1eea2ca5 100644 --- a/src/plugins/lua/once_received.lua +++ b/src/plugins/lua/once_received.lua @@ -18,6 +18,7 @@ limitations under the License. local symbol = 'ONCE_RECEIVED' local symbol_rdns = 'RDNS_NONE' +local symbol_mx = 'DIRECT_TO_MX' -- Symbol for strict checks local symbol_strict = nil local bad_hosts = {} @@ -40,6 +41,12 @@ local function check_quantity_received (task) if recvh and #recvh <= 1 then task:insert_result(symbol, 1) task:insert_result(symbol_strict, 1) + -- Check for MUAs + local ua = task:get_header('User-Agent') + local xm = task:get_header('X-Mailer') + if (ua or xm) then + task:insert_result(symbol_mx, 1, (ua or xm)) + end end task:insert_result(symbol_rdns, 1) else @@ -169,6 +176,8 @@ if opts then elseif n == 'whitelist' then whitelist = rspamd_map_add('once_received', 'whitelist', 'radix', 'once received whitelist') + elseif n == 'symbol_mx' then + symbol_mx = v end end @@ -182,5 +191,10 @@ if opts then type = 'virtual', parent = id }) + rspamd_config:register_symbol({ + name = symbol_mx, + type = 'virtual', + parent = id + }) end end |