[PR #1510] [MERGED] Extract peer real IP from Load Balancer when possible #15489

Closed
opened 2026-08-05 03:07:47 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/1510
Author: @surik
Created: 1/30/2024
Status: Merged
Merged: 1/31/2024
Merged by: @surik

Base: mainHead: yury/realip


📝 Commits (7)

  • bcf87fb Extract peer real IP from Load Balancer when possible
  • 246d70c Address review comment
  • 41b31dc Simplify getRealIP function
  • f42af6c Use realip middleware
  • 6671f06 Make trusted proxies configurable
  • 35d734a Specify default trusted ip 127.0.0.1/32 when nothing provided
  • 974efa7 Use 0.0.0.0/0 as default

📊 Changes

5 files changed (+39 additions, -14 deletions)

View changed files

📝 go.mod (+2 -1)
📝 go.sum (+4 -1)
📝 management/cmd/management.go (+17 -1)
📝 management/server/config.go (+3 -0)
📝 management/server/grpcserver.go (+13 -11)

📄 Description

Otherwise, get it from the GRPC peer address.

This PR extends management config with a new TrustedHTTPProxies option that accepts a list of network prefixes ex: "192.168.1.1/32", "10.0.0.0/16" that is used for evaluation of client real ip according to https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For#selecting_an_ip_address

Describe your changes

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)
  • Extended the README / documentation, if necessary

🔄 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/1510 **Author:** [@surik](https://github.com/surik) **Created:** 1/30/2024 **Status:** ✅ Merged **Merged:** 1/31/2024 **Merged by:** [@surik](https://github.com/surik) **Base:** `main` ← **Head:** `yury/realip` --- ### 📝 Commits (7) - [`bcf87fb`](https://github.com/netbirdio/netbird/commit/bcf87fb1647907cc856189b017a5f8501a8f30cd) Extract peer real IP from Load Balancer when possible - [`246d70c`](https://github.com/netbirdio/netbird/commit/246d70c019488180992dc167002a12dd23e5fcc3) Address review comment - [`41b31dc`](https://github.com/netbirdio/netbird/commit/41b31dc8c5df23a8c257954e025ea0a52ca6948f) Simplify getRealIP function - [`f42af6c`](https://github.com/netbirdio/netbird/commit/f42af6ca3bbf734fa94bc0660678e934d589dac3) Use realip middleware - [`6671f06`](https://github.com/netbirdio/netbird/commit/6671f065938a8d165ee415fe5eb9a14973dcb171) Make trusted proxies configurable - [`35d734a`](https://github.com/netbirdio/netbird/commit/35d734ad89cec72160832457a72dc6b79325683d) Specify default trusted ip 127.0.0.1/32 when nothing provided - [`974efa7`](https://github.com/netbirdio/netbird/commit/974efa7c9c87d7733951e34ed4b7aaccc4872fc5) Use 0.0.0.0/0 as default ### 📊 Changes **5 files changed** (+39 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `go.mod` (+2 -1) 📝 `go.sum` (+4 -1) 📝 `management/cmd/management.go` (+17 -1) 📝 `management/server/config.go` (+3 -0) 📝 `management/server/grpcserver.go` (+13 -11) </details> ### 📄 Description Otherwise, get it from the GRPC peer address. This PR extends management config with a new `TrustedHTTPProxies` option that accepts a list of network prefixes ex: `"192.168.1.1/32", "10.0.0.0/16"` that is used for evaluation of client real ip according to https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For#selecting_an_ip_address ## Describe your changes ## Issue ticket number and link ### 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) - [ ] Extended the README / documentation, if necessary --- <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 03:07:47 -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#15489