Skip to content

Commit

Permalink
Improve ssl_cert_x509v3_eku()
Browse files Browse the repository at this point in the history
Remove subshell definition for OPENSSL_CONF, not required.
Call SSL binary directly, do not use easyrsa_openssl() wrapper.
Add comment to clarify error detection from subshell failure.

Signed-off-by: Richard T Bonhomme <[email protected]>
  • Loading branch information
TinCanTech committed Apr 17, 2024
1 parent 84da499 commit 4d989f6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions easyrsa3/easyrsa
Original file line number Diff line number Diff line change
Expand Up @@ -3557,12 +3557,11 @@ ssl_cert_x509v3_eku() {
# Extract certificate Extended Key Usage
if [ "$ssl_lib" = libressl ]; then
__eku="$(
easyrsa_openssl x509 -in "${__crt}" -noout -text | \
"$EASYRSA_OPENSSL" x509 -in "${__crt}" -noout -text | \
sed -n "/${__pattern}/{n;s/^ *//g;p;}"
)"
else
__eku="$(
OPENSSL_CONF=/dev/null
"$EASYRSA_OPENSSL" x509 -in "${__crt}" -noout \
-ext extendedKeyUsage | \
sed -e /"${__pattern}"/d -e s/^\ *//
Expand Down Expand Up @@ -3614,6 +3613,8 @@ ssl_cert_x509v3_eku() {
return
fi

# Also, catch errors from SSL x509 command
# for '__eku' subshell+pipe
return 1
} # => ssl_cert_x509v3_eku()

Expand Down

0 comments on commit 4d989f6

Please sign in to comment.