Last active
October 20, 2022 02:28
-
-
Save inscapist/c210588d70daf21f87cbfe610cf38756 to your computer and use it in GitHub Desktop.
Openssl helper functions (WIP)
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
# args: | |
# $1. server_name assuming SNI (eg. sub.domain.com) | |
# $2. endpoint (eg. IP_ADDR:8443 or sub.domain.com:443) | |
function tlscert-check() { | |
echo | \ | |
openssl s_client -servername $1 -connect $2 2>/dev/null | \ | |
openssl x509 -text -noout | |
} | |
function tlscert-list-kube() { | |
kubectl get secrets -A \ | |
--field-selector type=kubernetes.io/tls | |
} | |
# Ensure that the secret is in the current namespace | |
# args: | |
# $1. secret_name | |
function tlscert-check-kube() { | |
kubectl get secret $1 -o json | \ | |
jq -r '.data."tls.crt"' | \ | |
base64 -d | \ | |
openssl x509 -noout -text | |
} |
Author
inscapist
commented
Oct 20, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment