SIEMbitwardendnscrypthome assistantjellyfinjitsimulti-factor authenticationnextcloudonlyofficepiholeraspberry pirocket.chatsyncthingtorwazuhwireguard
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
1.1 KiB
21 lines
1.1 KiB
|
5 years ago
|
#!/bin/bash
|
||
|
|
|
||
|
5 years ago
|
if [[ -f "/opt/mistborn_volumes/extra/guacamole/init/initdb.sql" ]]; then
|
||
|
|
echo "initdb.sql exists. Proceeding."
|
||
|
|
exit 0
|
||
|
|
fi
|
||
|
|
|
||
|
5 years ago
|
mkdir -p /opt/mistborn_volumes/extra/guacamole/init/ >/dev/null 2>&1
|
||
|
|
chmod -R +x /opt/mistborn_volumes/extra/guacamole/init/
|
||
|
|
docker run --rm guacamole/guacamole /opt/guacamole/bin/initdb.sh --postgres > /opt/mistborn_volumes/extra/guacamole/init/initdb.sql
|
||
|
|
|
||
|
|
# grab values in initdb.sql to replace
|
||
|
|
HEXSTRINGS=($(egrep -o [0-9a-fA-F]{64} /opt/mistborn_volumes/extra/guacamole/init/initdb.sql))
|
||
|
|
|
||
|
|
# reset default password in init.db
|
||
|
|
SALT=$(python3 -c "import secrets; import string; print(f''.join([secrets.choice('0123456789ABCDEF') for x in range(64)]))")
|
||
|
|
GUAC_PASSWORD_HASHED=$(echo -n "${MISTBORN_DEFAULT_PASSWORD}${SALT}" | sha256sum | awk '{print $1}' | tr a-z A-Z)
|
||
|
|
|
||
|
|
sed -i "s/${HEXSTRINGS[1]}/$SALT/" /opt/mistborn_volumes/extra/guacamole/init/initdb.sql
|
||
|
|
sed -i "s/${HEXSTRINGS[0]}/$GUAC_PASSWORD_HASHED/" /opt/mistborn_volumes/extra/guacamole/init/initdb.sql
|
||
|
|
sed -i "s/guacadmin/mistborn/g" /opt/mistborn_volumes/extra/guacamole/init/initdb.sql
|