@@ -76,7 +76,7 @@ rm_container web-a lb
7676docker run -d --name web-a -e HOSTNAME=" web-a" dockercloud/hello-world
7777docker run -d --name lb --link web-a:web-a -e DEFAULT_SSL_CERT=" $( awk 1 ORS=' \\n' cert1.pem) " -p 443:443 haproxy
7878wait_for_startup https://${DOCKER_HOST_IP}
79- curl -sSfL --resolve web-a.org:443:${DOCKER_HOST_IP} https://web-a.org 2>&1 | grep -iF " SSL certificate problem " > /dev/null
79+ curl -sSfL --resolve web-a.org:443:${DOCKER_HOST_IP} https://web-a.org 2>&1> /dev/null && exit $?
8080curl -sSfL --cacert ca1.pem --resolve web-a.org:443:${DOCKER_HOST_IP} https://web-a.org 2>&1 | grep -iF ' My hostname is web-a' > /dev/null
8181echo
8282
@@ -86,9 +86,9 @@ docker run -d --name web-a -e HOSTNAME="web-a" dockercloud/hello-world
8686docker run -d --name lb --link web-a:web-a -e DEFAULT_SSL_CERT=" $( awk 1 ORS=' \\n' cert1.pem) " -e CA_CERT=" $( awk 1 ORS=' \\n' ca0.pem) " -p 443:443 haproxy
8787wait_for_startup https://${DOCKER_HOST_IP}
8888echo " Sending request without certificate"
89- curl -sSfL --cacert ca1.pem --resolve web-a.org:443:${DOCKER_HOST_IP} https://web-a.org 2>&1 > /dev/null | grep ' handshake ' > /dev/null
89+ curl -sSfL --cacert ca1.pem --resolve web-a.org:443:${DOCKER_HOST_IP} https://web-a.org 2>&1 > /dev/null && exit $?
9090echo " Sending request with a wrong certificate"
91- curl -sSfL --cacert ca1.pem --cert cert1.pem --resolve web-a.org:443:${DOCKER_HOST_IP} https://web-a.org 2>&1 > /dev/null | grep ' alert unknown ca ' > /dev/null
91+ curl -sSfL --cacert ca1.pem --cert cert1.pem --resolve web-a.org:443:${DOCKER_HOST_IP} https://web-a.org 2>&1 > /dev/null && exit $?
9292echo " Sending request with the correct certificate"
9393curl -sSfL --cacert ca1.pem --cert cert0.pem --resolve web-a.org:443:${DOCKER_HOST_IP} https://web-a.org 2>&1 | grep -iF ' My hostname is web-a' > /dev/null
9494echo
@@ -98,7 +98,7 @@ rm_container web-a lb
9898docker run -d --name web-a -e HOSTNAME=" web-a" dockercloud/hello-world
9999docker run -d --name lb --link web-a:web-a -e CERT_FOLDER=" /certs/" -v $( pwd) /cert1.pem:/certs/cert1.pem -p 443:443 haproxy
100100wait_for_startup https://${DOCKER_HOST_IP}
101- curl -sSfL --resolve web-a.org:443:${DOCKER_HOST_IP} https://web-a.org 2>&1 | grep -iF " SSL certificate problem " > /dev/null
101+ curl -sSfL --resolve web-a.org:443:${DOCKER_HOST_IP} https://web-a.org 2>&1 > /dev/null && exit $?
102102curl -sSfL --cacert ca1.pem --resolve web-a.org:443:${DOCKER_HOST_IP} https://web-a.org 2>&1 | grep -iF ' My hostname is web-a' > /dev/null
103103echo
104104
@@ -108,9 +108,9 @@ docker run -d --name web-a -e HOSTNAME="web-a" dockercloud/hello-world
108108docker run -d --name lb --link web-a:web-a -e CERT_FOLDER=" /certs/" -v $( pwd) /cert1.pem:/certs/cert1.pem -e CA_CERT_FILE=" /cacert/ca0.pem" -v $( pwd) /ca0.pem:/cacert/ca0.pem -p 443:443 haproxy
109109wait_for_startup https://${DOCKER_HOST_IP}
110110echo " Sending request without certificate"
111- curl -sSfL --cacert ca1.pem --resolve web-a.org:443:${DOCKER_HOST_IP} https://web-a.org 2>&1 > /dev/null | grep ' handshake ' > /dev/null
111+ curl -sSfL --cacert ca1.pem --resolve web-a.org:443:${DOCKER_HOST_IP} https://web-a.org 2>&1 > /dev/null && exit $?
112112echo " Sending request with a wrong certificate"
113- curl -sSfL --cacert ca1.pem --cert cert1.pem --resolve web-a.org:443:${DOCKER_HOST_IP} https://web-a.org 2>&1 > /dev/null | grep ' alert unknown ca ' > /dev/null
113+ curl -sSfL --cacert ca1.pem --cert cert1.pem --resolve web-a.org:443:${DOCKER_HOST_IP} https://web-a.org 2>&1 > /dev/null && exit $?
114114echo " Sending request with the correct certificate" c
115115curl -sSfL --cacert ca1.pem --cert cert0.pem --resolve web-a.org:443:${DOCKER_HOST_IP} https://web-a.org 2>&1 | grep -iF ' My hostname is web-a' > /dev/null
116116echo
@@ -132,9 +132,9 @@ docker run -d --name web-b -e HOSTNAME="web-b" -e VIRTUAL_HOST="https://web-b.or
132132docker run -d --name lb --link web-a:web-a --link web-b:web-b -p 443:443 haproxy
133133wait_for_startup https://${DOCKER_HOST_IP}
134134curl -sSfL --cacert ca1.pem --resolve web-a.org:443:${DOCKER_HOST_IP} https://web-a.org 2>&1 | grep -iF ' My hostname is web-a' > /dev/null
135- curl -sSfL --cacert ca2.pem --resolve web-a.org:443:${DOCKER_HOST_IP} https://web-a.org 2>&1 2>&1 | grep -iF " SSL certificate problem: self signed certificate " > /dev/null
135+ curl -sSfL --cacert ca2.pem --resolve web-a.org:443:${DOCKER_HOST_IP} https://web-a.org 2>&1 > /dev/null && exit $?
136136curl -sSfL --cacert ca2.pem --resolve web-b.org:443:${DOCKER_HOST_IP} https://web-b.org 2>&1 | grep -iF ' My hostname is web-b' > /dev/null
137- curl -sSfL --cacert ca1.pem --resolve web-b.org:443:${DOCKER_HOST_IP} https://web-b.org 2>&1 2>&1 | grep -iF " SSL certificate problem: self signed certificate " > /dev/null
137+ curl -sSfL --cacert ca1.pem --resolve web-b.org:443:${DOCKER_HOST_IP} https://web-b.org 2>&1 > /dev/null && exit $?
138138echo
139139
140140echo " => Test multiple virtual host entries"
0 commit comments