Skip to content

Instantly share code, notes, and snippets.

@chuckersjp
Created April 10, 2020 20:53
Show Gist options
  • Save chuckersjp/fb47d18bc93c9b67785174ae1060a8c0 to your computer and use it in GitHub Desktop.
Save chuckersjp/fb47d18bc93c9b67785174ae1060a8c0 to your computer and use it in GitHub Desktop.
Output the expiration dates of the certs in bootstrap
#!/usr/bin/python
import sys, json, base64
from cryptography import x509
from cryptography.hazmat.backends import default_backend
file_list = json.load(sys.stdin)['storage']['files']
#for files in file_list:
# print files['path'] + "\n" + base64.b64decode(files['contents']['source'].split(',')[1])
for files in file_list:
if files['path'][-4:] == '.crt':
print files['path']
certificate = base64.b64decode(files['contents']['source'].split(',')[1])
cert = x509.load_pem_x509_certificate(certificate, default_backend())
print cert.not_valid_before
print cert.not_valid_after
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment