Create aeskey.properties if not existing (#3875)

This commit is contained in:
Martin Berger 2023-07-08 15:16:05 +02:00 committed by GitHub
parent c9b6971489
commit fc2979f9da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -313,6 +313,19 @@ WantedBy=multi-user.target
echo "# keystore already exists"
fi
# create aeskey.properties if needed
aeskeyExists=$(sudo ls /home/fints/aeskey.properties 2>/dev/null | grep -c 'aeskey.properties')
if [ ${aeskeyExists} -eq 0 ]; then
echo "# creating aeskey.properties"
sudo -u fints openssl rand -hex 12 > /home/fints/aeskey.secret
sudo -u fints openssl enc -aes-128-cbc -kfile /home/fints/aeskey.secret -P -md sha1 | grep "key=" > /home/fints/aeskey.tmp
sudo sed -i "s/key/aes_key/g" /home/fints/aeskey.tmp
sudo -u fints tr -d '\n' < /home/fints/aeskey.tmp > /home/fints/aeskey.properties
sudo -u fints rm /home/fints/aeskey.tmp
else
echo "# aeskey.properties already exists"
fi
# config app basics: fuelifints.properties
sudo -u fints mkdir /home/fints/config
sudo -u fints cp /home/fints/fints/config/fuelifints.properties /home/fints/config/fuelifints.properties