[PR #5986] feat: add MDM managed app configuration support for Android and iOS #27245

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

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/5986
Author: @dbrieck
Created: 4/24/2026
Status: 🔄 Open

Base: mainHead: feat/mdm-managed-config


📝 Commits (4)

  • 5d8c87a feat: add MDM managed app configuration support for Android and iOS
  • f216e7a fix: address CodeRabbit review feedback on MDM managed config
  • b517419 fix: add GetManagementURL getter and pass mgmt URL to NewAuth
  • 5b92c09 test: add iOS managed config tests to match Android parity

📊 Changes

6 files changed (+847 additions, -0 deletions)

View changed files

📝 client/android/login.go (+6 -0)
client/android/managed_config.go (+195 -0)
client/android/managed_config_test.go (+218 -0)
📝 client/ios/NetBirdSDK/login.go (+6 -0)
client/ios/NetBirdSDK/managed_config.go (+199 -0)
client/ios/NetBirdSDK/managed_config_test.go (+223 -0)

📄 Description

Summary

Add MDM (Mobile Device Management) managed app configuration support to the Go SDK, enabling Android and iOS native apps to receive and apply configuration from enterprise MDM solutions (Intune, Google Workspace, Jamf, etc.).

Fixes #1918

Changes

Go SDK - Android (client/android/)

  • managed_config.go — New ManagedConfig struct with gomobile-compatible setter API for 7 MDM keys: managementUrl, setupKey, adminUrl, preSharedKey, rosenpassEnabled, rosenpassPermissive, disableAutoConnect
  • managed_config_test.go — Unit tests covering setters, Apply(), config override, key constants
  • login.go — Added LoginWithSetupKeySync() for silent setup key registration from MDM

Go SDK - iOS (client/ios/NetBirdSDK/)

  • managed_config.go — iOS variant using DirectUpdateOrCreateConfig() for tvOS sandbox compatibility
  • login.go — Added LoginWithSetupKeySync() matching Android API

How It Works

  1. Native app reads MDM config (Android: RestrictionsManager, iOS: UserDefaults managed domain)
  2. Populates ManagedConfig via setter methods (gomobile-compatible)
  3. Calls Apply(configPath) to write values to NetBird client config
  4. Optionally calls LoginWithSetupKeySync() for zero-touch enrollment

MDM values are authoritative — they override any existing user configuration on every app launch.

Companion PRs

  • android-client: netbirdio/android-client — Android Enterprise integration (app_restrictions.xml, ManagedConfigReader, EngineRunner integration)
  • ios-client: netbirdio/ios-client — Apple Managed App Configuration integration (ManagedConfigReader.swift, NetworkExtensionAdapter/PacketTunnelProvider integration)

Summary by CodeRabbit

  • New Features

    • Added synchronous login entry points for Android and iOS.
    • Added managed configuration support for Android Enterprise and iOS AppConfig: management URL, setup key, admin URL, pre-shared key, Rosenpass flags, and disable-auto-connect, with Apply persistence behavior.
  • Tests

    • Added comprehensive tests validating managed-config state, persistence behavior, and non-persistence of setup keys.

🔄 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/5986 **Author:** [@dbrieck](https://github.com/dbrieck) **Created:** 4/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feat/mdm-managed-config` --- ### 📝 Commits (4) - [`5d8c87a`](https://github.com/netbirdio/netbird/commit/5d8c87af41b7ac036c237989d421d8d4eab0a93d) feat: add MDM managed app configuration support for Android and iOS - [`f216e7a`](https://github.com/netbirdio/netbird/commit/f216e7acee9fae8d64b200b1b8755784ebca71ab) fix: address CodeRabbit review feedback on MDM managed config - [`b517419`](https://github.com/netbirdio/netbird/commit/b517419b1490765d1cb2dcf100ddb88511d887b0) fix: add GetManagementURL getter and pass mgmt URL to NewAuth - [`5b92c09`](https://github.com/netbirdio/netbird/commit/5b92c098ff7e9bd2698fba8f2db4d1d8439f4399) test: add iOS managed config tests to match Android parity ### 📊 Changes **6 files changed** (+847 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `client/android/login.go` (+6 -0) ➕ `client/android/managed_config.go` (+195 -0) ➕ `client/android/managed_config_test.go` (+218 -0) 📝 `client/ios/NetBirdSDK/login.go` (+6 -0) ➕ `client/ios/NetBirdSDK/managed_config.go` (+199 -0) ➕ `client/ios/NetBirdSDK/managed_config_test.go` (+223 -0) </details> ### 📄 Description ## Summary Add MDM (Mobile Device Management) managed app configuration support to the Go SDK, enabling Android and iOS native apps to receive and apply configuration from enterprise MDM solutions (Intune, Google Workspace, Jamf, etc.). Fixes #1918 ## Changes ### Go SDK - Android (`client/android/`) - **`managed_config.go`** — New `ManagedConfig` struct with gomobile-compatible setter API for 7 MDM keys: `managementUrl`, `setupKey`, `adminUrl`, `preSharedKey`, `rosenpassEnabled`, `rosenpassPermissive`, `disableAutoConnect` - **`managed_config_test.go`** — Unit tests covering setters, Apply(), config override, key constants - **`login.go`** — Added `LoginWithSetupKeySync()` for silent setup key registration from MDM ### Go SDK - iOS (`client/ios/NetBirdSDK/`) - **`managed_config.go`** — iOS variant using `DirectUpdateOrCreateConfig()` for tvOS sandbox compatibility - **`login.go`** — Added `LoginWithSetupKeySync()` matching Android API ## How It Works 1. Native app reads MDM config (Android: `RestrictionsManager`, iOS: `UserDefaults` managed domain) 2. Populates `ManagedConfig` via setter methods (gomobile-compatible) 3. Calls `Apply(configPath)` to write values to NetBird client config 4. Optionally calls `LoginWithSetupKeySync()` for zero-touch enrollment MDM values are authoritative — they override any existing user configuration on every app launch. ## Companion PRs - **android-client**: netbirdio/android-client — Android Enterprise integration (app_restrictions.xml, ManagedConfigReader, EngineRunner integration) - **ios-client**: netbirdio/ios-client — Apple Managed App Configuration integration (ManagedConfigReader.swift, NetworkExtensionAdapter/PacketTunnelProvider integration) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added synchronous login entry points for Android and iOS. * Added managed configuration support for Android Enterprise and iOS AppConfig: management URL, setup key, admin URL, pre-shared key, Rosenpass flags, and disable-auto-connect, with Apply persistence behavior. * **Tests** * Added comprehensive tests validating managed-config state, persistence behavior, and non-persistence of setup keys. <!-- 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:26 -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#27245