From 9837b17b32ba8a720a4e28981be98aa7830ff001 Mon Sep 17 00:00:00 2001 From: Gauthier C Date: Wed, 10 Apr 2019 14:52:18 +0200 Subject: [PATCH] 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 --- src/plugins/lua/elastic.lua | 10 ++++++++-- 1 file 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) -- 2.39.5