]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Insert symbol on PTR verification DNS error 2139/head
authorAlexander Moisseev <moiseev@mezonplus.ru>
Mon, 2 Apr 2018 16:19:57 +0000 (19:19 +0300)
committerAlexander Moisseev <moiseev@mezonplus.ru>
Mon, 2 Apr 2018 16:19:57 +0000 (19:19 +0300)
conf/scores.d/headers_group.conf
src/plugins/lua/once_received.lua

index ac3134e366b1a3b2fbc718c94295a3f0179b8ead..55251bebf8551b4298e7ae55fe0564117ec33aab 100644 (file)
@@ -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";
index 75d551ec19b543e3b62e8c9fff661a549e930199..503a983457b03d110bc274de30ca3d027b82a813 100644 (file)
@@ -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
@@ -189,6 +193,11 @@ if opts then
       name = symbol_rdns,
       type = 'virtual',
       parent = id
+    })
+    rspamd_config:register_symbol({
+      name = symbol_rdns_dnsfail,
+      type = 'virtual',
+      parent = id
     })
       rspamd_config:register_symbol({
       name = symbol_strict,