From db9507626b1101376c79e455cb37075ae6d90e28 Mon Sep 17 00:00:00 2001 From: Richard T Bonhomme Date: Wed, 14 Jun 2023 21:24:51 +0100 Subject: [PATCH] Auto-create x509-types: Corrections to buld-ca and sign-req build-ca: * Replace 'print foo' with function create_x509_types_ca() * Replace 'ignore' with function create_x509_type_COMMON() sign-req: * Replace 'ignore' with function create_x509_type_COMMON() Note: x509-types/COMMON only has comments, no code. Signed-off-by: Richard T Bonhomme --- easyrsa3/easyrsa | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/easyrsa3/easyrsa b/easyrsa3/easyrsa index 5ca32cf..05a9caa 100755 --- a/easyrsa3/easyrsa +++ b/easyrsa3/easyrsa @@ -1878,18 +1878,14 @@ Raw CA mode if [ -f "$EASYRSA_EXT_DIR/ca" ]; then cat "$EASYRSA_EXT_DIR/ca" else - print "\ -basicConstraints = CA:TRUE -subjectKeyIdentifier = hash -authorityKeyIdentifier = keyid:always,issuer:always -keyUsage = cRLSign, keyCertSign" + create_x509_type_ca fi # COMMON file if [ -f "$EASYRSA_EXT_DIR/COMMON" ]; then cat "$EASYRSA_EXT_DIR/COMMON" else - : # ok + create_x509_type_COMMON fi # User extentions @@ -2354,13 +2350,7 @@ to the latest Easy-RSA release." # Begin output redirect { - # Append COMMON and cert-type extensions - if [ -f "$EASYRSA_EXT_DIR/COMMON" ]; then - cat "$EASYRSA_EXT_DIR/COMMON" - else - : # ok - fi - + # Append $cert-type extensions if [ -f "$EASYRSA_EXT_DIR/$crt_type" ]; then cat "$EASYRSA_EXT_DIR/$crt_type" else @@ -2383,6 +2373,13 @@ to the latest Easy-RSA release." esac fi + # Append COMMON extensions + if [ -f "$EASYRSA_EXT_DIR/COMMON" ]; then + cat "$EASYRSA_EXT_DIR/COMMON" + else + create_x509_type_COMMON + fi + # Support a dynamic CA path length when present: if [ "$crt_type" = "ca" ] && [ "$EASYRSA_SUBCA_LEN" ] then