executable_ssl 963 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/usr/bin/env bash
  2. set -e
  3. set -o pipefail
  4. TESTSSL="${TESTSSL:-docker run --network=host --rm -it drwetter/testssl.sh:3.0}"
  5. help_main()
  6. {
  7. echo "\
  8. Usage: ssl COMMANDS ARGS...
  9. Run COMMANDS with ARGS
  10. COMMAND must be one of the sub-commands listed below:
  11. general commands
  12. show show certificate for DOMAIN
  13. date show certificate date for DOMAIN
  14. check run testssl.sh on DOMAIN
  15. search open https://crt.sh/ in BROWSER
  16. Report bugs to: go.wigust@gmail.com."
  17. }
  18. case "$1" in
  19. show)
  20. echo | openssl s_client -showcerts -servername "$2" -connect "$2:443" 2>/dev/null | openssl x509 -inform pem -noout -text
  21. ;;
  22. date)
  23. echo | openssl s_client -servername "$2" -connect "$2:443" 2>/dev/null | openssl x509 -noout -dates
  24. ;;
  25. check)
  26. $TESTSSL "${@:2}"
  27. ;;
  28. search)
  29. $BROWSER https://crt.sh/
  30. ;;
  31. --help|*)
  32. help_main
  33. exit 0
  34. ;;
  35. esac