Merge branch 'TinCanTech-silence-ssl-with-batch'

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
This commit is contained in:
Richard T Bonhomme 2023-03-14 20:25:51 +00:00
commit 1eaf57b727
No known key found for this signature in database
GPG Key ID: 2D767DB92FB6C246
2 changed files with 37 additions and 7 deletions

View File

@ -1,6 +1,7 @@
Easy-RSA 3 ChangeLog
3.1.3 (ETA: 2023-10-13)
* Introduce option -S|--silent-ssl: Silence SSL output (#913)
* Only create a random serial number file when expected (#896)
* Always verify SSL lib, for all commands (#877)
* Option --fix-offset: Adjust off-by-one day (#847)

View File

@ -464,6 +464,7 @@ General options:
--batch : Set automatic (no-prompts when possible) mode
--silent|-s : Disable all warnings, notices and information
--sbatch : Combined --silent and --batch operating mode
--silent-ssl|-S : Silence SSL output (Requires bach mode)
--no-pass : Do not use passwords
Can not be used with --passin or --passout
@ -775,9 +776,10 @@ export EASYRSA_REQ_SERIAL=\"$EASYRSA_REQ_SERIAL\"
escape_hazard - Failed to write temp-file"
# Reload fields from fully escaped temp-file
# shellcheck disable=SC1090 # can't follow non-constant source.
# shellcheck disable=SC1090 # can't follow ...
(. "$easyrsa_vars_org") || die "\
escape_hazard - Failed to source temp-file"
# shellcheck disable=SC1090 # can't follow ...
. "$easyrsa_vars_org"
} # => escape_hazard()
@ -891,18 +893,36 @@ easyrsa_openssl() {
elif [ "$has_config" ]; then
# Exec SSL with -config temp-file
"$EASYRSA_OPENSSL" "$openssl_command" \
-config "$easyrsa_safe_ssl_conf" "$@" && \
return
if [ "$EASYRSA_SILENT_SSL" ] && [ "$EASYRSA_BATCH" ]
then
"$EASYRSA_OPENSSL" "$openssl_command" \
-config "$easyrsa_safe_ssl_conf" "$@" \
2>/dev/null && \
return
else
"$EASYRSA_OPENSSL" "$openssl_command" \
-config "$easyrsa_safe_ssl_conf" "$@" && \
return
fi
else
# Exec SSL without -config temp-file
"$EASYRSA_OPENSSL" "$openssl_command" "$@" && \
return
if [ "$EASYRSA_SILENT_SSL" ] && [ "$EASYRSA_BATCH" ]
then
"$EASYRSA_OPENSSL" "$openssl_command" "$@" \
2>/dev/null && \
return
else
"$EASYRSA_OPENSSL" "$openssl_command" "$@" && \
return
fi
fi
# Always fail here
die "easyrsa_openssl - $openssl_command failed"
die "\
easyrsa_openssl - Command has failed:
* $EASYRSA_OPENSSL $openssl_command \
${has_config:+-config $easyrsa_safe_ssl_conf }$*"
} # => easyrsa_openssl()
# Verify the SSL library is functional and establish version dependencies
@ -5561,6 +5581,10 @@ while :; do
export EASYRSA_SILENT=1
export EASYRSA_BATCH=1
;;
-S|--silent-ssl)
empty_ok=1
export EASYRSA_SILENT_SSL=1
;;
--no-safe-ssl)
empty_ok=1
export EASYRSA_NO_SAFE_SSL=1
@ -5655,6 +5679,11 @@ if [ "$EASYRSA_PASSOUT" ]; then
unset -v EASYRSA_NO_PASS
prohibit_no_pass=1
fi
# --silent-ssl requires --batch
if [ "$EASYRSA_SILENT_SSL" ]; then
[ "$EASYRSA_BATCH" ] || warn "\
Option --silent-ssl requires batch mode --batch."
fi
# Hand off to the function responsible
case "$cmd" in