Created
April 10, 2020 20:53
-
-
Save chuckersjp/fb47d18bc93c9b67785174ae1060a8c0 to your computer and use it in GitHub Desktop.
Output the expiration dates of the certs in bootstrap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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