Better date support for BSD/GNU
Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
This commit is contained in:
parent
566e7c38f6
commit
7c705f3fb2
@ -1010,9 +1010,17 @@ at: $crt_in"
|
||||
"$EASYRSA_OPENSSL" x509 -in "$crt_in" -noout -enddate |
|
||||
sed 's/^notAfter=//'
|
||||
)
|
||||
expire_date=$(date -d "$expire_date" +%s)
|
||||
|
||||
allow_renew_date=$(date -d "+${EASYRSA_CERT_RENEW}day" +%s)
|
||||
case $(uname) in
|
||||
"Darwin"|*"BSD")
|
||||
expire_date=$(date -j -f '%b %d %T %Y %Z' "$expire_date" +%s)
|
||||
allow_renew_date=$(date -j -v"+${EASYRSA_CERT_RENEW}d" +%s)
|
||||
;;
|
||||
*)
|
||||
# This works on Windows, too, since uname doesn't exist and this is catch-all
|
||||
expire_date=$(date -d "$expire_date" +%s)
|
||||
allow_renew_date=$(date -d "+${EASYRSA_CERT_RENEW}day" +%s)
|
||||
;;
|
||||
esac
|
||||
|
||||
[ "$expire_date" -lt "$allow_renew_date" ] || die "\
|
||||
Certificate expires in more than $EASYRSA_CERT_RENEW days.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user