Skip to content
Merged
Show file tree
Hide file tree
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
26 changes: 26 additions & 0 deletions easyrsa3/easyrsa
Original file line number Diff line number Diff line change
Expand Up @@ -828,6 +828,30 @@ current CA keypair. If you intended to start a new CA, run init-pki first."
fi
fi

# Insert x509-types COMMON and 'ca'
#shellcheck disable=SC2016
awkscript='
{if ( match($0, "^#%X509_TYPES%") )
{ while ( getline<"/dev/stdin" ) {print} next }
{print}
}'
conf_tmp="$(easyrsa_mktemp)" || die "Failed to create temporary file"
cat "${EASYRSA_EXT_DIR}/ca" "${EASYRSA_EXT_DIR}/COMMON" | \
awk "$awkscript" "$EASYRSA_SSL_CONF" \
> "$conf_tmp" \
|| die "Copying SSL config to temp file failed"
# Use this new SSL config for the rest of this function
EASYRSA_SSL_CONF="$conf_tmp"

# When EASYRSA_EXTRA_EXTS is defined, pass it as-is to SSL -addext
if [ -n "$EASYRSA_EXTRA_EXTS" ]; then
# example: "-addext foo,a:b -addext bah,c:d -addext baz e:f,g"
[ "${EASYRSA_EXTRA_EXTS%% *}" = '-addext' ] || \
die "EASYRSA_EXTRA_EXTS: $EASYRSA_EXTRA_EXTS"
EASYRSA_CA_EXTRA_EXTS="$EASYRSA_EXTRA_EXTS"
unset -v EASYRSA_EXTRA_EXTS
fi

# Choose SSL Library version (1 or 3) and build CA
case "$osslv_major" in # => BEGIN SSL lib version

Expand Down Expand Up @@ -888,6 +912,7 @@ current CA keypair. If you intended to start a new CA, run init-pki first."
# shellcheck disable=SC2086
easyrsa_openssl req -utf8 -new -key "$out_key_tmp" \
-out "$out_file_tmp" ${opts} ${crypto_opts} \
${EASYRSA_CA_EXTRA_EXTS} \
${EASYRSA_PASSIN:+-passin "$EASYRSA_PASSIN"} || \
die "Failed to build the CA"
;;
Expand Down Expand Up @@ -948,6 +973,7 @@ current CA keypair. If you intended to start a new CA, run init-pki first."
#shellcheck disable=SC2086
easyrsa_openssl req -utf8 -new -key "$out_key_tmp" \
-keyout "$out_key_tmp" -out "$out_file_tmp" $crypto_opts $opts \
${EASYRSA_CA_EXTRA_EXTS} \
${EASYRSA_PASSIN:+-passin "$EASYRSA_PASSIN"} \
|| die "Failed to build the CA"
;;
Expand Down
3 changes: 3 additions & 0 deletions easyrsa3/openssl-easyrsa.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ keyUsage = cRLSign, keyCertSign
# nsCertType omitted by default. Let's try to let the deprecated stuff die.
# nsCertType = sslCA

# A placeholder to handle the $X509_TYPES:
#%X509_TYPES% # Do NOT remove or change this line as $X509_TYPES demands it

# CRL extensions.
[ crl_ext ]

Expand Down