Skip to content

Commit

Permalink
[Project] Rbl: Migrate to checks
Browse files Browse the repository at this point in the history
  • Loading branch information
vstakhov committed Oct 20, 2020
1 parent e95b2fa commit 9e9a41a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 39 deletions.
55 changes: 18 additions & 37 deletions conf/modules.d/rbl.conf
Expand Up @@ -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',
Expand All @@ -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";
Expand All @@ -79,31 +78,30 @@ rbl {

senderscore {
symbol = "RBL_SENDERSCORE";
from = true; # Check source IP address
checks = ['from'];
rbl = "bl.score.senderscore.com";
}

sem {
symbol = "RBL_SEM";
rbl = "bl.spameatingmonkey.net";
ipv6 = false;
from = true; # Check source IP address
checks = ['from'];
}

semIPv6 {
symbol = "RBL_SEM_IPV6";
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";
Expand All @@ -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";
}
Expand All @@ -133,7 +131,7 @@ rbl {
symbol = "RBL_NIXSPAM";
rbl = "ix.dnsbl.manitu.net";
ipv6 = true;
from = true; # Check source IP address
checks = ['from'];
}

blocklistde {
Expand All @@ -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;

Expand All @@ -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";
Expand All @@ -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 = {
Expand All @@ -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 = {
Expand All @@ -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 {
Expand All @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down
6 changes: 4 additions & 2 deletions lualib/plugins/rbl.lua
Expand Up @@ -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)
Expand Down

0 comments on commit 9e9a41a

Please sign in to comment.