-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
0.0.4 move secret generation to the scripts
- Loading branch information
Showing
7 changed files
with
159 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,30 +18,30 @@ TRAEFIK_ENTRYPOINT=YourHttpsEntryPoint | |
TRAEFIK_EMAIL=[email protected] | ||
|
||
### Authelia | ||
AUTHELIA_RESET_PASSWORD_SECRET=super-secret-password | ||
AUTHELIA_SESSION_REDIS_PASSWORD=redis-password | ||
AUTHELIA_SESSION_SECRET=super-secret-session | ||
AUTHELIA_RESET_PASSWORD_SECRET=!SECRET | ||
AUTHELIA_SESSION_REDIS_PASSWORD=!SECRET | ||
AUTHELIA_SESSION_SECRET=!SECRET | ||
|
||
### Authelia authentication backend (FreeIPA) | ||
LLDAP_JWT_SECRET=super-secret-jwt | ||
LLDAP_KEY_SEED=super-secret-seed | ||
### Authelia authentication backend (LLDAP) | ||
LLDAP_JWT_SECRET=!SECRET | ||
LLDAP_KEY_SEED=!SECRET | ||
LLDAP_USERNAME=authelia | ||
LLDAP_PASSWORD=secret-password | ||
LLDAP_PASSWORD=!SECRET | ||
|
||
### Authelia storage (postgres) | ||
POSTGRES_PASSWORD=super-secret-password | ||
POSTGRES_ENCRYPTION_KEY=super-secret-encryption-key | ||
POSTGRES_PASSWORD=!SECRET | ||
POSTGRES_ENCRYPTION_KEY=!SECRET | ||
|
||
### OIDC | ||
OIDC_HMAC_SECRET=super-secret-hmac | ||
OIDC_CLIENT_ID=your-client-id | ||
OIDC_HMAC_SECRET=!SECRET | ||
OIDC_CLIENT_ID=!SECRET | ||
OIDC_CLIENT_NAME=your-client-name | ||
|
||
### Database | ||
DB_ROOT_USERNAME=root | ||
DB_ROOT_PASSWORD=root-password | ||
DB_ROOT_PASSWORD=!SECRET | ||
DB_USERNAME=db-username | ||
DB_PASSWORD=db-password | ||
DB_PASSWORD=!SECRET | ||
|
||
## SMTP | ||
SMTP_USERNAME=user | ||
|
@@ -50,4 +50,4 @@ SMTP_HOST=smtp://smtp.gmail.com:587 | |
SMTP_SENDER=[email protected] | ||
SMTP_DISABLE_REQUIRE_TLS=false | ||
SMTP_DISABLE_STARTTLS=false | ||
SMTP_SKIP_TLS_VERIFY=false | ||
SMTP_SKIP_TLS_VERIFY=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
if [ "$#" -ne 1 ]; then | ||
echo "Usage: $0 <Destination file>" | ||
exit 1 | ||
fi | ||
|
||
DESTINATION_FILE="$1" | ||
|
||
# RSA-Schlüssel generieren und in Datei speichern | ||
openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:4096 2>/dev/null > "$DESTINATION_FILE" | ||
|
||
echo "Private key successfully written to $DESTINATION_FILE" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/bash | ||
|
||
# generates secrets for each "SECRET" string in the given .env file | ||
# Syntax has to be: VARNAME=SECRET | ||
# Requirement: openssl | ||
# Fehlerbehandlung: Beendet das Skript, wenn ein Befehl fehlschlägt | ||
|
||
set -e | ||
|
||
# Überprüfen, ob genügend Argumente übergeben wurden | ||
if [ "$#" -ne 1 ]; then | ||
echo "Usage: $0 <ENV_FILE>" | ||
exit 1 | ||
fi | ||
|
||
# Dateien | ||
ENV_FILE="$1" | ||
LINE_NUMBER=0 | ||
|
||
while IFS= read -r line; do | ||
LINE_NUMBER=$((LINE_NUMBER+1)) | ||
if [[ "$line" =~ ^[A-Z_]+=[^\"]+ ]]; then | ||
VAR_NAME=$(echo "$line" | cut -d'=' -f1) | ||
ENV_FILE_VAR_VALUE=$(echo "$line" | cut -d'=' -f2-) | ||
|
||
if [ "$ENV_FILE_VAR_VALUE" == "!SECRET" ]; then | ||
SECRET=$(openssl rand -base64 48 | tr -dc 'a-zA-Z0-9' | head -c 64) | ||
VAR_VALUE="${!VAR_NAME}" | ||
sed -i "${LINE_NUMBER}s/!SECRET/${SECRET}/" $ENV_FILE | ||
fi | ||
fi | ||
done < "$ENV_FILE" | ||
|
||
echo "Secrets wurden in die Datei $ENV_FILE geschrieben." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters