From: Klaus Umbach Date: Mon, 19 Mar 2018 18:25:27 +0000 (+0100) Subject: implemented subject privacy in the webUI X-Git-Tag: 1.7.1~2^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e2cc1cae630617928683cef73f6e61101ae65354;p=thirdparty%2Frspamd.git implemented subject privacy in the webUI --- diff --git a/src/plugins/lua/history_redis.lua b/src/plugins/lua/history_redis.lua index c8f2b6ee64..af0511b916 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