To see this example running, do the following:
docker-compose up$ curl --cacert sidecar/server-certs/server-ca.pem --key client/certs/mtls-client.key.pem --cert client/certs/mtls-client.cert.pem -k https://localhost
{"data":"I'm secured by an mTLS!"}To see the certificate pinning work:
- execute
docker-compose downif you are running the service - modify the value of the
ALLOWED_CERTIFICATE_FINGERPRINTenvironment variable on thedocker-compose.ymlfile (for example:ALLOWED_CERTIFICATE_FINGERPRINT=f90c85270cb3c7e2133119f4c02f2f36a17984dc) - run
docker-compose upagain to bring the service with the new value ofALLOWED_CERTIFICATE_FINGERPRINTapplied - execute the same
curldescribe above again - The result should be:
<html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx/1.18.0</center>
</body>
</html>