From 37a6155262bc134ba8a78c57f383ae751875ef97 Mon Sep 17 00:00:00 2001 From: UKnowTEd <138619650+UKnowTEd@users.noreply.github.com> Date: Sat, 16 Dec 2023 16:10:35 +0100 Subject: [PATCH] Update cli.py (#450) Insert new config parameter "apiKey" to authenticate via API to Elasticsearch. --- parsedmarc/cli.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/parsedmarc/cli.py b/parsedmarc/cli.py index c76a2d7..445b3e4 100644 --- a/parsedmarc/cli.py +++ b/parsedmarc/cli.py @@ -306,6 +306,7 @@ def _main(): elasticsearch_monthly_indexes=False, elasticsearch_username=None, elasticsearch_password=None, + elasticsearch_apiKey=None, kafka_hosts=None, kafka_username=None, kafka_password=None, @@ -595,6 +596,9 @@ def _main(): if "password" in elasticsearch_config: opts.elasticsearch_password = elasticsearch_config[ "password"] + if "apiKey" in elasticsearch_config: + opts.elasticsearch_apiKey = elasticsearch_config[ + "apiKey"] if "splunk_hec" in config.sections(): hec_config = config["splunk_hec"] if "url" in hec_config: @@ -817,6 +821,7 @@ def _main(): opts.elasticsearch_ssl_cert_path, opts.elasticsearch_username, opts.elasticsearch_password, + opts.elasticsearch_apiKey, timeout=opts.elasticsearch_timeout) elastic.migrate_indexes(aggregate_indexes=[es_aggregate_index], forensic_indexes=[es_forensic_index])