[PR #6782] [MERGED] [client] checks/enforce MDM disableAutostart on every GUI launch, not just fresh installs #29888

Closed
opened 2026-08-05 08:09:19 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/6782
Author: @riccardomanfrin
Created: 7/15/2026
Status: Merged
Merged: 7/22/2026
Merged by: @riccardomanfrin

Base: mainHead: mdm_auto_start_flag_updates


📝 Commits (2)

  • bc4b413 Allow post install and post user config MDM autostart disablement enforcement
  • 2aadc3b Aligns netbird repo MDM templates

📊 Changes

8 files changed (+40 additions, -4 deletions)

View changed files

📝 client/ui/autostart_default.go (+17 -3)
📝 client/ui/services/autostart.go (+1 -1)
📝 docs/io.netbird.client.plist (+3 -0)
📝 docs/netbird-macos.mobileconfig (+2 -0)
📝 docs/netbird-macos.sh (+2 -0)
📝 docs/netbird-policy.reg (+0 -0)
📝 docs/netbird.adml (+3 -0)
📝 docs/netbird.admx (+12 -0)

📄 Description

Describe your changes

applyAutostartDefault gated all MDM enforcement behind the one-time
AutostartInitialized marker, so MDM disableAutostart only affected
fresh installs — a policy pushed after autostart had been enabled could not
revoke the OS login-item.

The PR adds follow-up MDM enforcements at the top of
the function: if at any time MDM sets disableAutostart=true and the OS registration is
present, force SetEnabled(false) to align it.

Trade-off: once the admin lifts the policy, autostart stays off until the user re-toggles
in Settings — consistent with "MDM always wins" behavior of the other
managed keys.

Follow-up to PR https://github.com/netbirdio/netbird/pull/6738 (introduced
the disableAutostart MDM key with fresh-install-only semantics).

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

Summary by CodeRabbit

  • New Features

    • Added an administrative policy to disable client autostart (“Disable Autostart”).
    • Added support for configuring this policy via macOS MDM, Windows Group Policy (ADMX/ADML), and registry settings.
    • When enforced, the client prevents new autostart registration on fresh installs and removes existing autostart on the next GUI launch, keeping it disabled until the policy is lifted.
  • Bug Fixes

    • Improved enforcement logic for managed autostart defaults so policy state is applied consistently during startup and first-run setup.

🔄 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/6782 **Author:** [@riccardomanfrin](https://github.com/riccardomanfrin) **Created:** 7/15/2026 **Status:** ✅ Merged **Merged:** 7/22/2026 **Merged by:** [@riccardomanfrin](https://github.com/riccardomanfrin) **Base:** `main` ← **Head:** `mdm_auto_start_flag_updates` --- ### 📝 Commits (2) - [`bc4b413`](https://github.com/netbirdio/netbird/commit/bc4b413907487c340365c7611b6a2bd19fda1c97) Allow post install and post user config MDM autostart disablement enforcement - [`2aadc3b`](https://github.com/netbirdio/netbird/commit/2aadc3bb2db26cd44ef7e93603261137e1fc7fae) Aligns netbird repo MDM templates ### 📊 Changes **8 files changed** (+40 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `client/ui/autostart_default.go` (+17 -3) 📝 `client/ui/services/autostart.go` (+1 -1) 📝 `docs/io.netbird.client.plist` (+3 -0) 📝 `docs/netbird-macos.mobileconfig` (+2 -0) 📝 `docs/netbird-macos.sh` (+2 -0) 📝 `docs/netbird-policy.reg` (+0 -0) 📝 `docs/netbird.adml` (+3 -0) 📝 `docs/netbird.admx` (+12 -0) </details> ### 📄 Description ## Describe your changes `applyAutostartDefault` gated all MDM enforcement behind the one-time `AutostartInitialized` marker, so MDM `disableAutostart` only affected fresh installs — a policy pushed after autostart had been enabled could not revoke the OS login-item. The PR adds follow-up MDM enforcements at the top of the function: if at any time MDM sets `disableAutostart=true` and the OS registration is present, force `SetEnabled(false)` to align it. Trade-off: once the admin lifts the policy, autostart stays off until the user re-toggles in Settings — consistent with "MDM always wins" behavior of the other managed keys. ## Issue ticket number and link Follow-up to PR https://github.com/netbirdio/netbird/pull/6738 (introduced the `disableAutostart` MDM key with fresh-install-only semantics). ## Stack <!-- branch-stack --> ### Checklist - [x] 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](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/855> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added an administrative policy to disable client autostart (“Disable Autostart”). - Added support for configuring this policy via macOS MDM, Windows Group Policy (ADMX/ADML), and registry settings. - When enforced, the client prevents new autostart registration on fresh installs and removes existing autostart on the next GUI launch, keeping it disabled until the policy is lifted. - **Bug Fixes** - Improved enforcement logic for managed autostart defaults so policy state is applied consistently during startup and first-run setup. <!-- 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 08:09:19 -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#29888