From d7d8e467a0c07aad3434d437ece3b88429efd885 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sun, 25 Aug 2019 09:46:40 +0100 Subject: [PATCH] [Feature] Rbl: Add ability to check urls --- src/plugins/lua/rbl.lua | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/plugins/lua/rbl.lua b/src/plugins/lua/rbl.lua index 83f57f495..4cafb0c87 100644 --- a/src/plugins/lua/rbl.lua +++ b/src/plugins/lua/rbl.lua @@ -425,6 +425,29 @@ local function gen_rbl_callback(rule) return true end + local function check_urls(task, requests_table) + local ex_params = { + task = task, + limit = rule.requests_limit, + ignore_redirected = true, + ignore_ip = rule.no_ip, + need_emails = false, + esld_limit = 1, + prefix = 'rbl_url' + } + + local urls = lua_util.extract_specific_urls(ex_params) + if not urls or #urls == 0 then + return false + end + + for _,u in ipairs(urls) do + add_dns_request(task, u:get_tld(), false, false, requests_table) + end + + return true + end + local function check_from(task, requests_table) local ip = task:get_from_ip() @@ -502,6 +525,10 @@ local function gen_rbl_callback(rule) pipeline[#pipeline + 1] = check_emails end + if rule.urls then + pipeline[#pipeline + 1] = check_urls + end + if rule.from then pipeline[#pipeline + 1] = check_from end @@ -766,6 +793,7 @@ local default_options = { ['default_is_whitelist'] = false, ['default_ignore_whitelist'] = false, ['default_resolve_ip'] = false, + ['default_no_ip'] = false, } opts = lua_util.override_defaults(default_options, opts) -- 2.39.5