Skip to content

Commit

Permalink
inline: Add decimal value for certificate serial number (Linux Only)
Browse files Browse the repository at this point in the history
Signed-off-by: Richard T Bonhomme <[email protected]>
  • Loading branch information
TinCanTech committed Sep 5, 2024
1 parent 47db1c3 commit b33038e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions easyrsa3/easyrsa
Original file line number Diff line number Diff line change
Expand Up @@ -2991,6 +2991,23 @@ inline_file() {
$(cat "$crt_source")
</cert>"

# Calculate decimal value for serial number
# because openvpn uses decimal serial ?!?
# for '--crl-verify /path/to/dir dir'
# For reasons unknown..
if which bc >/dev/null; then
crt_serial="$(
"$EASYRSA_OPENSSL" x509 -in "$crt_source" \
-noout -serial
)" || die "inline_file - SSL -serial failed"
crt_serial="${crt_serial#*=}"
crt_serial_dec="$(
echo "ibase=16; $crt_serial" | bc
)" || die "inline_file - HEX to DEC failed"
else
crt_serial_dec="Unavailable"
fi

# Generate fingerprint
crt_fingerprint="$(
"$EASYRSA_OPENSSL" x509 -in "$crt_source" \
Expand Down Expand Up @@ -3133,6 +3150,7 @@ ${tls_key_data}
# commonName: $crt_CN
# SHA256 fingerprint:
# $crt_fingerprint
# Decimal serial number: $crt_serial_dec

$crt_data

Expand Down

0 comments on commit b33038e

Please sign in to comment.