[PR #5491] Add internal Certificate Authority for peer TLS certificates #23163

Closed
opened 2026-08-05 06:06:52 -04:00 by saavagebueno · 0 comments
Owner

Original Pull Request: https://github.com/netbirdio/netbird/pull/5491

State: closed
Merged: No


Describe your changes

Adds a built-in Certificate Authority to NetBird that issues TLS certificates for peer hostnames, eliminating browser security warnings when accessing services over NetBird peer domains.

Management server:

  • Internal CA module with ECDSA P-256 root certificate generation, constrained to the account's DNS domain via x509 NameConstraints
  • Certificate signing via gRPC with CSR-based flow (peer private keys never leave the device)
  • CA initialization with configurable display name, organization, and validity period
  • CA rotation (creates new CA alongside existing one for graceful transition; old CA can be deactivated after distribution)
  • Certificate revocation by serial number
  • REST API and OpenAPI spec for CA management and issued certificates
  • Wildcard DNS record support for peers with wildcard certificates
  • Permission module for certificate authority operations
  • Certificate validity tied to peer login expiration
  • Integration tests wired into the black-box test server

Client:

  • netbird cert request — request a TLS certificate (supports --wildcard flag)
  • netbird cert status — show current certificate details
  • netbird cert trust-ca — install CA into OS trust store
  • netbird cert untrust-ca — remove CA from OS trust store
  • Certificate auto-renewal before expiry
  • CA distribution via management sync
  • Platform trust store integration (macOS, Linux, Windows)
  • Proto definitions for certificate daemon RPCs and gRPC signing

Account settings:

  • cert_wildcard_allowed setting to control whether peers can request wildcard certificates

Closes https://github.com/netbirdio/netbird/issues/5479

Stack

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)

By submitting this pull request, you confirm that you have read and agree to the terms of the Contributor License Agreement.

Documentation

Select exactly one:

  • I added/updated documentation for this change
  • Documentation is not needed for this change (explain why)

Docs PR URL (required if "docs added" is checked)

Paste the PR link from https://github.com/netbirdio/docs here:

https://github.com/netbirdio/docs/pull/643

Companion PRs:

Summary by CodeRabbit

  • New Features

    • Full certificate lifecycle: request/status/trust/untrust via CLI, automatic renewal, wildcard support, and OS CA trust on macOS/Linux/Windows.
    • CA management API/UI: initialize, rotate, deactivate CAs; list/revoke issued certificates; CA certs propagated to peers.
  • Tests

    • Extensive unit and integration tests covering certificate manager, CA manager, signers, gRPC/HTTP handlers, CLI and end-to-end flows.
  • Other

    • Per-peer rate limiting and activity events for certificate operations.
**Original Pull Request:** https://github.com/netbirdio/netbird/pull/5491 **State:** closed **Merged:** No --- ## Describe your changes Adds a built-in Certificate Authority to NetBird that issues TLS certificates for peer hostnames, eliminating browser security warnings when accessing services over NetBird peer domains. **Management server:** - Internal CA module with ECDSA P-256 root certificate generation, constrained to the account's DNS domain via x509 NameConstraints - Certificate signing via gRPC with CSR-based flow (peer private keys never leave the device) - CA initialization with configurable display name, organization, and validity period - CA rotation (creates new CA alongside existing one for graceful transition; old CA can be deactivated after distribution) - Certificate revocation by serial number - REST API and OpenAPI spec for CA management and issued certificates - Wildcard DNS record support for peers with wildcard certificates - Permission module for certificate authority operations - Certificate validity tied to peer login expiration - Integration tests wired into the black-box test server **Client:** - `netbird cert request` — request a TLS certificate (supports `--wildcard` flag) - `netbird cert status` — show current certificate details - `netbird cert trust-ca` — install CA into OS trust store - `netbird cert untrust-ca` — remove CA from OS trust store - Certificate auto-renewal before expiry - CA distribution via management sync - Platform trust store integration (macOS, Linux, Windows) - Proto definitions for certificate daemon RPCs and gRPC signing **Account settings:** - `cert_wildcard_allowed` setting to control whether peers can request wildcard certificates ## Issue ticket number and link Closes https://github.com/netbirdio/netbird/issues/5479 ## Stack <!-- branch-stack --> ### Checklist - [ ] Is it a bug fix - [ ] Is a typo/documentation fix - [x] Is a feature enhancement - [ ] It is a refactor - [ ] Created tests that fail without the change (if possible) > By submitting this pull request, you confirm that you have read and agree to the terms of the [Contributor License Agreement](https://github.com/netbirdio/netbird/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT.md). ## Documentation Select exactly one: - [x] I added/updated documentation for this change - [ ] Documentation is **not needed** for this change (explain why) ### Docs PR URL (required if "docs added" is checked) Paste the PR link from https://github.com/netbirdio/docs here: https://github.com/netbirdio/docs/pull/643 **Companion PRs:** - Dashboard UI: https://github.com/netbirdio/dashboard/pull/574 - Documentation: https://github.com/netbirdio/docs/pull/643 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Full certificate lifecycle: request/status/trust/untrust via CLI, automatic renewal, wildcard support, and OS CA trust on macOS/Linux/Windows. * CA management API/UI: initialize, rotate, deactivate CAs; list/revoke issued certificates; CA certs propagated to peers. * **Tests** * Extensive unit and integration tests covering certificate manager, CA manager, signers, gRPC/HTTP handlers, CLI and end-to-end flows. * **Other** * Per-peer rate limiting and activity events for certificate operations. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
saavagebueno added the pull-request label 2026-08-05 06:06:52 -04:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#23163