envygeeks
3/1/2018 - 8:59 PM

Check certificate mismatch

#!/bin/bash
[ "$DEBUG" = "true" ] && set -x
set -e

a=$(openssl x509 -noout -modulus -in "$1".crt | openssl md5)
b=$(openssl rsa  -noout -modulus -in "$1".key | openssl md5)
c=$(openssl req  -noout -modulus -in "$1".csr | openssl md5)

if a != b || b != c || c != a; then
  echo "Mismatch"
  exit 1
fi

exit 0