summaryrefslogtreecommitdiffstats
path: root/src/plugins/lua/history_redis.lua
diff options
context:
space:
mode:
authorKlaus Umbach <klaus-github@uxix.de>2018-03-19 19:25:27 +0100
committerKlaus Umbach <klaus-github@uxix.de>2018-03-19 19:27:39 +0100
commite2cc1cae630617928683cef73f6e61101ae65354 (patch)
treeb6a6fa30ef053da9fbf2254dbdefdfc9bea03029 /src/plugins/lua/history_redis.lua
parente5c77aed5ebc2dc096709a29ff9b10bfad326912 (diff)
downloadrspamd-e2cc1cae630617928683cef73f6e61101ae65354.tar.gz
rspamd-e2cc1cae630617928683cef73f6e61101ae65354.zip
implemented subject privacy in the webUI
Diffstat (limited to 'src/plugins/lua/history_redis.lua')
-rw-r--r--src/plugins/lua/history_redis.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/plugins/lua/history_redis.lua b/src/plugins/lua/history_redis.lua
index c8f2b6ee6..af0511b91 100644
--- a/src/plugins/lua/history_redis.lua
+++ b/src/plugins/lua/history_redis.lua
@@ -19,11 +19,14 @@ if confighelp then
end
local redis_params
+local hash = require 'rspamd_cryptobox_hash'
local settings = {
key_prefix = 'rs_history', -- default key name
nrows = 200, -- default rows limit
compress = true, -- use zstd compression when storing data in redis
+ subject_privacy = false, -- subject privacy is off
+ subject_privacy_alg = 'md5', -- default hash-algorithm to obfuscate subject
}
local rspamd_logger = require "rspamd_logger"
@@ -195,6 +198,10 @@ local function handle_history_request(task, conn, from, to, reset)
fun.each(function(e)
if e.subject and not rspamd_util.is_valid_utf8(e.subject) then
e.subject = '???'
+ elseif settings.subject_privacy then
+ local hash_alg = settings.subject_privacy_alg
+ local subject_hash = hash.create_specific(hash_alg, e.subject)
+ e.subject = hash_alg..':'..subject_hash:hex()
end
end, data)
reply.rows = data