diff options
author | Anton Yuzhaninov <citrin+github@citrin.ru> | 2019-06-26 17:02:45 +0100 |
---|---|---|
committer | Anton Yuzhaninov <citrin+github@citrin.ru> | 2019-06-26 19:21:58 +0100 |
commit | b1182d67944ad8b9165c688d7b6998bfb50485ca (patch) | |
tree | 54b67616a3b9fa5ad6edaa0770f25ef523d60dc2 /src | |
parent | cddb4c7f18869c5a99cd0634c4dcea2e31b0940d (diff) | |
download | rspamd-b1182d67944ad8b9165c688d7b6998bfb50485ca.tar.gz rspamd-b1182d67944ad8b9165c688d7b6998bfb50485ca.zip |
[Minor] Log SMTP HELO/.EHLO to ClickHouse
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/lua/clickhouse.lua | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/plugins/lua/clickhouse.lua b/src/plugins/lua/clickhouse.lua index f62bda2c6..b4c5d5567 100644 --- a/src/plugins/lua/clickhouse.lua +++ b/src/plugins/lua/clickhouse.lua @@ -95,6 +95,7 @@ CREATE TABLE rspamd From String COMMENT 'Domain part of the return address (RFC5321.MailFrom)', MimeFrom String COMMENT 'Domain part of the address in From: header (RFC5322.From)', IP String COMMENT 'SMTP client IP as provided by MTA or from Received: header', + Helo String COMMENT 'Full hostname as sent by the SMTP client (RFC5321.HELO/.EHLO)', Score Float32 COMMENT 'Message score', NRcpt UInt8 COMMENT 'Number of envelope recipients (RFC5321.RcptTo)', Size UInt32 COMMENT 'Message size in bytes', @@ -210,6 +211,14 @@ local migrations = { -- New version [[INSERT INTO rspamd_version (Version) Values (6)]], }, + [6] = { + -- Add new columns + [[ALTER TABLE rspamd + ADD COLUMN Helo String AFTER IP + ]], + -- New version + [[INSERT INTO rspamd_version (Version) Values (7)]], + }, } local predefined_actions = { @@ -228,6 +237,7 @@ local function clickhouse_main_row(res) 'From', 'MimeFrom', 'IP', + 'Helo', 'Score', 'NRcpt', 'Size', @@ -429,16 +439,6 @@ local function clickhouse_collect(task) from_domain = from['domain']:lower() from_user = from['user'] end - - if from_domain == '' then - if task:get_helo() then - from_domain = task:get_helo() - end - end - else - if task:get_helo() then - from_domain = task:get_helo() - end end local mime_domain = '' @@ -471,6 +471,8 @@ local function clickhouse_collect(task) ip_str = ipnet:to_string() end + local helo = task:get_helo() or '' + local rcpt_user = '' local rcpt_domain = '' if task:has_recipients('smtp') then @@ -637,6 +639,7 @@ local function clickhouse_collect(task) from_domain, mime_domain, ip_str, + helo, score, nrcpts, task:get_size(), |