summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-06-22 08:39:52 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-06-22 08:39:52 +0100
commit445b414b0a1a6074fe63497038b415c7f28ff46b (patch)
treeefa651969f55a576f9bcc6ad3c9f1f9db3e705c4 /src
parenta6fb96a19b357ddf83c0b94eeefdcabe3aca6332 (diff)
downloadrspamd-445b414b0a1a6074fe63497038b415c7f28ff46b.tar.gz
rspamd-445b414b0a1a6074fe63497038b415c7f28ff46b.zip
[Feature] Allow to use HTTPS when connecting to Clickhouse
Diffstat (limited to 'src')
-rw-r--r--src/plugins/lua/clickhouse.lua18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/plugins/lua/clickhouse.lua b/src/plugins/lua/clickhouse.lua
index dc6d7be66..2acf94580 100644
--- a/src/plugins/lua/clickhouse.lua
+++ b/src/plugins/lua/clickhouse.lua
@@ -30,6 +30,7 @@ local specific_rows = {}
local asn_rows = {}
local symbols_rows = {}
local nrows = 0
+local connect_prefix = 'http://'
local settings = {
limit = 1000,
@@ -52,6 +53,7 @@ local settings = {
full_urls = false,
from_tables = nil,
enable_symbols = false,
+ use_https = false,
}
--[[
@@ -248,7 +250,7 @@ local function clickhouse_send_data(task)
local body = table.concat(rows, ' ')
if not rspamd_http.request({
task = task,
- url = 'http://' .. settings['server'],
+ url = connect_prefix .. settings['server'],
body = body,
callback = http_cb,
mime_type = 'text/plain',
@@ -262,7 +264,7 @@ local function clickhouse_send_data(task)
body = table.concat(attachment_rows, ' ')
if not rspamd_http.request({
task = task,
- url = 'http://' .. settings['server'],
+ url = connect_prefix .. settings['server'],
body = body,
callback = http_cb,
mime_type = 'text/plain',
@@ -276,7 +278,7 @@ local function clickhouse_send_data(task)
body = table.concat(urls_rows, ' ')
if not rspamd_http.request({
task = task,
- url = 'http://' .. settings['server'],
+ url = connect_prefix .. settings['server'],
body = body,
callback = http_cb,
mime_type = 'text/plain',
@@ -290,7 +292,7 @@ local function clickhouse_send_data(task)
body = table.concat(asn_rows, ' ')
if not rspamd_http.request({
task = task,
- url = 'http://' .. settings['server'],
+ url = connect_prefix .. settings['server'],
body = body,
callback = http_cb,
mime_type = 'text/plain',
@@ -305,7 +307,7 @@ local function clickhouse_send_data(task)
body = table.concat(symbols_rows, ' ')
if not rspamd_http.request({
task = task,
- url = 'http://' .. settings['server'],
+ url = connect_prefix .. settings['server'],
body = body,
callback = http_cb,
mime_type = 'text/plain',
@@ -321,7 +323,7 @@ local function clickhouse_send_data(task)
body = table.concat(specific, ' ')
if not rspamd_http.request({
task = task,
- url = 'http://' .. settings['server'],
+ url = connect_prefix .. settings['server'],
body = body,
callback = http_cb,
mime_type = 'text/plain',
@@ -636,6 +638,10 @@ if opts then
else
settings['from_map'] = rspamd_map_add('clickhouse', 'from_tables',
'regexp', 'clickhouse specific domains')
+ if settings.use_https then
+ connect_prefix = 'https://'
+ end
+
clickhouse_first_row()
rspamd_config:register_symbol({
name = 'CLICKHOUSE_COLLECT',