forked from ungleich-public/cdist-contrib
__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:
parent
3389752dec
commit
398a3da10e
1 changed files with 4 additions and 3 deletions
|
@ -50,10 +50,11 @@ elif [ -s "$__object/explorer/secretkey" ]; then
|
|||
# take the key that is already used
|
||||
SECRET_KEY="$(cat "$__object/explorer/secretkey")"
|
||||
else
|
||||
# Can be done over netbox/generate_secret_key.py too, but it's to
|
||||
# complicated with the variable setup (can't generated right now!).
|
||||
# Can be done over netbox/generate_secret_key.py too, but it can't be
|
||||
# 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)
|
||||
SECRET_KEY="$(tr -cd '[:graph:]' < /dev/random | tr -d \' | head -c50)"
|
||||
SECRET_KEY="$(tr -cd '[:graph:]' < /dev/urandom | tr -d \' | head -c50)"
|
||||
fi
|
||||
export SECRET_KEY
|
||||
|
||||
|
|
Loading…
Reference in a new issue