ocsp-stapling.test 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #!/bin/sh
  2. # ocsp-stapling.test
  3. trap 'for i in `jobs -p`; do pkill -TERM -P $i; done' EXIT
  4. server=login.live.com
  5. ca=certs/external/baltimore-cybertrust-root.pem
  6. [ ! -x ./examples/client/client ] && echo -e "\n\nClient doesn't exist" && exit 1
  7. ./examples/client/client -? 2>&1 | grep -- 'Client not compiled in!'
  8. if [ $? -eq 0 ]; then
  9. exit 0
  10. fi
  11. # is our desired server there? - login.live.com doesn't answers PING
  12. #./scripts/ping.test $server 2
  13. # client test against the server
  14. ./examples/client/client -X -C -h $server -p 443 -A $ca -g -W 1
  15. RESULT=$?
  16. [ $RESULT -ne 0 ] && echo -e "\n\nClient connection failed" && exit 1
  17. # Test with example server
  18. ./examples/server/server -? 2>&1 | grep -- 'Server not compiled in!'
  19. if [ $? -eq 0 ]; then
  20. exit 0
  21. fi
  22. # setup ocsp responder
  23. ./certs/ocsp/ocspd-intermediate1-ca-issued-certs.sh &
  24. sleep 1
  25. [ $(jobs -r | wc -l) -ne 1 ] && echo -e "\n\nSetup ocsp responder failed, skipping" && exit 0
  26. # client test against our own server - GOOD CERT
  27. ./examples/server/server -c certs/ocsp/server1-cert.pem -k certs/ocsp/server1-key.pem &
  28. sleep 1
  29. ./examples/client/client -C -A certs/ocsp/root-ca-cert.pem -W 1
  30. RESULT=$?
  31. [ $RESULT -ne 0 ] && echo -e "\n\nClient connection failed" && exit 1
  32. # client test against our own server - REVOKED CERT
  33. ./examples/server/server -c certs/ocsp/server2-cert.pem -k certs/ocsp/server2-key.pem &
  34. sleep 1
  35. ./examples/client/client -C -A certs/ocsp/root-ca-cert.pem -W 1
  36. RESULT=$?
  37. [ $RESULT -ne 1 ] && echo -e "\n\nClient connection suceeded $RESULT" && exit 1
  38. ./examples/client/client -v 4 2>&1 | grep -- 'Bad SSL version'
  39. if [ $? -ne 0 ]; then
  40. # client test against our own server - GOOD CERT
  41. ./examples/server/server -c certs/ocsp/server1-cert.pem -k certs/ocsp/server1-key.pem -v 4 &
  42. sleep 1
  43. ./examples/client/client -C -A certs/ocsp/root-ca-cert.pem -W 1 -v 4 -F 1
  44. RESULT=$?
  45. [ $RESULT -ne 0 ] && echo -e "\n\nClient connection failed" && exit 1
  46. # client test against our own server - REVOKED CERT
  47. ./examples/server/server -c certs/ocsp/server2-cert.pem -k certs/ocsp/server2-key.pem -v 4 &
  48. sleep 1
  49. ./examples/client/client -C -A certs/ocsp/root-ca-cert.pem -W 1 -v 4 -F 1
  50. RESULT=$?
  51. [ $RESULT -ne 1 ] && echo -e "\n\nClient connection suceeded $RESULT" && exit 1
  52. fi
  53. exit 0