summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-08-25 09:46:40 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-08-25 09:46:40 +0100
commitd7d8e467a0c07aad3434d437ece3b88429efd885 (patch)
treee001ee5e64ffa622c12596e03d6ab292eefaf5c3
parent42704e45f72359b88ca4d66dfc6dc45e2adc6fc3 (diff)
downloadrspamd-d7d8e467a0c07aad3434d437ece3b88429efd885.tar.gz
rspamd-d7d8e467a0c07aad3434d437ece3b88429efd885.zip
[Feature] Rbl: Add ability to check urls
-rw-r--r--src/plugins/lua/rbl.lua28
1 files changed, 28 insertions, 0 deletions
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)