Skip to content

Commit 7ae7673

Browse files
committed
use python3 for FERNETKEY validation
1 parent 61ada0b commit 7ae7673

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

root/etc/cont-init.d/30-config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ if grep -q 'REPLACEWITHFERNETKEY' /app/ldap-backend-app.py; then
55
if [ -z "${FERNETKEY}" ]; then
66
KEY=$(python3 /app/fernet-key.py)
77
echo "generated fernet key"
8-
elif [ $(openssl base64 -d <<< "${FERNETKEY}" | wc -c) != "32" ]; then
8+
elif ! python3 -c "from cryptography.fernet import Fernet; Fernet(b'${FERNETKEY}').encrypt(b\"my deep dark secret\")" 2>/dev/null; then
99
echo "FERNETKEY env var is not set to a base64 encoded 32-byte key"
1010
KEY=$(python3 /app/fernet-key.py)
1111
echo "generated fernet key"

0 commit comments

Comments
 (0)