commit 9e9a41a: [Project] Rbl: Migrate to `checks`

Vsevolod Stakhov vsevolod at highsecure.ru
Tue Oct 20 14:49:10 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-10-20 15:10:02 +0100
URL: https://github.com/rspamd/rspamd/commit/9e9a41aedd0ee6ac6744a1ed291f7e452e089b46 (HEAD -> master)

[Project] Rbl: Migrate to `checks`

---
 conf/modules.d/rbl.conf | 55 ++++++++++++++++---------------------------------
 lualib/plugins/rbl.lua  |  6 ++++--
 2 files changed, 22 insertions(+), 39 deletions(-)

diff --git a/conf/modules.d/rbl.conf b/conf/modules.d/rbl.conf
index 6a0b37ce0..1a97efc06 100644
--- a/conf/modules.d/rbl.conf
+++ b/conf/modules.d/rbl.conf
@@ -34,8 +34,7 @@ rbl {
       symbol = "SPAMHAUS"; # Augmented by prefixes
       rbl = "zen.spamhaus.org";
       # Check types
-      received = true;
-      from = true;
+      checks = ['received', 'from'];
 
       symbols_prefixes = {
         received = 'RECEIVED',
@@ -57,7 +56,7 @@ rbl {
       symbol = "MAILSPIKE";
       rbl = "rep.mailspike.net";
       is_whitelist = true;
-      from = true; # Check source IP address
+      checks = ['from'];
       whitelist_exception = "MAILSPIKE";
       whitelist_exception = "RWL_MAILSPIKE_GOOD";
       whitelist_exception = "RWL_MAILSPIKE_NEUTRAL";
@@ -79,7 +78,7 @@ rbl {
 
     senderscore {
       symbol = "RBL_SENDERSCORE";
-      from = true; # Check source IP address
+      checks = ['from'];
       rbl = "bl.score.senderscore.com";
     }
 
@@ -87,7 +86,7 @@ rbl {
       symbol = "RBL_SEM";
       rbl = "bl.spameatingmonkey.net";
       ipv6 = false;
-      from = true; # Check source IP address
+      checks = ['from'];
     }
 
     semIPv6 {
@@ -95,15 +94,14 @@ rbl {
       rbl = "bl.ipv6.spameatingmonkey.net";
       ipv4 = false;
       ipv6 = true;
-      from = true; # Check source IP address
+      checks = ['from'];
     }
 
     dnswl {
       symbol = "RCVD_IN_DNSWL";
       rbl = "list.dnswl.org";
       ipv6 = true;
-      from = true; # Check source IP address
-      received = true; # Check source IP address
+      checks = ['from', 'received'];
       is_whitelist = true;
       whitelist_exception = "RCVD_IN_DNSWL";
       whitelist_exception = "RCVD_IN_DNSWL_NONE";
@@ -123,7 +121,7 @@ rbl {
       symbol = "RBL_VIRUSFREE_UNKNOWN";
       rbl = "bip.virusfree.cz";
       ipv6 = true;
-      from = true; # Check source IP address
+      checks = ['from'];
       returncodes {
         RBL_VIRUSFREE_BOTNET = "127.0.0.2";
       }
@@ -133,7 +131,7 @@ rbl {
       symbol = "RBL_NIXSPAM";
       rbl = "ix.dnsbl.manitu.net";
       ipv6 = true;
-      from = true; # Check source IP address
+      checks = ['from'];
     }
 
     blocklistde {
@@ -144,17 +142,14 @@ rbl {
       symbol = "BLOCKLISTDE";
       rbl = "bl.blocklist.de";
       ipv6 = true;
-      received = true;
-      from = true;
+      checks = ['from', 'received'];
     }
 
     # Dkim whitelist
     dnswl_dwl {
       symbol = "DWL_DNSWL";
       rbl = "dwl.dnswl.org";
-      dkim = true;
-      dkim_domainonly = false;
-      dkim_match_from = true;
+      checks = ['dkim'];
       ignore_whitelist = true;
       unknown = false;
 
@@ -174,8 +169,7 @@ rbl {
       hash_format = "base32";
       hash_len = 32;
       rbl = "email.rspamd.com";
-      emails = true; # Emails in body
-      replyto = true; # Email from reply-to header
+      checks = ['emails', 'replyto'];
       hash = "blake2";
       returncodes = {
         RSPAMD_EMAILBL = "127.0.0.2";
@@ -185,8 +179,7 @@ rbl {
       ignore_whitelist = true;
       ignore_defaults = true;
       rbl = "ebl.msbl.org";
-      emails = true; # Emails in body
-      replyto = true; # Email from reply-to header
+      checks = ['emails', 'replyto'];
       emails_domainonly = false;
       hash = "sha1";
       returncodes = {
@@ -204,9 +197,7 @@ rbl {
     "SURBL_MULTI" {
       ignore_defaults = true;
       rbl = "multi.surbl.org";
-      dkim = true;
-      emails = true;
-      urls = true;
+      checks = ['emails', 'dkim', 'urls'];
       emails_domainonly = true;
 
       returnbits = {
@@ -221,9 +212,7 @@ rbl {
     "URIBL_MULTI" {
       ignore_defaults = true;
       rbl = "multi.uribl.com";
-      dkim = true;
-      emails = true;
-      urls = true;
+      checks = ['emails', 'dkim', 'urls'];
       emails_domainonly = true;
 
       returnbits {
@@ -237,9 +226,7 @@ rbl {
     "RSPAMD_URIBL" {
       ignore_defaults = true;
       rbl = "uribl.rspamd.com";
-      dkim = true;
-      emails = true;
-      urls = true;
+      checks = ['emails', 'dkim', 'urls'];
       emails_domainonly = true;
       hash = 'blake2';
       hash_len = 32;
@@ -256,10 +243,8 @@ rbl {
       ignore_defaults = true;
       rbl = "dbl.spamhaus.org";
       no_ip = true;
-      dkim = true;
-      emails = true;
+      checks = ['emails', 'dkim', 'urls'];
       emails_domainonly = true;
-      urls = true;
 
       returncodes = {
         # spam domain
@@ -306,10 +291,8 @@ rbl {
       ignore_defaults = true;
       rbl = "uribl.spameatingmonkey.net";
       no_ip = true;
-      dkim = true;
-      emails = true;
+      checks = ['emails', 'dkim', 'urls'];
       emails_domainonly = true;
-      urls = true;
       returnbits {
         SEM_URIBL = 2;
       }
@@ -319,10 +302,8 @@ rbl {
       ignore_defaults = true;
       rbl = "fresh15.spameatingmonkey.net";
       no_ip = true;
-      dkim = true;
-      emails = true;
+      checks = ['emails', 'dkim', 'urls'];
       emails_domainonly = true;
-      urls = true;
       returnbits {
         SEM_URIBL_FRESH15 = 2;
       }
diff --git a/lualib/plugins/rbl.lua b/lualib/plugins/rbl.lua
index 7105d73a4..4eeff7b09 100644
--- a/lualib/plugins/rbl.lua
+++ b/lualib/plugins/rbl.lua
@@ -142,13 +142,15 @@ local function convert_checks(rule)
           rspamd_logger.errx(rspamd_config, 'rbl rule %s has check %s which requires an argument',
               rule.symbol, check)
           return nil
-        else
-          rule[check] = check_type
         end
       end
+
+      rule[check] = check_type
+
       if not check_type.connfilter then
         all_connfilter = false
       end
+
       if not check_type then
         rspamd_logger.errx(rspamd_config, 'rbl rule %s has invalid check type: %s',
             rule.symbol, check)


More information about the Commits mailing list