-
Notifications
You must be signed in to change notification settings - Fork 67
feat(client): mTLS support [2b/2] #715
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
Merged
flotter
merged 2 commits into
canonical:master
from
flotter:feature/mtls-integration-client
Oct 22, 2025
Merged
feat(client): mTLS support [2b/2] #715
flotter
merged 2 commits into
canonical:master
from
flotter:feature/mtls-integration-client
Oct 22, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
Note that @ghislainbourgeois reviewed #708 which included the client code here. The client code was broken out just to make the PRs a little smaller. |
benhoyt
approved these changes
Oct 22, 2025
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.
Thanks for this. Reviewed previously, but just one minor comment.
flotter
added a commit
that referenced
this pull request
Oct 22, 2025
The daemon HTTPS server (when enabled) uses TLS v1.3 for the client server handshake. The traditional TLS handshake does not provide us with a way to exchange identity certificates between client and server, since only the server certificate is sent to the client. This leaves the current TLS connection relying on basic authentication headers for passing a client identity to the server. This patch migrates the HTTPS server over from basic authentication to using mutual TLS. The client (see #715) now has to supply a suitable client identity certificate that will be used for verifying the identity during normal API usage, although this requirement is **not enforced for end-points with open access**. In #702 we added a pairing manager, which integrates with the daemon API permissions system to facilitate client server pairing during a carefully controlled pairing window on a dedicated API end-point ```v1/pairing``` **only**. A followup task will provide an official event binding mechanism (trigger manager) by which the pairing window can be enabled when certain events are configured. For now, this cannot be enabled and therefore pairing is not possible. The the patch below hooking in the pairing window enable for testing purposes. ## State of HTTPS (mTLS) after this patch - When Pebble enables the HTTPS server only mTLS connections will be allowed (basic authorization is no longer available on the HTTPS transport, but can still be used with HTTP) - The Pebble client package adds (see #715): - The ability to supply the client identity certificate, but this is not yet used by the CLI and therefore Pebble cannot use HTTPS today. - The ability to obtain the server identity certificate by making an insecure HTTPS connection. Can be used to implement an SSH-like workflow to implement a CLI warning asking the user to trust the server identity for future connections. - The ability to pair with the server by supplying the server identity fingerprint. This workflow requires obtaining the fingerprint by other means, such as DNSSD or via a display on the server side. - The Pairing Manager provides the EnablePairing method, but this is not yet available, and requires future work to support binding events to actions such as pairing enable. ## Testing The following test procedure can offer a demonstration how this works, but the process requires a small temporary patch to enable pairing: 1. Apply the following patch as a temporary step to enable the pairing on startup. ```diff diff --git a/internals/overlord/pairingstate/manager.go b/internals/overlord/pairingstate/manager.go index 833b979..c933ef9 100644 --- a/internals/overlord/pairingstate/manager.go +++ b/internals/overlord/pairingstate/manager.go @@ -131,6 +131,12 @@ func (m *PairingManager) Stop() { m.stopTimer() } +// TESTING HACK: Open the pairing window on startup. +func (m *PairingManager) StartUp() error { + fmt.Printf("Pairing Enabled ...") + return m.EnablePairing(60 * time.Second) +} + // PairMTLS adds a client identity with admin permissions to the identity // subsystem. A pairing request always closes the pairing window. func (m *PairingManager) PairMTLS(clientCert *x509.Certificate) error { ``` 2. Generate the client private key and certificate ```sh ~/> openssl genpkey -algorithm ed25519 -out client-key.pem ~/> openssl req -x509 -new -nodes -key client-key.pem -days 365 -out client-cert.pem -subj "/O=Test/CN=client" -addext "keyUsage=critical,digitalSignature" -addext "extendedKeyUsage=clientAuth" -addext "basicConstraints=critical,CA:FALSE" ``` 3. Build pebble, run: ```sh ~/pebble> go build ./cmd/pebble ~/pebble> mkdir layers ~/pebble> echo -e "pairing:\n mode: multiple" > layers/001-default.yaml ~/pebble> PEBBLE=$(pwd) ./pebble run --create-dirs --https=:8443 ``` 4. Test HTTPS (within the first 60 seconds of starting pebble): ```sh # Not yet paired. ~/> curl -X GET --cert ./client-cert.pem --key ./client-key.pem --insecure https://localhost:8443/v1/plan?format=yaml {"type":"error","status-code":401,"status":"Unauthorized","result":{"message":"access denied","kind":"login-required"}} # Pair during open pairing window (will close window). ~/> curl -X POST -H "Content-Type: application/json" -d '{"action": "pair"}' --cert ./client-cert.pem --key ./client-key.pem --insecure https://localhost:8443/v1/pairing {"type":"sync","status-code":200,"status":"OK"} # Test HTTPS with mTLS enabled. ~/> curl -X GET --cert ./client-cert.pem --key ./client-key.pem --insecure https://localhost:8443/v1/plan?format=yaml {"type":"sync","status-code":200,"status":"OK","result":"pairing:\n mode: multiple\n"} ```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The client side mTLS code was split from #708.
For the complete description of the work, please refer to the description in #708.
Pebble client changes adds: