summaryrefslogtreecommitdiffstats
path: root/src/plugins/lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-04-11 13:23:17 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-04-11 13:23:17 +0100
commit0ecb7087de3c2161b08ee906835e7089171eaff4 (patch)
tree8ab51c8d502fe7dba6eefe29f5f5f71dd59160a4 /src/plugins/lua
parente70b7fcd7fd97c303adf3cf7f5ca785109e0cc99 (diff)
downloadrspamd-0ecb7087de3c2161b08ee906835e7089171eaff4.tar.gz
rspamd-0ecb7087de3c2161b08ee906835e7089171eaff4.zip
[Fix] More fixes for hashed email dnsbls
Diffstat (limited to 'src/plugins/lua')
-rw-r--r--src/plugins/lua/emails.lua13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/plugins/lua/emails.lua b/src/plugins/lua/emails.lua
index 1516eff39..38b06a1be 100644
--- a/src/plugins/lua/emails.lua
+++ b/src/plugins/lua/emails.lua
@@ -22,6 +22,7 @@ limitations under the License.
local rules = {}
local logger = require "rspamd_logger"
local hash = require "rspamd_cryptobox_hash"
+local N = "emails"
-- Check rule for a single email
local function check_email_rule(task, rule, addr)
@@ -39,14 +40,22 @@ local function check_email_rule(task, rule, addr)
if rule['domain_only'] then
to_resolve = addr:get_host()
else
- to_resolve = string.format('%s.%s', addr:get_user(), addr:get_host())
+ if not rule['hash'] then
+ to_resolve = string.format('%s.%s', addr:get_user(), addr:get_host())
+ else
+ to_resolve = string.format('%s@%s', addr:get_user(), addr:get_host())
+ end
end
+ logger.debugm(N, task, "check %s on %s", to_resolve, rule['dnsbl'])
+
if rule['hash'] then
to_resolve = hash.create_specific(rule['hash'], to_resolve):hex()
end
to_resolve = string.format('%s.%s', to_resolve, rule['dnsbl'])
+ logger.debugm(N, task, "query %s", to_resolve)
+
task:get_resolver():resolve_a({
task=task,
name = to_resolve,
@@ -110,6 +119,8 @@ if opts and type(opts) == 'table' then
logger.errx(rspamd_config, 'incomplete rule')
else
table.insert(rules, rule)
+ logger.infox(rspamd_config, 'add emails rule %s',
+ rule['dnsbl'] or rule['name'] or '???')
end
end
end