Skip to content

Commit

Permalink
#1248 Generate thehive secret in post-install script
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Mar 10, 2020
1 parent b879920 commit 1bba184
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 7 additions & 0 deletions package/rpm/post
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
# Chown definitions created by SBT Native Packager

# Generate secret key
if ! test -e /etc/thehive/secret.conf; then
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

chown root:thehive /etc/thehive/application.conf /etc/thehive/logback.xml /etc/thehive/secret.conf
chmod 0640 /etc/thehive/application.conf /etc/thehive/logback.xml /etc/thehive/secret.conf
if test -x /bin/systemctl; then
Expand Down
6 changes: 0 additions & 6 deletions package/rpm/pre
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,6 @@ deleteGroup() {
addGroup thehive ""
addUser thehive "" thehive "thehive user-daemon" "/bin/false"

# Generate secret key
if ! test -e /etc/thehive/secret.conf; then
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

if [ -e /etc/sysconfig/thehive ] ;
then
sed -i 's/PACKAGE_PREFIX\=.*//g' /etc/sysconfig/thehive4
Expand Down

0 comments on commit 1bba184

Please sign in to comment.