Skip to content

Commit 2b97ddc

Browse files
committed
Merge branch 'forbid_selfsign-Compare-signing_serial' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-forbid_selfsign-Compare-signing_serial
Signed-off-by: Richard T Bonhomme <[email protected]>
2 parents 39af841 + 6c51b9d commit 2b97ddc

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ Easy-RSA 3 ChangeLog
22

33
3.2.3 (TBD)
44

5+
* forbid_selfsign(): Compare cert serial to signing cert serial (29b2779) (#1342)
56
* Unit-test: Minimize Windows test (dc60c8b) (#1339)
67
* ssl_cert_x509v3_eku(): Localize variables and minor improvements (8c19a95) (#1337)
78
* inline_file(): Always use ssl_cert_x509v3_eku() to set $inline_crt_type (e1a2880) (#1337)

easyrsa3/easyrsa

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3584,17 +3584,30 @@ It is now possible to sign a new certificate for '$file_name_base'"
35843584
# Forbid a self-signed cert from being expired/renewed/revoked
35853585
# by a CA that has nothing to do with the cert
35863586
forbid_selfsign() {
3587+
fn_name="$fn_name; forbid_selfsign"
35873588
# 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"
35903595

35913596
# SSL text
35923597
"$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" ]
35983611
} # => forbid_selfsign()
35993612

36003613
# gen-crl backend

0 commit comments

Comments
 (0)