File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ RUN set -ex \
1414 && apk del openssl \
1515 && rm -rf /var/cache/apk/* \
1616 # Delete unnecessary files
17- && rm package* generate-cert.sh \
17+ && rm package* \
1818 # Correct User's file access
1919 && chown -R node:node /app \
2020 && chmod +r /app/privkey.pem
Original file line number Diff line number Diff line change @@ -325,13 +325,15 @@ message " Stop containers "
325325docker stop http-echo-tests
326326
327327message " Check that mTLS server responds with client certificate details"
328- # Might as well just reuse any cert
329- cp ../generate-cert.sh .
330- bash generate-cert.sh
328+ # Generate a new self signed cert locally
329+ openssl req -x509 -newkey rsa:4096 -sha256 -days 3650 -nodes -keyout privkey.pem -out fullchain.pem \
330+ -subj " /CN=client.example.net" \
331+ -addext " subjectAltName=DNS:client.example.net"
331332docker run -d --rm -e MTLS_ENABLE=1 --name http-echo-tests -p 8080:8080 -p 8443:8443 -t mendhak/http-https-echo
332333sleep 5
333- COMMON_NAME=" $( curl -sk --cert cert.pem --key privkey.pem https://localhost:8443/ | jq -r ' .clientCertificate.subject.CN' ) "
334- if [ " $COMMON_NAME " == " my.example.com" ]
334+ COMMON_NAME=" $( curl -sk --cert fullchain.pem --key privkey.pem https://localhost:8443/ | jq -r ' .clientCertificate.subject.CN' ) "
335+ SAN=" $( curl -sk --cert fullchain.pem --key privkey.pem https://localhost:8443/ | jq -r ' .clientCertificate.subjectaltname' ) "
336+ if [ " $COMMON_NAME " == " client.example.net" ] && [ " $SAN " == " DNS:client.example.net" ]
335337then
336338 passed " Client certificate details are present in the output"
337339else
You can’t perform that action at this time.
0 commit comments