Skip to content

Commit

Permalink
ITC-1720 V3 Generate random API Key for WebSocket connections
Browse files Browse the repository at this point in the history
  • Loading branch information
nook24 committed Feb 26, 2020
1 parent 73b5b34 commit 581cc90
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app/SETUP.sh
@@ -1,7 +1,16 @@
#!/bin/bash

INIFILE=/etc/openitcockpit/mysql.cnf

ln -s /etc/openitcockpit/nagios.cfg /opt/openitc/nagios/etc/nagios.cfg
sudo -g www-data /usr/share/openitcockpit/app/Console/cake schema update -y --connection default --file schema_itcockpit.php -s 26
#sudo -g www-data /usr/share/openitcockpit/app/Console/cake schema update --plugin NagiosModule --file ndo.php --connection default

echo "---------------------------------------------------------------"
echo "Create new WebSocket Key"
WEBSOCKET_KEY=$(php -r "echo bin2hex(openssl_random_pseudo_bytes(80, \$cstrong));")
mysql "--defaults-extra-file=${INIFILE}" -e "UPDATE systemsettings SET \`systemsettings\`.\`value\`='${WEBSOCKET_KEY}' WHERE \`key\`='SUDO_SERVER.API_KEY';"

oitc AclExtras.AclExtras aco_sync
oitc compress
oitc nagios_export --all
Expand All @@ -10,6 +19,7 @@ CODENAME=$(lsb_release -sc)
if [ $CODENAME = "jessie" ] || [ $CODENAME = "xenial" ] || [ $CODENAME = "bionic" ] || [ $CODENAME = "stretch" ]; then
systemctl restart nagios
systemctl restart sudo_server
systemctl restart push_notification
fi

if [ $CODENAME = "trusty" ]; then
Expand Down

0 comments on commit 581cc90

Please sign in to comment.