diff options
author | Gauthier C <gc@ac-lille.fr> | 2019-04-10 14:52:18 +0200 |
---|---|---|
committer | Gauthier C <gc@ac-lille.fr> | 2019-04-10 14:52:18 +0200 |
commit | 9837b17b32ba8a720a4e28981be98aa7830ff001 (patch) | |
tree | 78633db693ef9545f3b07dc1f0414a3722b0a42e /src/plugins/lua/elastic.lua | |
parent | 9c0501a71445c93c82c38cbf10db601eff598049 (diff) | |
download | rspamd-9837b17b32ba8a720a4e28981be98aa7830ff001.tar.gz rspamd-9837b17b32ba8a720a4e28981be98aa7830ff001.zip |
add support ES>=6.7 for elasctic module
Since version 6.7.0 of ElasticSearch, the ingest-geoip plugin is
a module integrated into the solution.
Instead of detecting the version of ElasticSearch I added the
configuration parameter ingest_module which is false by default for
ElasticSearch versions < 6.7.0 and true for versions >= 6.7.0
Diffstat (limited to 'src/plugins/lua/elastic.lua')
-rw-r--r-- | src/plugins/lua/elastic.lua | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/plugins/lua/elastic.lua b/src/plugins/lua/elastic.lua index 03462f9eb..18cc0ea09 100644 --- a/src/plugins/lua/elastic.lua +++ b/src/plugins/lua/elastic.lua @@ -53,6 +53,7 @@ local settings = { password = nil, no_ssl_verify = false, max_fail = 3, + ingest_module = false, } local function read_file(path) @@ -234,8 +235,7 @@ local opts = rspamd_config:get_all_opt('elastic') local function check_elastic_server(cfg, ev_base, _) local upstream = settings.upstream:get_upstream_round_robin() local ip_addr = upstream:get_addr():to_string(true) - - local plugins_url = connect_prefix .. ip_addr .. '/_nodes/plugins' + local plugins_url = connect_prefix .. ip_addr .. '/_nodes/' .. ingest_geoip_type local function http_callback(err, code, body, _) if code == 200 then local parser = ucl.parser() @@ -446,6 +446,12 @@ if redis_params and opts then connect_prefix = 'https://' end + if settings.ingest_module then + ingest_geoip_type = 'modules' + else + ingest_geoip_type = 'plugins' + end + settings.upstream = upstream_list.create(rspamd_config, settings['server'] or settings['servers'], 9200) |