You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

cert-check.sh 468B

1234567891011121314151617181920212223
  1. #! /usr/bin/env sh
  2. if [ $# -ne 2 ]
  3. then
  4. echo "Usage: cert-check directory checkend" >&2
  5. exit 64
  6. fi
  7. dir="$1"
  8. checkend="$2"
  9. for cert in ${dir}/*.crt
  10. do
  11. openssl x509 -noout -in "${cert}" -checkend "${checkend}"
  12. will_expire="$?"
  13. date="$(openssl x509 -noout -in "${cert}" -enddate | cut -d= -f2)"
  14. if [ "${will_expire}" -eq 1 ]
  15. then
  16. site=$(basename "${cert}")
  17. site=$(echo "${site}" | sed -re 's/(.+).crt/\1/')
  18. echo "${site}" "${date}"
  19. fi
  20. done