Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inline: Add decimal value for certificate serial number (Linux Only) #1222

Merged
merged 2 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Easy-RSA 3 ChangeLog

3.2.1 (TBD)

* inline: Add decimal value for cert. serial (Linux Only) (b33038e) (#1222)
* Always exit with error for unknown command options (Except nopass) (#1221)
(build-ca: b2f7912); (gen-req: 07f21d3); (build_full(): 0ff7f4c);
(export_pkcs(): 2c51288); (set-pass: 1266d4e)
Expand Down
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