expiry-dates.sh 702 B

1234567891011121314
  1. #!/usr/bin/env bash
  2. [[ -f mailcow.conf ]] && source mailcow.conf
  3. [[ -f ../mailcow.conf ]] && source ../mailcow.conf
  4. POSTFIX=$(echo | openssl s_client -connect ${MAILCOW_HOSTNAME}:${SMTP_PORT} -starttls smtp 2>/dev/null | openssl x509 -inform pem -noout -enddate | cut -d "=" -f 2)
  5. DOVECOT=$(echo | openssl s_client -connect ${MAILCOW_HOSTNAME}:${IMAP_PORT} -starttls imap 2>/dev/null | openssl x509 -inform pem -noout -enddate | cut -d "=" -f 2)
  6. NGINX=$(echo | openssl s_client -connect ${MAILCOW_HOSTNAME}:${HTTPS_PORT} 2>/dev/null | openssl x509 -inform pem -noout -enddate | cut -d "=" -f 2)
  7. echo "TLS expiry dates:"
  8. echo "Postfix: ${POSTFIX}"
  9. echo "Dovecot: ${DOVECOT}"
  10. echo "Nginx: ${NGINX}"