Skip to content

Commit

Permalink
show-expire: Add CA certificate to report
Browse files Browse the repository at this point in the history
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
  • Loading branch information
TinCanTech committed Aug 18, 2024
1 parent 7cf1f1e commit a36cd54
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions dev/easyrsa-tools.lib
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,26 @@ read_db() {

done < "$db_in"

# Add CA to show-expire
case "$report" in
expire)
# Extract -endate
ca_enddate="$(
"$EASYRSA_OPENSSL" x509 -in "$EASYRSA_PKI"/ca.crt \
-noout -enddate
)"
ca_enddate="${ca_enddate#*=}"

# Check CA for expiry
if ! will_cert_expire "$EASYRSA_PKI"/ca.crt \
"$pre_expire_window_s" 1>/dev/null
then
# Print CA expiry date
printf '%s%s\n' \
"CA certificate will expire on $ca_enddate"
fi
esac

# Check for target found/valid commonName, if given
if [ "$target" ]; then
[ "$target_found" ] || \
Expand Down

0 comments on commit a36cd54

Please sign in to comment.