[PR #5216] [CLOSED] [server] Add an option to disable cert verification for external client requests #25275

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

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/5216
Author: @anudeepND
Created: 1/30/2026
Status: Closed

Base: mainHead: disable-cert-verification


📝 Commits (4)

  • 71ba6b2 util.NewTransport and util.NewHTTPClient for http config
  • 02444d7 Update modules.go
  • 9f0cbe0 update manager.go to use NewTransport
  • fb4342e use util.NewHTTPClient http reqs

📊 Changes

22 files changed (+120 additions, -51 deletions)

View changed files

📝 management/cmd/management.go (+1 -2)
📝 management/internals/server/modules.go (+9 -1)
📝 management/server/geolocation/database.go (+9 -6)
📝 management/server/geolocation/geolocation.go (+8 -7)
📝 management/server/geolocation/utils.go (+4 -4)
📝 management/server/http/handlers/policies/geolocation_handler_test.go (+1 -1)
📝 management/server/identity_provider.go (+3 -3)
📝 management/server/idp/auth0.go (+15 -6)
📝 management/server/idp/authentik.go (+3 -2)
📝 management/server/idp/azure.go (+4 -3)
📝 management/server/idp/dex.go (+2 -1)
📝 management/server/idp/google_workspace.go (+3 -2)
📝 management/server/idp/jumpcloud.go (+2 -1)
📝 management/server/idp/keycloak.go (+3 -2)
📝 management/server/idp/okta.go (+2 -1)
📝 management/server/idp/pocketid.go (+3 -2)
📝 management/server/idp/zitadel.go (+3 -2)
📝 management/server/instance/manager.go (+3 -1)
📝 shared/auth/jwt/validator.go (+2 -2)
📝 shared/management/client/rest/client.go (+2 -1)

...and 2 more files

📄 Description

Describe your changes

This PR creates a central HTTP client with an option to disable SSL cert validation when making external requests (for example, downloading GeoIP database, check release versions) when NB_DISABLE_CERT_VALIDATION env variable is set to true.

This is useful for self-hosted environments using internal CAs or self-signed certificates which is common when using firewalls that intercepts all the traffic.

Changes:

  1. Created util.NewTransport() and util.NewHTTPClient() to standardize HTTP transport configuration
  2. If NB_DISABLE_CERT_VALIDATION=true, the transport is configured with InsecureSkipVerify: true which will disable certificate validation
  3. If it is set to false which is by default, secure transport is used just like previous versions
  4. The new config is used in GeoIP download logic, OIDC requests, version check and IDP managers

Fixes https://github.com/netbirdio/netbird/issues/5200

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

Summary by CodeRabbit

  • Infrastructure Improvements
    • Standardized HTTP client usage across the platform for more consistent and resilient network calls.
    • Added configurable transport behavior (including optional certificate-validation bypass via environment variable) for specialized deployments.
    • Improved HTTP resource handling to ensure responses are properly closed and connections are managed.

✏️ Tip: You can customize this high-level summary in your review settings.


🔄 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/5216 **Author:** [@anudeepND](https://github.com/anudeepND) **Created:** 1/30/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `disable-cert-verification` --- ### 📝 Commits (4) - [`71ba6b2`](https://github.com/netbirdio/netbird/commit/71ba6b28d6c06496bd633b38a5e0b1679c8ba5e5) util.NewTransport and util.NewHTTPClient for http config - [`02444d7`](https://github.com/netbirdio/netbird/commit/02444d7f69dc9db3ba9c92f4e05d80da349a87c2) Update modules.go - [`9f0cbe0`](https://github.com/netbirdio/netbird/commit/9f0cbe001da71c1550d59f3313942952c5c88205) update manager.go to use NewTransport - [`fb4342e`](https://github.com/netbirdio/netbird/commit/fb4342e289c520469b8694d17bdeceb89c58b59f) use util.NewHTTPClient http reqs ### 📊 Changes **22 files changed** (+120 additions, -51 deletions) <details> <summary>View changed files</summary> 📝 `management/cmd/management.go` (+1 -2) 📝 `management/internals/server/modules.go` (+9 -1) 📝 `management/server/geolocation/database.go` (+9 -6) 📝 `management/server/geolocation/geolocation.go` (+8 -7) 📝 `management/server/geolocation/utils.go` (+4 -4) 📝 `management/server/http/handlers/policies/geolocation_handler_test.go` (+1 -1) 📝 `management/server/identity_provider.go` (+3 -3) 📝 `management/server/idp/auth0.go` (+15 -6) 📝 `management/server/idp/authentik.go` (+3 -2) 📝 `management/server/idp/azure.go` (+4 -3) 📝 `management/server/idp/dex.go` (+2 -1) 📝 `management/server/idp/google_workspace.go` (+3 -2) 📝 `management/server/idp/jumpcloud.go` (+2 -1) 📝 `management/server/idp/keycloak.go` (+3 -2) 📝 `management/server/idp/okta.go` (+2 -1) 📝 `management/server/idp/pocketid.go` (+3 -2) 📝 `management/server/idp/zitadel.go` (+3 -2) 📝 `management/server/instance/manager.go` (+3 -1) 📝 `shared/auth/jwt/validator.go` (+2 -2) 📝 `shared/management/client/rest/client.go` (+2 -1) _...and 2 more files_ </details> ### 📄 Description ## Describe your changes This PR creates a central HTTP client with an option to disable SSL cert validation when making external requests (for example, downloading GeoIP database, check release versions) when `NB_DISABLE_CERT_VALIDATION` env variable is set to `true`. This is useful for self-hosted environments using internal CAs or self-signed certificates which is common when using firewalls that intercepts all the traffic. Changes: 1. Created `util.NewTransport()` and `util.NewHTTPClient()` to standardize HTTP transport configuration 2. If `NB_DISABLE_CERT_VALIDATION=true`, the transport is configured with `InsecureSkipVerify: true` which will disable certificate validation 3. If it is set to false which is by default, secure transport is used just like previous versions 4. The new config is used in GeoIP download logic, OIDC requests, version check and IDP managers ## Issue ticket number and link Fixes https://github.com/netbirdio/netbird/issues/5200 ## Stack <!-- branch-stack --> ### Checklist - [ ] Is it a bug fix - [ ] Is a typo/documentation fix - [ ] Is a feature enhancement - [x] 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/582 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Infrastructure Improvements** * Standardized HTTP client usage across the platform for more consistent and resilient network calls. * Added configurable transport behavior (including optional certificate-validation bypass via environment variable) for specialized deployments. * Improved HTTP resource handling to ensure responses are properly closed and connections are managed. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- 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:05: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#25275