add core client cert validation#309
Merged
wojcik91 merged 27 commits intorelease/2.0from Apr 21, 2026
Merged
Conversation
moubctez
reviewed
Apr 16, 2026
There was a problem hiding this comment.
Pull request overview
Adds stricter mTLS enforcement for the Gateway gRPC server by validating Core’s client certificate chain against a configured CA and pinning the expected client certificate serial, including setup-time bundle validation and new mTLS-focused tests.
Changes:
- Require a complete TLS/mTLS configuration (server cert+key, CA cert, and Core client cert) before starting the gRPC server; add Core-client serial pinning interceptor.
- Extend setup flow to accept/validate a certificate bundle (CA + component cert + Core client cert), persist CA + Core client cert to disk, and load them on restart.
- Add end-to-end mTLS tests covering valid client, missing client cert, wrong-serial client cert, and rogue-CA client cert.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/gateway.rs | Enforces mTLS-only startup, configures server TLS with CA verification, and adds Core-client serial pinning; purge removes new cert artifacts too. |
| src/setup.rs | Validates CA-signed cert bundle from Core and persists CA + Core client cert for restart-time mTLS config. |
| src/main.rs | Loads the expanded TLS config set (cert/key/CA/core-client-cert) from disk and falls back to setup when absent. |
| src/lib.rs | Adds constants for new cert filenames and wires in the new test module. |
| src/tests/mtls.rs | New mTLS integration tests for acceptance/rejection scenarios. |
| src/tests/mock_wgapi.rs | Adds a minimal WireGuard API stub to support the new tests. |
| src/tests/mod.rs | Registers the new test modules. |
| Cargo.toml / Cargo.lock | Adds dependencies for TLS config + webpki validation and updates defguard git deps. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
moubctez
reviewed
Apr 21, 2026
t-aleksander
approved these changes
Apr 21, 2026
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
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.
Validate core cert when establishing gRPC connection.
Related DefGuard/defguard#2695
Needs: