executable_checkssl.sh 306 B

123456789101112
  1. #!/bin/sh
  2. # This script prints SSL Certificate Expiry.
  3. data="$(echo | openssl s_client -servername "$1" -connect "$1":443 2>/dev/null | openssl x509 -noout -enddate | sed -e 's#notAfter=##')"
  4. ssldate="$(date -d "${data}" '+%s')"
  5. nowdate="$(date '+%s')"
  6. diff="$((ssldate-nowdate))"
  7. echo $((diff/86400))