From d616dea236785733dd04e3765d54a7f3a793f10c Mon Sep 17 00:00:00 2001 From: Glenn Strauss Date: Sun, 13 Nov 2022 08:14:15 -0500 Subject: [doc/scripts/cert-staple.sh] *BSD date portability adjust date calculation for ocsp_expire for `date` command arguments using different flags on FreeBSD, OpenBSD, and DragonFlyBSD --- doc/scripts/cert-staple.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'doc') diff --git a/doc/scripts/cert-staple.sh b/doc/scripts/cert-staple.sh index af0c5c13..09f7bb3a 100755 --- a/doc/scripts/cert-staple.sh +++ b/doc/scripts/cert-staple.sh @@ -46,7 +46,14 @@ ocsp_status="$(printf %s "$OCSP_RESP" | head -1)" next_update="$(printf %s "$OCSP_RESP" | grep 'Next Update:')" next_date="$(printf %s "$next_update" | sed 's/.*Next Update: //')" [ -n "$next_date" ] || errexit -ocsp_expire=$(date -d "$next_date" +%s) +sysname=$(uname -s) +if [ "$sysname" = "FreeBSD" ] || \ + [ "$sysname" = "OpenBSD" ] || \ + [ "$sysname" = "DragonFly" ]; then + ocsp_expire=$(date -j -f "%b %e %T %Y %Z" "$next_date" "+%s") +else + ocsp_expire=$(date -d "$next_date" +%s) +fi # validate OCSP response ocsp_verify=$(openssl ocsp -issuer "$CHAIN_PEM" -verify_other "$CHAIN_PEM" -cert "$CERT_PEM" -respin "$OCSP_TMP" -no_nonce -out /dev/null 2>&1) -- cgit v1.2.1