-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate_passwords.sh
executable file
·34 lines (30 loc) · 1.26 KB
/
generate_passwords.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env bash
pass_files=("config/lldap/secrets/LLDAP_JWT_SECRET" \
"config/lldap/secrets/LLDAP_PASSWORD" \
"config/lldap/secrets/LLDAP_STORAGE_PASSWORD" \
"config/authelia/secrets/AUTHELIA_JWT_SECRET" \
"config/authelia/secrets/AUTHELIA_SESSION_SECRET" \
"config/authelia/secrets/AUTHELIA_STORAGE_ENCRYPTION_KEY" \
"config/authelia/secrets/AUTHELIA_STORAGE_PASSWORD" \
"config/casbin/secrets/CASBIN_STORAGE_PASSWORD" \
)
for file in ${pass_files[@]}
do
# only generate passwords if the files do not exist
if [ ! -f $file ]; then
echo Generating $file
docker run authelia/authelia:latest authelia crypto rand --length 64 --charset alphanumeric | awk '{print $3}' > $file
else
echo Skipping $file - it already exists
fi
done
# Echo the lldap password to the console
echo "
LLDAP admin credentials:
User: admin
Pass: $(cat config/lldap/secrets/LLDAP_PASSWORD)
"
# replace $URL in config/authelia/snippets/authelia-authrequest.conf with the URL stored in the .env file
sed "s|\$URL|$(grep URL .env | cut -d '=' -f2)|g" \
config/authelia/snippets/authelia-authrequest.conf.template \
> config/authelia/snippets/authelia-authrequest.conf