-
Notifications
You must be signed in to change notification settings - Fork 85
docs: mTLS documentation with example sample #299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
1b55f32
13fa934
7a73164
6c8d23c
2b43c05
134834f
ed3d681
55aaf43
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| --- | ||
| layout: default | ||
| title: Mutual TLS (mTLS) Authentication | ||
| permalink: /docs/concepts/mutual-tls | ||
| --- | ||
|
|
||
| # Mutual TLS (mTLS) Authentication | ||
|
|
||
| This guide explains how to implement Mutual TLS (mTLS) authentication in Cadence to secure communication between clients and servers. mTLS provides bidirectional authentication, ensuring that both the client and server verify each other's identities before exchanging data. | ||
|
|
||
| --- | ||
|
|
||
| ## Overview | ||
|
|
||
| ### What is Mutual TLS? | ||
|
|
||
| Mutual TLS (mTLS) is an enhanced version of the standard TLS protocol where both parties in a communication authenticate each other. Unlike standard TLS where only the server is authenticated, mTLS requires both the client and server to present and verify certificates. | ||
|
|
||
| In mTLS, both the client and server have a certificate, and both sides authenticate using their public/private key pair. This bidirectional authentication provides an additional layer of security, ensuring that: | ||
|
|
||
| - Clients can verify they're connecting to the legitimate server | ||
| - Servers can verify the identity of connecting clients | ||
| - All communication is encrypted end-to-end | ||
|
|
||
| --- | ||
|
|
||
| ## How mTLS Works | ||
|
|
||
| The mTLS handshake process involves the following steps: | ||
|
|
||
| ``` | ||
| ┌─────────────────────────────────────────────────────────────────────────┐ | ||
| │ mTLS Handshake Flow │ | ||
| └─────────────────────────────────────────────────────────────────────────┘ | ||
|
|
||
| CLIENT SERVER | ||
| │ │ | ||
| │ (1) Client initiates connection │ | ||
| ├─────────────────────────────────────────────────────--─> │ | ||
| │ │ | ||
| │ (2) Server sends its certificate │ | ||
| │ <────────────────────────────────────────────────────── ┤ | ||
| │ │ | ||
| │ (3) Client verifies server certificate │ | ||
| │ ✓ Check signature │ | ||
| │ ✓ Validate certificate chain │ | ||
| │ ✓ Check expiration │ | ||
| │ │ | ||
| │ (4) Client sends its certificate │ | ||
| ├───────────────────────────────────────────────────--───> │ | ||
| │ │ | ||
| │ (5) Server verifies client certificate │ | ||
| │ ✓ Check signature │ | ||
| │ ✓ Validate certificate chain │ | ||
| │ ✓ Check expiration │ | ||
| │ │ | ||
| │ (6) Server grants access │ | ||
| │ <────────────────────────────────────────────────────── ┤ | ||
| │ │ | ||
| │ (7) Encrypted TLS connection established │ | ||
| │ <═══════════════════════════════════════════════════> │ | ||
| │ All subsequent data is encrypted │ | ||
| │ │ | ||
| ``` | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a section here explaining how mTLS works with Cadence, explaining creating gRPC options, then the gRPC transport object and Cadence using it (how client is initialized). Leave links to the sample changes and the client repo. |
||
| ### Step-by-Step Process | ||
|
|
||
| 1. **Client connects to server**: The client initiates a connection to the server | ||
| 2. **Server presents its TLS certificate**: The server sends its certificate to prove its identity | ||
| 3. **Client verifies the server's certificate**: The client validates the server's certificate against trusted Certificate Authorities (CAs) | ||
| 4. **Client presents its TLS certificate**: The client sends its own certificate to prove its identity | ||
| 5. **Server verifies the client's certificate**: The server validates the client's certificate | ||
| 6. **Server grants access**: Once both certificates are verified, the server allows the connection | ||
| 7. **Client and server exchange information over encrypted TLS connection**: All data is now transmitted securely | ||
|
|
||
| --- | ||
|
|
||
| ## Complete Working Example | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe add another section of |
||
|
|
||
| For a complete working example with detailed code and configuration, refer to the [helloworld_tls sample](https://github.com/cadence-workflow/cadence-samples/tree/master/new_samples/client_samples/helloworld_tls) in the Cadence samples repository. This sample demonstrates how to: | ||
|
||
|
|
||
| - Generate test certificates using OpenSSL | ||
| - Configure both server and client for mTLS | ||
| - Implement a simple workflow with mTLS authentication | ||
| - Test the mTLS connection | ||
|
|
||
| --- | ||
|
|
||
| ## Testing Scenarios | ||
|
|
||
| The following table outlines various testing scenarios for mTLS configuration: | ||
|
|
||
| | Server | Client | Expected | Steps | | ||
| |--------|--------|----------|-------| | ||
| | Unsecured | Unsecured | Success | Server without TLS enabled; Client without TLS certs | | ||
| | Secured | Unsecured | Fail | Server with TLS enabled; Client without TLS certs | | ||
| | Unsecured | Secured | Fail | Server without TLS enabled; Client **with** TLS certs | | ||
| | Secured | Secured | Success | Mutual TLS: Server with TLS enabled; Client with TLS enabled | | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 good writing!