Added entropy check and informative message. Fixes #121
This commit is contained in:
parent
d7044051df
commit
dc89655df7
|
|
@ -10,6 +10,29 @@ ssl_cert='/etc/ssl/certs/certificate.crt'
|
||||||
|
|
||||||
export GNUPGHOME="/home/www-data/.gnupg"
|
export GNUPGHOME="/home/www-data/.gnupg"
|
||||||
|
|
||||||
|
entropy_check() {
|
||||||
|
local entropy_avail
|
||||||
|
|
||||||
|
entropy_avail=$(cat /proc/sys/kernel/random/entropy_avail)
|
||||||
|
|
||||||
|
if [ "$entropy_avail" -lt 2000 ]; then
|
||||||
|
|
||||||
|
cat <<EOF
|
||||||
|
==================================================================================
|
||||||
|
Your entropy pool is low. This situation could lead GnuPG to not
|
||||||
|
be able to create the gpg serverkey so the container start process will hang
|
||||||
|
until enough entropy is obtained.
|
||||||
|
Please consider installing rng-tools and/or virtio-rng on your host as the
|
||||||
|
preferred method to generate random numbers using a TRNG.
|
||||||
|
If rngd (rng-tools) does not provide enough or fast enough randomness you could
|
||||||
|
consider installing haveged as a helper to speed up this process.
|
||||||
|
Using haveged as a replacement for rngd is not recommended. You can read more
|
||||||
|
about this topic here: https://lwn.net/Articles/525459/
|
||||||
|
==================================================================================
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
gpg_gen_key() {
|
gpg_gen_key() {
|
||||||
key_email="${PASSBOLT_KEY_EMAIL:-passbolt@yourdomain.com}"
|
key_email="${PASSBOLT_KEY_EMAIL:-passbolt@yourdomain.com}"
|
||||||
key_name="${PASSBOLT_KEY_NAME:-Passbolt default user}"
|
key_name="${PASSBOLT_KEY_NAME:-Passbolt default user}"
|
||||||
|
|
@ -17,6 +40,8 @@ gpg_gen_key() {
|
||||||
subkey_length="${PASSBOLT_SUBKEY_LENGTH:-2048}"
|
subkey_length="${PASSBOLT_SUBKEY_LENGTH:-2048}"
|
||||||
expiration="${PASSBOLT_KEY_EXPIRATION:-0}"
|
expiration="${PASSBOLT_KEY_EXPIRATION:-0}"
|
||||||
|
|
||||||
|
entropy_check
|
||||||
|
|
||||||
su -c "gpg --batch --no-tty --gen-key <<EOF
|
su -c "gpg --batch --no-tty --gen-key <<EOF
|
||||||
Key-Type: default
|
Key-Type: default
|
||||||
Key-Length: $key_length
|
Key-Length: $key_length
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue