Skip to content

Commit

Permalink
add to entrypoint support for Elasticsearch authn
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredjennings committed May 11, 2021
1 parent d8ecae8 commit 8981d97
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions package/docker/entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ test "${no_config_es:-0}" == 1
CONFIG_ES=$?
ES_URI=${es_uri:-}
ES_HOSTNAME=${es_hostname:-elasticsearch}
ES_USERNAME=${es_username:-}
ES_PASSWORD=${es_password:-}
CONFIG_FILE=${config_file:-/etc/cortex/application.conf}
DEFAULT_ANALYZER_URL="https://download.thehive-project.org/analyzers.json"
ANALYZER_URLS=()
Expand All @@ -32,6 +34,8 @@ function usage {
--es-uri <uri> | use this string to configure elasticsearch hosts (format: http(s)://host:port,host:port(/prefix)?querystring)
--es-trust-ca-cert <file.pem>| trust a CA for outbound Elasticsearch TLS connections (can use multiple times)
--es-hostname <host> | resolve this hostname to find elasticsearch instances
--es-username <name> | username for Elasticsearch authentication
--es-password <pass> | password for Elasticsearch authentication
--secret <secret> | secret to secure sessions
--show-secret | show the generated secret
--job-directory <dir> | use this directory to store job files
Expand All @@ -56,6 +60,8 @@ do
"--es-uri") shift; ES_URI=$1;;
"--es-trust-ca-cert") shift; ES_TRUSTED_CA_CERT_FILES+=($1);;
"--es-hostname") shift; ES_HOSTNAME=$1;;
"--es-username") shift; ES_USERNAME=$1;;
"--es-password") shift; ES_PASSWORD=$1;;
"--secret") shift; SECRET=$1;;
"--show-secret") SHOW_SECRET=1;;
"--job-directory") shift; JOB_DIRECTORY=$1;;
Expand Down Expand Up @@ -144,6 +150,14 @@ then
echo "search.trustStore.password=\"$ES_TRUST_STORE_PASSWORD\"" >> "$CONFIG_FILE"
fi
fi
if test -n "$ES_USERNAME"
then
echo "search.user=\"$ES_USERNAME\"" >> "$CONFIG_FILE"
fi
if test -n "$ES_PASSWORD"
then
echo "search.password=\"$ES_PASSWORD\"" >> "$CONFIG_FILE"
fi

test -n "$JOB_DIRECTORY" && echo "job.directory=\"$JOB_DIRECTORY\"" >> "$CONFIG_FILE"
test -n "$DOCKER_JOB_DIRECTORY" && echo "job.dockerDirectory=\"$DOCKER_JOB_DIRECTORY\"" >> "$CONFIG_FILE"
Expand Down

0 comments on commit 8981d97

Please sign in to comment.