Check for dh.pem before overwriting
gen-dh would overwrite dh.pem without warning In batch mode, easyrsa now exits 1 if dh.pem exists. In interactive move, the user is prompted if dh.pem exists. Fixes #373 Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
This commit is contained in:
parent
3e93f925d3
commit
0fdd390c11
@ -711,6 +711,18 @@ gen_dh() {
|
||||
verify_pki_init
|
||||
|
||||
out_file="$EASYRSA_PKI/dh.pem"
|
||||
|
||||
# check to see if we already have a dh parameters file
|
||||
if [ -e "$EASYRSA_PKI/dh.pem" ]; then
|
||||
if [ "$EASYRSA_BATCH" = "1" ]; then
|
||||
# if batch is enabled, die
|
||||
die "file $EASYRSA_PKI/dh.pem already exists!"
|
||||
else
|
||||
# warn the user, give them a chance to force overwrite
|
||||
confirm "Overwrite? " "yes" "*** File $EASYRSA_PKI/dh.pem already exists! ***"
|
||||
fi
|
||||
fi
|
||||
|
||||
"$EASYRSA_OPENSSL" dhparam -out "$out_file" "$EASYRSA_KEY_SIZE" || \
|
||||
die "Failed to build DH params"
|
||||
notice "\
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user