File tree Expand file tree Collapse file tree 2 files changed +21
-7
lines changed Expand file tree Collapse file tree 2 files changed +21
-7
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ Easy-RSA 3 ChangeLog
2
2
3
3
3.2.3 (TBD)
4
4
5
+ * forbid_selfsign(): Compare cert serial to signing cert serial (29b2779) (#1342)
5
6
* Unit-test: Minimize Windows test (dc60c8b) (#1339)
6
7
* ssl_cert_x509v3_eku(): Localize variables and minor improvements (8c19a95) (#1337)
7
8
* inline_file(): Always use ssl_cert_x509v3_eku() to set $inline_crt_type (e1a2880) (#1337)
Original file line number Diff line number Diff line change @@ -3584,17 +3584,30 @@ It is now possible to sign a new certificate for '$file_name_base'"
3584
3584
# Forbid a self-signed cert from being expired/renewed/revoked
3585
3585
# by a CA that has nothing to do with the cert
3586
3586
forbid_selfsign() {
3587
+ fn_name="$fn_name; forbid_selfsign"
3587
3588
# cert temp-file
3588
- forbid_selfsign_tmp=
3589
- easyrsa_mktemp forbid_selfsign_tmp
3589
+ forbid_ss_tmp=
3590
+ easyrsa_mktemp forbid_ss_tmp
3591
+
3592
+ forbid_serial=
3593
+ ssl_cert_serial "$1" forbid_serial || \
3594
+ die "$fn_name - ssl_cert_serial"
3590
3595
3591
3596
# SSL text
3592
3597
"$EASYRSA_OPENSSL" x509 -in "$1" -noout -text \
3593
- > "$forbid_selfsign_tmp" || \
3594
- die "forbid_selfsign - ssl text"
3595
-
3596
- # test for CA:TRUE
3597
- grep -q "^[[:blank:]]*CA:TRUE$" "$forbid_selfsign_tmp"
3598
+ > "$forbid_ss_tmp" || die "$fn_name - ssl text"
3599
+
3600
+ # Extract signing cert serial
3601
+ signing_serial="$(
3602
+ grep "^[[:blank:]]*serial:.*$" "$forbid_ss_tmp" | \
3603
+ sed -e 's/^[[:blank:]]*serial//' -e 's/://g'
3604
+ )" || die "$fn_name - signing_serial subshell"
3605
+ [ "$signing_serial" ] || die "$fn_name - signing_serial"
3606
+
3607
+ verbose "$fn_name: $forbid_serial = $signing_serial"
3608
+ fn_name="${fn_name%; forbid_selfsign}"
3609
+ # Compare $ssl_cert_serial to $signing_serial
3610
+ [ "$forbid_serial" = "$signing_serial" ]
3598
3611
} # => forbid_selfsign()
3599
3612
3600
3613
# gen-crl backend
You can’t perform that action at this time.
0 commit comments