From 1bba184f730425fbae6e01630589d7533a423c76 Mon Sep 17 00:00:00 2001 From: To-om Date: Tue, 10 Mar 2020 14:42:19 +0100 Subject: [PATCH] #1248 Generate thehive secret in post-install script --- package/rpm/post | 7 +++++++ package/rpm/pre | 6 ------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/package/rpm/post b/package/rpm/post index 82ed29cd93..46e824ed8c 100644 --- a/package/rpm/post +++ b/package/rpm/post @@ -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 diff --git a/package/rpm/pre b/package/rpm/pre index e52c933624..37c43c16ad 100755 --- a/package/rpm/pre +++ b/package/rpm/pre @@ -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