Skip to content

Commit

Permalink
#1238 Prevent lock when secret key is generated
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Feb 4, 2021
1 parent 6fdb064 commit bb8ede9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package/debian/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ case "$1" in
addUser thehive "" thehive "thehive daemon-user" "/bin/false"
# Generate secret key
if ! test -e /etc/thehive/secret.conf; then
key=$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 64 | head -n 1)
key=$(dd if=/dev/urandom bs=1024 count=1 | tr -dc 'a-zA-Z0-9' | fold -w 64 | head -n 1)
echo "play.http.secret.key=\"$key\"" > /etc/thehive/secret.conf
fi

Expand All @@ -99,4 +99,4 @@ case "$1" in
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
esac
2 changes: 1 addition & 1 deletion package/docker/entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ then
then
if test -z "${SECRET}"
then
SECRET=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 64 | head -n 1)
SECRET=$(dd if=/dev/urandom bs=1024 count=1 | tr -dc 'a-zA-Z0-9' | fold -w 64 | head -n 1)
test "${SHOW_SECRET}" = 1 && echo Using secret: ${SECRET}
fi
echo "play.http.secret.key = \"${SECRET}\"" >> ${CONFIG_FILE}
Expand Down

0 comments on commit bb8ede9

Please sign in to comment.