summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2022-11-13 08:14:15 -0500
committerGlenn Strauss <gstrauss@gluelogic.com>2022-11-23 08:44:48 -0500
commitd616dea236785733dd04e3765d54a7f3a793f10c (patch)
tree499276092395cb6f4b16addbdfe44c7cf0be61cb /doc
parente0c1341c5ed264f07f107eeeb493630e29d6153c (diff)
downloadlighttpd-git-d616dea236785733dd04e3765d54a7f3a793f10c.tar.gz
[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
Diffstat (limited to 'doc')
-rwxr-xr-xdoc/scripts/cert-staple.sh9
1 files changed, 8 insertions, 1 deletions
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)