Created
May 8, 2023 12:44
-
-
Save stigtsp/26d687453c776ce39f8a25dc45c7b111 to your computer and use it in GitHub Desktop.
shell script to compare cacert files
This file contains 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/env bash | |
set -eu | |
parse_bundle() { | |
# https://serverfault.com/questions/590870/how-to-view-all-ssl-certificates-in-a-bundle | |
openssl crl2pkcs7 -nocrl -certfile $1 | openssl pkcs7 -print_certs | |
} | |
echo "Comparing certs in $1 and $2" >&2 | |
tmpdir=$(mktemp -d) | |
parse_bundle $1 > $tmpdir/a | |
parse_bundle $2 > $tmpdir/b | |
pushd $tmpdir | |
echo "Comparing output in $tmpdir" >&2 | |
diff -u a b | |
popd | |
trap "rm -vr $tmpdir" EXIT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment