fix logic for timestamp

This commit is contained in:
Jakobus Schürz 2021-05-20 00:04:54 +02:00
parent b85250cd11
commit 125976716b

View file

@ -277,9 +277,12 @@ agent-load-identity-keys () {
echo "pubkey without privkey: $pubkey"
pubkeysonly+=($pubkey)
fi
[ -e "${pubkey%.pub}-cert.pub" ] && \
[ $(date +%s -d $(ssh-keygen -L -f "${pubkey%.pub}-cert.pub"|awk '$1 == "Valid:"{print $5}')) -le $(date +%s -d NOW) ] \
if [ -e "${pubkey%.pub}-cert.pub" ]; then
#logwarn "${pubkey%.pub}-cert.pub: $(date +%s -d $(ssh-keygen -L -f "${pubkey%.pub}-cert.pub"|awk '$1 == "Valid:"{print $5}'))"
#logwarn "now: $(date +%s -d NOW)"
[ $(date +%s -d $(ssh-keygen -L -f "${pubkey%.pub}-cert.pub"|awk '$1 == "Valid:"{print $5}')) -gt $(date +%s -d NOW) ] \
|| logwarn "CERTIFICATE IS NOT VALID ANYMORE: ${pubkey%.pub}-cert.pub"
fi
done
loginfo "pubkeysonly: ${pubkeysonly[@]} (count: ${#pubkeysonly[*]})"