- default_exclude_private_ips (true)
-If true & private_ips is set appropriately, do not use the RBL if the sending host address is in the private IP list & do not check received headers baring these addresses.
+If true, do not use the RBL if the sending host address is in `local_addrs` & do not check received headers baring these addresses.
- default_exclude_local (true)
Can be set to a URL of a list of IPv4/IPv6 addresses & subnets not to be considered as local exclusions by exclude_local checks.
-- private_ips
-
-Should be set to a space/comma/semicolon-delimited list of addresses & subnets to be considered private by exclude_private_ips checks.
-
RBL-specific subsection is structured as follows:
~~~nginx
local rbls = {}
local local_exclusions = nil
-local private_ips = nil
local rspamd_logger = require 'rspamd_logger'
local rspamd_ip = require 'rspamd_ip'
return true
end
-local function is_private_ip(rip)
- if private_ips and private_ips:get_key(rip) then
- return true
- end
- return false
-end
-
local function is_excluded_ip(rip)
if local_exclusions and local_exclusions:get_key(rip) then
return true
end
if havegot['from'] and not notgot['from'] and ((rbl['exclude_local'] and
is_excluded_ip(havegot['from'])) or (rbl['exclude_private_ips'] and
- is_private_ip(havegot['from']))) then
+ havegot['from']:is_local())) then
return
end
end
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
- ((rbl['exclude_private_ips'] and not is_private_ip(rh['real_ip'])) or
+ ((rbl['exclude_private_ips'] and not rh['real_ip']:is_local()) or
not rbl['exclude_private_ips']) and ((rbl['exclude_local_ips'] and
not is_excluded_ip(rh['real_ip'])) or not rbl['exclude_local_ips']) then
task:get_resolver():resolve_a({task = task,
rspamd_config:register_module_option('rbl', 'default_exclude_private_ips', 'string')
rspamd_config:register_module_option('rbl', 'local_exclude_ip_map', 'string')
rspamd_config:register_module_option('rbl', 'default_exclude_local', 'string')
- rspamd_config:register_module_option('rbl', 'private_ips', 'string')
rspamd_config:register_module_option('rbl', 'default_emails', 'string')
rspamd_config:register_module_option('rbl', 'default_is_whitelist', 'string')
rspamd_config:register_module_option('rbl', 'default_ignore_whitelists', 'string')
if(opts['local_exclude_ip_map'] ~= nil) then
local_exclusions = rspamd_config:add_radix_map(opts['local_exclude_ip_map'])
end
-if(opts['private_ips'] ~= nil) then
- private_ips = rspamd_config:radix_from_config('rbl', 'private_ips')
-end
local white_symbols = {}
local black_symbols = {}