From 9eb45b6802923b0d77dc8eb77b6fc9f4be59e9c6 Mon Sep 17 00:00:00 2001 From: Andrew Lewis Date: Sun, 3 Jan 2016 20:10:40 +0200 Subject: RBL module: remove `private_ips` setting in favour of `local_addrs` --- src/plugins/lua/rbl.lua | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'src/plugins/lua/rbl.lua') diff --git a/src/plugins/lua/rbl.lua b/src/plugins/lua/rbl.lua index 0a2b9bdd9..42bc92d3b 100644 --- a/src/plugins/lua/rbl.lua +++ b/src/plugins/lua/rbl.lua @@ -31,7 +31,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. local rbls = {} local local_exclusions = nil -local private_ips = nil local rspamd_logger = require 'rspamd_logger' local rspamd_ip = require 'rspamd_ip' @@ -60,13 +59,6 @@ local function validate_dns(lstr) 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 @@ -145,7 +137,7 @@ local function rbl_cb (task) 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 @@ -303,7 +295,7 @@ local function rbl_cb (task) 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, @@ -336,7 +328,6 @@ if type(rspamd_config.get_api_version) ~= 'nil' then 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') @@ -378,9 +369,6 @@ end 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 = {} -- cgit v1.2.3