-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgenerate_passwords.sh
More file actions
executable file
·42 lines (37 loc) · 1.4 KB
/
Copy pathgenerate_passwords.sh
File metadata and controls
executable file
·42 lines (37 loc) · 1.4 KB
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
35
36
37
38
39
40
41
42
#!/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"
)
for file in ${pass_files[@]}
do
# only generate passwords if the files do not exist
if [ ! -f $file ]; then
mkdir -p $(dirname $file)
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)
"
# if URL is localtest.me, generate certificates using mkcert
DOMAIN=$(cat .env | grep URL | cut -d '=' -f2)
if [ "$DOMAIN" == "localtest.me" ]; then
# Check if mkcert is installed
if ! command -v mkcert &> /dev/null; then
echo "mkcert could not be found. Please install it and run this script again."
exit 1
fi
mkcert -install
mkcert -cert-file cert.pem -key-file key.pem "$DOMAIN" "*.$DOMAIN" "127.0.0.1" "::1"
fi