Skip to content

Commit

Permalink
#244 Hide secret in Docker entrypoint
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Jan 16, 2020
1 parent b8bf206 commit 0165b5d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion package/docker/entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ ANALYZER_URLS=()
RESPONDER_PATH=/opt/Cortex-Analyzers/responders
RESPONDER_URLS=()
START_DOCKER=0
SHOW_SECRET=0

function usage {
cat <<- _EOF_
Expand All @@ -20,6 +21,7 @@ function usage {
--es-uri <uri> | use this string to configure elasticsearch hosts (format: http(s)://host:port,host:port(/prefix)?querystring)
--es-hostname <host> | resolve this hostname to find elasticseach instances
--secret <secret> | secret to secure sessions
--show-secret | show the generated secret
--analyzer-url <url> | where analyzers are located (url or path)
--responder-url <url> | where responders are located (url or path)
--start-docker | start a internal docker (inside container) to run analyzers/responders
Expand All @@ -39,6 +41,7 @@ do
"--es-uri") shift; ES_URI=$1;;
"--es-hostname") shift; ES_HOSTNAME=$1;;
"--secret") shift; SECRET=$1;;
"--show-secret") SHOW_SECRET=1;;
"--analyzer-path") shift; ANALYZER_PATH=$1;;
"--responder-path") shift; RESPONDER_PATH=$1;;
"--analyzer-url") shift; ANALYZER_URLS+=$1;;
Expand All @@ -58,8 +61,8 @@ then
if test -z "$SECRET"
then
SECRET=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 64 | head -n 1)
test $SHOW_SECRET = 1 && echo Using secret: $SECRET
fi
echo Using secret: $SECRET
echo play.http.secret.key=\"$SECRET\" >> $CONFIG_FILE
fi

Expand Down

0 comments on commit 0165b5d

Please sign in to comment.