aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/lua/multimap.lua
diff options
context:
space:
mode:
authorAndrew Lewis <nerf@judo.za.org>2016-08-17 11:33:06 +0200
committerAndrew Lewis <nerf@judo.za.org>2016-08-17 11:33:06 +0200
commit643ca8d0dab13ff0502a85aae859c1733030bd7b (patch)
treec9e2fcf034e322e38f07c6c03f3007c7fa6c47c7 /src/plugins/lua/multimap.lua
parent95492aa853706b30d32c04bdbf6fc79b90de41e4 (diff)
downloadrspamd-643ca8d0dab13ff0502a85aae859c1733030bd7b.tar.gz
rspamd-643ca8d0dab13ff0502a85aae859c1733030bd7b.zip
[Feature] ASN module; support matching ASN/country in multimap
- Also removed stuff from ip_score - Updated tests
Diffstat (limited to 'src/plugins/lua/multimap.lua')
-rw-r--r--src/plugins/lua/multimap.lua14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/plugins/lua/multimap.lua b/src/plugins/lua/multimap.lua
index 31cd01d50..a4577676a 100644
--- a/src/plugins/lua/multimap.lua
+++ b/src/plugins/lua/multimap.lua
@@ -509,6 +509,16 @@ local function multimap_callback(task, rule)
if hostname and hostname ~= 'unknown' then
match_hostname(rule, hostname)
end
+ elseif rt == 'asn' then
+ local asn = task:get_mempool():get_variable('asn')
+ if asn then
+ match_rule(rule, asn)
+ end
+ elseif rt == 'country' then
+ local country = task:get_mempool():get_variable('country')
+ if country then
+ match_rule(rule, country)
+ end
end
end
@@ -595,7 +605,9 @@ local function add_multimap_rule(key, newrule)
or newrule['type'] == 'filename'
or newrule['type'] == 'url'
or newrule['type'] == 'content'
- or newrule['type'] == 'hostname' then
+ or newrule['type'] == 'hostname'
+ or newrule['type'] == 'asn'
+ or newrule['type'] == 'country' then
if newrule['regexp'] then
newrule['hash'] = rspamd_config:add_map ({
url = newrule['map'],