]> source.dussan.org Git - rspamd.git/commitdiff
[Feature] Allow to query hashed emails
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 6 Apr 2017 17:07:36 +0000 (18:07 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 6 Apr 2017 17:10:02 +0000 (18:10 +0100)
src/plugins/lua/emails.lua

index 25e9ff88c3dfd1ba8a2b14e697a3e4bcf883985d..2c20622cab0d5af873e09f04eaafa4654732e219 100644 (file)
@@ -21,6 +21,7 @@ limitations under the License.
 -- symbol = sym2, dnsbl = bl.somehost.com, domain_only = no
 local rules = {}
 local logger = require "rspamd_logger"
+local hash = require "rspamd_cryptobox_hash"
 
 -- Check rule for a single email
 local function check_email_rule(task, rule, addr)
@@ -41,6 +42,10 @@ local function check_email_rule(task, rule, addr)
       to_resolve = string.format('%s.%s.%s', addr:get_user(), addr:get_host(), rule['dnsbl'])
     end
 
+    if rule['hash'] then
+      to_resolve = hash.create_specific(rule['hash'], to_resolve):hex()
+    end
+
     task:get_resolver():resolve_a({
       task=task,
       name = to_resolve,