expdays: exit with error if cert unreadable

This commit is contained in:
xfnw 2022-04-18 14:04:35 -04:00
parent 86cebd08c8
commit ff0805b2a9
1 changed files with 4 additions and 1 deletions

View File

@ -2,7 +2,10 @@
dat=$(openssl x509 -noout -enddate | cut -d= -f2)
if [ "$(uname)" = "OpenBSD" ]
if [ -z "$dat" ]
then
exit 1
elif [ "$(uname)" = "OpenBSD" ]
then
echo $(( ($(date -j -f "%b %d %T %Y %z" "$dat" "+%s") - $(date '+%s')) / 86400 ))
elif [ -h /bin/date ] # date is symlinked, assume its busybox