Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions easyrsa3/easyrsa
Original file line number Diff line number Diff line change
Expand Up @@ -1745,8 +1745,13 @@ Please update openssl-easyrsa.cnf to the latest official release."
die "Failed to read X509-type $crt_type"

# Support a dynamic CA path length when present:
[ "$crt_type" = "ca" ] && [ "$EASYRSA_SUBCA_LEN" ] && \
print "basicConstraints = CA:TRUE, pathlen:$EASYRSA_SUBCA_LEN"
if [ "$crt_type" = "ca" ] && [ "$EASYRSA_SUBCA_LEN" ]; then
# extract last occurrence of basicConstraints and append pathlen
# shellcheck disable=SC2016 # vars don't expand in single quotes
awkchkcrit='/^[[:blank:]]*basicConstraints[[:blank:]]*=/ { bC=$0 }
END { if (length(bC) == 0 ) bC="basicConstraints = CA:TRUE"; print bC }'
print "$(awk "${awkchkcrit}" "$EASYRSA_EXT_DIR/$crt_type"), pathlen:$EASYRSA_SUBCA_LEN"
fi

# Deprecated Netscape extension support, if enabled
if print "$EASYRSA_NS_SUPPORT" | awk_yesno; then
Expand Down