commit d7d8e46: [Feature] Rbl: Add ability to check urls
Vsevolod Stakhov
vsevolod at highsecure.ru
Sun Aug 25 08:49:07 UTC 2019
Author: Vsevolod Stakhov
Date: 2019-08-25 09:46:40 +0100
URL: https://github.com/rspamd/rspamd/commit/d7d8e467a0c07aad3434d437ece3b88429efd885 (HEAD -> master)
[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)
More information about the Commits
mailing list