[PR #6048] [proxy] Add mTLS auth support for reverse proxy services #27410

Open
opened 2026-08-05 07:08:41 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/6048
Author: @marcschwaiger
Created: 5/1/2026
Status: 🔄 Open

Base: mainHead: feature/mtls-auth


📝 Commits (6)

  • d07e00e Add mTLS auth support for reverse proxy services
  • 4312a92 Fix mTLS review follow-ups
  • 443a090 Refactor auth domain registration options
  • 4e1f2e0 Tighten mTLS TLS selection and test stability
  • a4eda77 Clarify no-auth middleware comment
  • 6a0bfe2 Accept commented mTLS CA PEM bundles

📊 Changes

15 files changed (+1648 additions, -471 deletions)

View changed files

📝 management/internals/modules/reverseproxy/service/manager/manager.go (+6 -0)
📝 management/internals/modules/reverseproxy/service/manager/manager_test.go (+24 -0)
📝 management/internals/modules/reverseproxy/service/service.go (+101 -1)
📝 management/internals/modules/reverseproxy/service/service_test.go (+144 -0)
📝 proxy/auth/auth.go (+1 -0)
📝 proxy/internal/auth/middleware.go (+66 -26)
📝 proxy/internal/auth/middleware_test.go (+536 -39)
proxy/internal/auth/mtls.go (+106 -0)
📝 proxy/management_integration_test.go (+4 -9)
📝 proxy/server.go (+35 -1)
📝 proxy/server_test.go (+114 -0)
📝 shared/management/http/api/openapi.yml (+26 -0)
📝 shared/management/http/api/types.gen.go (+10 -0)
📝 shared/management/proto/proxy_service.pb.go (+470 -395)
📝 shared/management/proto/proxy_service.proto (+5 -0)

📄 Description

Describe your changes

Add mTLS authentication for reverse proxy services

https://github.com/netbirdio/netbird/issues/5364 mTLS Auth for Proxy Services

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/720

See also: Dashboard PR URL

https://github.com/netbirdio/dashboard/pull/628

Summary by CodeRabbit

  • New Features

    • Per-domain mutual TLS (mTLS) support with configurable client CA pools and server TLS behavior.
    • Service configuration, API, and proto now accept mTLS auth settings.
  • Bug Fixes

    • Preserve existing mTLS CA certificate when updating a service without providing a new CA PEM.
  • Tests

    • Added extensive mTLS unit/integration tests covering validation, middleware, and TLS configuration.
  • Documentation

    • OpenAPI/types updated to expose mtls_auth fields.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbirdio/netbird/pull/6048 **Author:** [@marcschwaiger](https://github.com/marcschwaiger) **Created:** 5/1/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feature/mtls-auth` --- ### 📝 Commits (6) - [`d07e00e`](https://github.com/netbirdio/netbird/commit/d07e00e37bcfe593bbbfbcaf048cddb6df7d05c5) Add mTLS auth support for reverse proxy services - [`4312a92`](https://github.com/netbirdio/netbird/commit/4312a928ee226572516c5b92de7b02aed813ffe3) Fix mTLS review follow-ups - [`443a090`](https://github.com/netbirdio/netbird/commit/443a090cba79e795236bbce3f45dafae50782576) Refactor auth domain registration options - [`4e1f2e0`](https://github.com/netbirdio/netbird/commit/4e1f2e0b66094b41562230e1172fc4e65e3b614c) Tighten mTLS TLS selection and test stability - [`a4eda77`](https://github.com/netbirdio/netbird/commit/a4eda7766904afdb824b0f1a61c0c990036edc79) Clarify no-auth middleware comment - [`6a0bfe2`](https://github.com/netbirdio/netbird/commit/6a0bfe2b6fe66f80f199020007048f55cd3cfbd9) Accept commented mTLS CA PEM bundles ### 📊 Changes **15 files changed** (+1648 additions, -471 deletions) <details> <summary>View changed files</summary> 📝 `management/internals/modules/reverseproxy/service/manager/manager.go` (+6 -0) 📝 `management/internals/modules/reverseproxy/service/manager/manager_test.go` (+24 -0) 📝 `management/internals/modules/reverseproxy/service/service.go` (+101 -1) 📝 `management/internals/modules/reverseproxy/service/service_test.go` (+144 -0) 📝 `proxy/auth/auth.go` (+1 -0) 📝 `proxy/internal/auth/middleware.go` (+66 -26) 📝 `proxy/internal/auth/middleware_test.go` (+536 -39) ➕ `proxy/internal/auth/mtls.go` (+106 -0) 📝 `proxy/management_integration_test.go` (+4 -9) 📝 `proxy/server.go` (+35 -1) 📝 `proxy/server_test.go` (+114 -0) 📝 `shared/management/http/api/openapi.yml` (+26 -0) 📝 `shared/management/http/api/types.gen.go` (+10 -0) 📝 `shared/management/proto/proxy_service.pb.go` (+470 -395) 📝 `shared/management/proto/proxy_service.proto` (+5 -0) </details> ### 📄 Description ## Describe your changes Add mTLS authentication for reverse proxy services ## Issue ticket number and link https://github.com/netbirdio/netbird/issues/5364 mTLS Auth for Proxy Services ## Stack <!-- branch-stack --> ### Checklist - [ ] Is it a bug fix - [ ] Is a typo/documentation fix - [x] Is a feature enhancement - [ ] It is a refactor - [x] 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/720 ### See also: Dashboard PR URL https://github.com/netbirdio/dashboard/pull/628 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Per-domain mutual TLS (mTLS) support with configurable client CA pools and server TLS behavior. * Service configuration, API, and proto now accept mTLS auth settings. * **Bug Fixes** * Preserve existing mTLS CA certificate when updating a service without providing a new CA PEM. * **Tests** * Added extensive mTLS unit/integration tests covering validation, middleware, and TLS configuration. * **Documentation** * OpenAPI/types updated to expose mtls_auth fields. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
saavagebueno added the pull-request label 2026-08-05 07:08:41 -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#27410