[PR #6117] feat: add visibility field to reverse proxy services #24859

Open
opened 2026-08-05 06:09:14 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/6117
Author: @Mohithchowdary
Created: 5/9/2026
Status: 🔄 Open

Base: mainHead: feat/service-visibility


📝 Commits (5)

  • 3cee219 feat: add visibility field to reverse proxy services
  • c632d3a fix: address review feedback from CodeRabbit
  • 1c9a9eb fix: address second CodeRabbit review
  • f257f68 fix: return error from selfSignedTLSConfig instead of panicking
  • a42cd43 refactor: reduce cognitive complexity in shutdownServices and cleanupMappingRoutes

📊 Changes

10 files changed (+637 additions, -75 deletions)

View changed files

📝 management/internals/modules/reverseproxy/service/service.go (+25 -0)
📝 management/internals/modules/reverseproxy/service/service_test.go (+94 -0)
📝 management/server/types/account.go (+51 -0)
📝 management/server/types/account_components.go (+1 -0)
📝 management/server/types/account_test.go (+74 -0)
📝 proxy/server.go (+321 -75)
📝 shared/management/http/api/openapi.yml (+12 -0)
📝 shared/management/http/api/types.gen.go (+48 -0)
📝 shared/management/proto/proxy_service.pb.go (+9 -0)
📝 shared/management/proto/proxy_service.proto (+2 -0)

📄 Description

Summary

  • Adds a visibility field ("public" / "internal") to reverse proxy services
  • Public (default): service exposed on the internet via the existing public listener
  • Internal: service exposed only to WireGuard mesh peers via a per-account WireGuard-bound listener with self-signed TLS
  • Management server injects DNS CustomZone records so mesh peers resolve internal-service domains to the proxy peer's WG IP

Changes

Area What
Proto string visibility = 13 on ProxyMapping
OpenAPI visibility enum on Service + ServiceRequest
Data model Constants, struct field, FromAPIRequest/ToAPIResponse/ToProtoMapping/Validate
Proxy server internalRouter type, getOrCreateInternalRouter, visibility-aware setup*Mapping + cleanupMappingRoutes + shutdown
DNS Account.GetInternalServiceZones() injected into peer network maps

Test plan

  • Validate() accepts public/internal, defaults empty to public, rejects unknown values
  • FromAPIRequest/ToAPIResponse/ToProtoMapping roundtrip preserves visibility
  • GetInternalServiceZones produces correct zones for internal services, skips public/disabled/no-proxy cases
  • All existing proxy and management tests pass
  • Manual: create internal service, verify mesh peer DNS resolves to WG IP, verify HTTPS works through mesh

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Services can be marked "internal" to restrict reachability; proxy installs visibility-aware routing with per-account internal routers and internal HTTPS handling.
  • API Updates

    • Service API accepts and returns a visibility field ("public" or "internal", default "public"); OpenAPI and proto schemas updated.
  • Bug Fixes / Validation

    • Invalid visibility values rejected; empty visibility defaults to public; "internal" disallowed for L4 modes.
  • Tests

    • Added unit tests for visibility validation, API/proto mappings, internal routing and DNS zone behavior.

Review Change Stack


🔄 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/6117 **Author:** [@Mohithchowdary](https://github.com/Mohithchowdary) **Created:** 5/9/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feat/service-visibility` --- ### 📝 Commits (5) - [`3cee219`](https://github.com/netbirdio/netbird/commit/3cee219f3322f72f26cb28bc6d92d76e651a4985) feat: add visibility field to reverse proxy services - [`c632d3a`](https://github.com/netbirdio/netbird/commit/c632d3a8dc4c97e4a351637f70b7a6ee9fd43716) fix: address review feedback from CodeRabbit - [`1c9a9eb`](https://github.com/netbirdio/netbird/commit/1c9a9ebc5c3f119b76aecc16410c736f3cd45ebe) fix: address second CodeRabbit review - [`f257f68`](https://github.com/netbirdio/netbird/commit/f257f684793b8fcd695810a09c9689afe60da142) fix: return error from selfSignedTLSConfig instead of panicking - [`a42cd43`](https://github.com/netbirdio/netbird/commit/a42cd4367f58c5e1e5363e9680a80d30f4752cc4) refactor: reduce cognitive complexity in shutdownServices and cleanupMappingRoutes ### 📊 Changes **10 files changed** (+637 additions, -75 deletions) <details> <summary>View changed files</summary> 📝 `management/internals/modules/reverseproxy/service/service.go` (+25 -0) 📝 `management/internals/modules/reverseproxy/service/service_test.go` (+94 -0) 📝 `management/server/types/account.go` (+51 -0) 📝 `management/server/types/account_components.go` (+1 -0) 📝 `management/server/types/account_test.go` (+74 -0) 📝 `proxy/server.go` (+321 -75) 📝 `shared/management/http/api/openapi.yml` (+12 -0) 📝 `shared/management/http/api/types.gen.go` (+48 -0) 📝 `shared/management/proto/proxy_service.pb.go` (+9 -0) 📝 `shared/management/proto/proxy_service.proto` (+2 -0) </details> ### 📄 Description ## Summary - Adds a `visibility` field (`"public"` / `"internal"`) to reverse proxy services - **Public** (default): service exposed on the internet via the existing public listener - **Internal**: service exposed only to WireGuard mesh peers via a per-account WireGuard-bound listener with self-signed TLS - Management server injects DNS `CustomZone` records so mesh peers resolve internal-service domains to the proxy peer's WG IP ## Changes | Area | What | |------|------| | Proto | `string visibility = 13` on `ProxyMapping` | | OpenAPI | `visibility` enum on `Service` + `ServiceRequest` | | Data model | Constants, struct field, `FromAPIRequest`/`ToAPIResponse`/`ToProtoMapping`/`Validate` | | Proxy server | `internalRouter` type, `getOrCreateInternalRouter`, visibility-aware `setup*Mapping` + `cleanupMappingRoutes` + shutdown | | DNS | `Account.GetInternalServiceZones()` injected into peer network maps | ## Test plan - [x] `Validate()` accepts `public`/`internal`, defaults empty to `public`, rejects unknown values - [x] `FromAPIRequest`/`ToAPIResponse`/`ToProtoMapping` roundtrip preserves visibility - [x] `GetInternalServiceZones` produces correct zones for internal services, skips public/disabled/no-proxy cases - [x] All existing proxy and management tests pass - [ ] Manual: create internal service, verify mesh peer DNS resolves to WG IP, verify HTTPS works through mesh 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Services can be marked "internal" to restrict reachability; proxy installs visibility-aware routing with per-account internal routers and internal HTTPS handling. * **API Updates** * Service API accepts and returns a visibility field ("public" or "internal", default "public"); OpenAPI and proto schemas updated. * **Bug Fixes / Validation** * Invalid visibility values rejected; empty visibility defaults to public; "internal" disallowed for L4 modes. * **Tests** * Added unit tests for visibility validation, API/proto mappings, internal routing and DNS zone behavior. [![Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/netbirdio/netbird/pull/6117) <!-- 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 06:09:14 -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#24859