@@ -611,6 +611,7 @@ Certificate & Request options: (these impact cert/req field values)
611
611
--san|--subject-alt-name=SUBJECT_ALT_NAME
612
612
: Add a subjectAltName. Can be used multiple times.
613
613
For more info and syntax, see: 'easyrsa help altname'
614
+ --san-crit : Mark X509v3 subjectAltName as critical
614
615
615
616
--new-subject='SUBJECT'
616
617
: Specify a new subject field to sign a request with.
@@ -2266,6 +2267,8 @@ $EASYRSA_EXTRA_EXTS"
2266
2267
> "$adjusted_ssl_cnf_tmp" || \
2267
2268
die "Writing SSL config to temp file failed"
2268
2269
2270
+ [ "${EASYRSA_SAN_CRIT}" ] && verbose "gen-req: SAN critical OK"
2271
+
2269
2272
# Use this SSL config for the rest of this function
2270
2273
EASYRSA_SSL_CONF="$adjusted_ssl_cnf_tmp"
2271
2274
fi
@@ -2567,6 +2570,8 @@ basicConstraints is not defined, cannot use 'pathlen'"
2567
2570
unset -v ns_cert_type
2568
2571
esac
2569
2572
2573
+ [ "${EASYRSA_SAN_CRIT}" ] && verbose "sign-req: SAN critical OK"
2574
+
2570
2575
# Generate the extensions file for this cert:
2571
2576
ext_tmp=""
2572
2577
easyrsa_mktemp ext_tmp || \
@@ -2601,6 +2606,7 @@ Failed to create temp extension file (bad permissions?) at:
2601
2606
verbose "sign_req: Generated extensions file OK"
2602
2607
2603
2608
# Get request CN
2609
+ # EASYRSA_REQ_CN MUST always be set to the CSR CN
2604
2610
EASYRSA_REQ_CN="$(
2605
2611
"$EASYRSA_OPENSSL" req -utf8 -in "$req_in" -noout \
2606
2612
-subject -nameopt multiline | grep 'commonName'
@@ -2663,7 +2669,7 @@ $confirm_dn"
2663
2669
if [ "$EASYRSA_SAN" ]; then
2664
2670
confirm_san="\
2665
2671
X509v3 Subject Alternative Name:
2666
- $EASYRSA_SAN"
2672
+ ${EASYRSA_SAN_CRIT}${ EASYRSA_SAN} "
2667
2673
else
2668
2674
confirm_san="$req_x509_san"
2669
2675
fi
@@ -5529,6 +5535,10 @@ while :; do
5529
5535
EASYRSA_SAN="$val"
5530
5536
fi
5531
5537
;;
5538
+ --san-crit*)
5539
+ empty_ok=1
5540
+ export EASYRSA_SAN_CRIT='critical,'
5541
+ ;;
5532
5542
--new-subj*)
5533
5543
export EASYRSA_NEW_SUBJECT="$val"
5534
5544
;;
@@ -5587,7 +5597,7 @@ done
5587
5597
if [ "$EASYRSA_SAN" ]; then
5588
5598
EASYRSA_EXTRA_EXTS="\
5589
5599
$EASYRSA_EXTRA_EXTS
5590
- subjectAltName = $EASYRSA_SAN"
5600
+ subjectAltName = ${EASYRSA_SAN_CRIT}${ EASYRSA_SAN} "
5591
5601
fi
5592
5602
5593
5603
# Set cmd now
0 commit comments