Minor cleanup of Unique random serial number control

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
This commit is contained in:
Richard T Bonhomme 2023-07-14 21:43:29 +01:00
parent 3789aff3f5
commit 8cdfbb2ffe
No known key found for this signature in database
GPG Key ID: 2D767DB92FB6C246

View File

@ -2424,6 +2424,7 @@ $check_serial"
# for use by SSL config # for use by SSL config
print "$serial" > "$EASYRSA_PKI/serial" || \ print "$serial" > "$EASYRSA_PKI/serial" || \
die "sign_req - write serial to file" die "sign_req - write serial to file"
unset -v serial check_serial serial_is_unique
fi fi
# When EASYRSA_CP_EXT is defined, # When EASYRSA_CP_EXT is defined,
@ -2457,12 +2458,12 @@ to the latest Easy-RSA release."
print "$copy_exts" | \ print "$copy_exts" | \
awk "$awkscript" "$EASYRSA_SSL_CONF" \ awk "$awkscript" "$EASYRSA_SSL_CONF" \
> "$conf_tmp" \ > "$conf_tmp" || die "\
|| die "Writing SSL config to temp file failed" Writing 'copy_exts' to SSL config temp-file failed"
# Use this SSL config for the rest of this function # Use this SSL config for the rest of this function
EASYRSA_SSL_CONF="$conf_tmp" EASYRSA_SSL_CONF="$conf_tmp"
verbose "sign_req: copy_extensions = copy" verbose "sign_req: Using '$copy_exts'"
fi fi
# Find or create x509-type file # Find or create x509-type file
@ -2665,6 +2666,7 @@ check_serial_unique() {
# Check for openssl -status of serial number # Check for openssl -status of serial number
# Always errors out - Do not capture error # Always errors out - Do not capture error
# unset EASYRSA_SILENT_SSL to capure all output # unset EASYRSA_SILENT_SSL to capure all output
# Do NOT unset check_serial for sign-req error msg
check_serial="$( check_serial="$(
unset -v EASYRSA_SILENT_SSL unset -v EASYRSA_SILENT_SSL
easyrsa_openssl ca -status "$1" 2>&1 easyrsa_openssl ca -status "$1" 2>&1
@ -2685,8 +2687,10 @@ check_serial_unique() {
if [ "$internal_batch" ] || [ "$EASYRSA_BATCH" ] if [ "$internal_batch" ] || [ "$EASYRSA_BATCH" ]
then then
if [ "$unique_serial_true" ]; then if [ "$unique_serial_true" ]; then
unset -v unique_serial_true internal_batch
return 0 return 0
else else
unset -v unique_serial_true internal_batch
return 1 return 1
fi fi
fi fi