end
if not havegot['from'] then
havegot['from'] = task:get_from_ip()
- if not havegot['from']:is_valid() or is_private_ip(havegot['from']) then
+ if not havegot['from']:is_valid() or
+ (rbl['exclude_private_ips'] and is_private_ip(havegot['from'])) then
notgot['from'] = true
return
end
for _,rh in ipairs(havegot['received']) do
if rh['real_ip'] and rh['real_ip']:is_valid() then
if ((rh['real_ip']:get_version() == 6 and rbl['ipv6']) or
- (rh['real_ip']:get_version() == 4 and rbl['ipv4']))
- and not is_private_ip(rh['real_ip']) then
- task:get_resolver():resolve_a(task:get_session(), task:get_mempool(),
- ip_to_rbl(rh['real_ip'], rbl['rbl']), rbl_dns_cb, k)
+ (rh['real_ip']:get_version() == 4 and rbl['ipv4'])) and
+ ((rbl['exclude_private_ips'] and not is_private_ip(rh['real_ip'])) or
+ not rbl['exclude_private_ips']) then
+ task:get_resolver():resolve_a(task:get_session(), task:get_mempool(),
+ ip_to_rbl(rh['real_ip'], rbl['rbl']), rbl_dns_cb, k)
end
end
end
rspamd_config:register_module_option('rbl', 'default_helo', 'string')
rspamd_config:register_module_option('rbl', 'default_unknown', 'string')
rspamd_config:register_module_option('rbl', 'default_exclude_users', 'string')
+ rspamd_config:register_module_option('rbl', 'default_exclude_private_ips', 'string')
end
end
if(opts['default_exclude_users'] == nil) then
opts['default_exclude_users'] = false
end
+if(opts['default_exclude_private_ips'] == nil) then
+ opts['default_exclude_private_ips'] = false
+end
+
for key,rbl in pairs(opts['rbls']) do
- local o = { "ipv4", "ipv6", "from", "received", "unknown", "rdns", "helo", "exclude_users" }
+ local o = { "ipv4", "ipv6", "from", "received", "unknown", "rdns", "helo", "exclude_users", "exclude_private_ips" }
for i=1,table.maxn(o) do
if(rbl[o[i]] == nil) then
rbl[o[i]] = opts['default_' .. o[i]]