__netbox: fix gerneration random generated secret key

Because `/dev/random` was used, the `cdist config` could hang a long
time to get real random values. The pseudo-generated values through
`/dev/urandom` are fully enought for the secret key.
This commit is contained in:
matze 2020-09-08 18:10:15 +02:00
parent 3389752dec
commit 398a3da10e

View file

@ -50,10 +50,11 @@ elif [ -s "$__object/explorer/secretkey" ]; then
# take the key that is already used # take the key that is already used
SECRET_KEY="$(cat "$__object/explorer/secretkey")" SECRET_KEY="$(cat "$__object/explorer/secretkey")"
else else
# Can be done over netbox/generate_secret_key.py too, but it's to # Can be done over netbox/generate_secret_key.py too, but it can't be
# complicated with the variable setup (can't generated right now!). # generated right now where it's required (only if it's preloaded for
# this type to execute it now).
# Generates a 50-character long key (without ' cause of python quotes) # Generates a 50-character long key (without ' cause of python quotes)
SECRET_KEY="$(tr -cd '[:graph:]' < /dev/random | tr -d \' | head -c50)" SECRET_KEY="$(tr -cd '[:graph:]' < /dev/urandom | tr -d \' | head -c50)"
fi fi
export SECRET_KEY export SECRET_KEY