Skip to content

Commit

Permalink
build-ca: Use write_x509_type_tmp(), follow sign-req example
Browse files Browse the repository at this point in the history
Signed-off-by: Richard T Bonhomme <[email protected]>
  • Loading branch information
TinCanTech committed Dec 6, 2023
1 parent 7df3026 commit fc80e09
Showing 1 changed file with 22 additions and 13 deletions.
35 changes: 22 additions & 13 deletions easyrsa3/easyrsa
Original file line number Diff line number Diff line change
Expand Up @@ -1713,21 +1713,30 @@ Raw CA mode
{print}
}'

# Find or create x509 CA file
if [ -f "$EASYRSA_EXT_DIR/ca" ]; then
# Use the x509-types/ca file
x509_ca_file="$EASYRSA_EXT_DIR/ca"
else
# Use a temp file
write_x509_type_tmp ca
x509_ca_file="$x509_tmp"
fi

# Find or create x509 COMMON file
if [ -f "$EASYRSA_EXT_DIR/COMMON" ]; then
# Use the x509-types/COMMON file
x509_COMMON_file="$EASYRSA_EXT_DIR/COMMON"
else
# Use a temp file
write_x509_type_tmp COMMON
x509_COMMON_file="$x509_tmp"
fi

# Insert x509-types COMMON and 'ca' and EASYRSA_EXTRA_EXTS
{
# 'ca' file
if [ -f "$EASYRSA_EXT_DIR/ca" ]; then
cat "$EASYRSA_EXT_DIR/ca"
else
create_x509_type ca
fi

# COMMON file
if [ -f "$EASYRSA_EXT_DIR/COMMON" ]; then
cat "$EASYRSA_EXT_DIR/COMMON"
else
create_x509_type COMMON
fi
# X509 files
cat "$x509_ca_file" "$x509_COMMON_file"

# User extentions
[ "$EASYRSA_EXTRA_EXTS" ] && \
Expand Down

0 comments on commit fc80e09

Please sign in to comment.