mirror of
https://github.com/fleetdm/fleet
synced 2026-04-21 13:37:30 +00:00
Add 'Disable Wi-Fi auto-join' macOS script to scripts library (#39813)
## Summary Adds a new pre-baked script to the [fleetdm.com/scripts](https://fleetdm.com/scripts) library: **Disable Wi-Fi auto-join** for macOS. ## Changes - Added a new entry to `docs/scripts.yml` in the macOS section - The script disables auto-join for a specified Wi-Fi SSID using `networksetup` and `PlistBuddy`/`defaults write` - Based on [Alan Siu's approach](https://www.alansiu.net/2026/01/22/scripting-disabling-auto-join-for-wi-fi-networks/) ## How to test 1. Build the website static content and verify the new script appears on the /scripts page 2. Verify the script slug doesn't collide with existing scripts --- Built for [mikermcneil](https://fleetdm.slack.com/archives/D0AFASLRHNU/p1770980976219219?thread_ts=1770980373.078179&cid=D0AFASLRHNU) by [Kilo for Slack](https://kilo.ai/features/slack-integration) --------- Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com> Co-authored-by: Brock Walters <153771548+nonpunctual@users.noreply.github.com>
This commit is contained in:
parent
5136d40e27
commit
6b3809fb7b
1 changed files with 15 additions and 0 deletions
|
|
@ -594,6 +594,21 @@
|
|||
bash -c "bash $0 remove >/dev/null 2>/dev/null </dev/null &"
|
||||
fi
|
||||
|
||||
- name: Disable Wi-Fi auto-join
|
||||
platform: macos
|
||||
description: Disables auto-join for a specified Wi-Fi network (SSID). Update the SSID variable to match the target network name.
|
||||
script: |
|
||||
#!/bin/bash
|
||||
|
||||
# Disable Wi-Fi auto-join for a specified SSID (ie, the network name string on a Mac)
|
||||
# Based on Alan Siu's approach: https://www.alansiu.net/2026/01/22/scripting-disabling-auto-join-for-wi-fi-networks/
|
||||
|
||||
/usr/sbin/ipconfig setverbose 1
|
||||
ntwknm="$(/usr/sbin/ipconfig getsummary "$(/usr/sbin/scutil --nwi | /usr/bin/awk '/Network interfaces:/{print $NF}')" | /usr/bin/awk -v ORS="," -F ' : ' '!/<dictionary>/&&!/<array>/&&!/}/{gsub("^[[:space:]]*","",$0);print "\x22"$1"\x22"":""\x22"$2"\x22"}' | /usr/bin/sed 's/^/{/;s/,$/}/' | /usr/bin/jq -r '.SSID')"
|
||||
/usr/sbin/ipconfig setverbose 0
|
||||
|
||||
/usr/bin/defaults write /Library/Preferences/com.apple.wifi.known-networks wifi.network.ssid."$ntwknm" -dict-add AutoJoinDisabled -bool TRUE
|
||||
|
||||
#
|
||||
# ╦ ╦╦╔╗╔╔╦╗╔═╗╦ ╦╔═╗
|
||||
# ║║║║║║║ ║║║ ║║║║╚═╗
|
||||
|
|
|
|||
Loading…
Reference in a new issue