diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-04-03 15:53:17 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-03 15:53:17 +0100 |
commit | 92acef211134a71eb8740b54ad8e02e16a7511ab (patch) | |
tree | 67da879742abf457789cc85846275fa11228f688 | |
parent | 7510ea3f0d8ccc90ce723499d9cb382f5c36a9da (diff) | |
parent | 8738186f1b2ce102ef5a614f901ba606dc4d9fe9 (diff) | |
download | rspamd-92acef211134a71eb8740b54ad8e02e16a7511ab.tar.gz rspamd-92acef211134a71eb8740b54ad8e02e16a7511ab.zip |
Merge pull request #2139 from moisseev/hfilter
[Minor] Insert symbol on PTR verification DNS error
-rw-r--r-- | conf/scores.d/headers_group.conf | 4 | ||||
-rw-r--r-- | src/plugins/lua/once_received.lua | 9 |
2 files changed, 13 insertions, 0 deletions
diff --git a/conf/scores.d/headers_group.conf b/conf/scores.d/headers_group.conf index ac3134e36..55251bebf 100644 --- a/conf/scores.d/headers_group.conf +++ b/conf/scores.d/headers_group.conf @@ -50,6 +50,10 @@ symbols = { weight = 1.0; description = "Cannot resolve reverse DNS for sender's IP"; } + "RDNS_DNSFAIL" { + weight = 0.0; + description = "PTR verification DNS error"; + } "ONCE_RECEIVED_STRICT" { weight = 4.0; description = "One received header with 'bad' patterns inside"; diff --git a/src/plugins/lua/once_received.lua b/src/plugins/lua/once_received.lua index 75d551ec1..503a98345 100644 --- a/src/plugins/lua/once_received.lua +++ b/src/plugins/lua/once_received.lua @@ -22,6 +22,7 @@ end local symbol = 'ONCE_RECEIVED' local symbol_rdns = 'RDNS_NONE' +local symbol_rdns_dnsfail = 'RDNS_DNSFAIL' local symbol_mx = 'DIRECT_TO_MX' -- Symbol for strict checks local symbol_strict = nil @@ -38,6 +39,7 @@ local function check_quantity_received (task) local function recv_dns_cb(_, to_resolve, results, err) if err and (err ~= 'requested record is not found' and err ~= 'no records with this name') then rspamd_logger.errx(task, 'error looking up %s: %s', to_resolve, err) + task:insert_result(symbol_rdns_dnsfail, 1.0) end task:inc_dns_req() @@ -165,6 +167,8 @@ if opts then symbol_strict = v elseif n == 'symbol_rdns' then symbol_rdns = v + elseif n == 'symbol_rdns_dnsfail' then + symbol_rdns_dnsfail = v elseif n == 'bad_host' then if type(v) == 'string' then bad_hosts[1] = v @@ -190,6 +194,11 @@ if opts then type = 'virtual', parent = id }) + rspamd_config:register_symbol({ + name = symbol_rdns_dnsfail, + type = 'virtual', + parent = id + }) rspamd_config:register_symbol({ name = symbol_strict, type = 'virtual', |