3 ms·
It's a pretty simple little python script, though obviously you then run the risk that it's no longer running in x years time when you actually need it. impo
by remus 7y ago
It's a pretty simple little python script, though obviously you then run the risk that it's no longer running in x years time when you actually need it.
import ssl
import OpenSSL
from datetime import datetime
cert = ssl.get_server_certificate((www.google.com, 443))
x509 = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_PEM, cert)
expiry_dt = datetime.strptime(x509.get_notAfter()[:8].decode('utf-8'), '%Y%m%d')
- jimktrains2 7y agoDoes ssl.get_server_certificate handle sni? Also, no need for python: echo | openssl s_client -connect google.com:443 -servername google.com -showcerts 2>&1 | openssl x509 -text -noout | grep "Not After" | cut -d : -f 2- | xargs -I {} date -d "{}" +%Y%m%d
- Arnavion 7y ago`-text -noout | grep "Not After"` is just `-enddate -noout`