Posted on 06-20-2016 02:39 PM
Hello,
Is there a new incarnation of JAMF's very own "disableAirport.sh" script? I can't seem to get the drivers/extensions to move into the JAMF directory. Not sure if its the SIP protection in El Capitan or something similar but Would someone point me to a script that could be run to TURN off / DISABLE airport almost permanently in a lab iMac Environment, and prevent handy students from turning it back on? Thanks
for what is worth, below is the copy of the error once the script runs.
Actions from policy log: Executing Policy Disable AirPort Wireless in Public Areas Running script disableAirPort_Labs.sh... Script exit code: 1 Script result: Disabling the Airport Drivers on target volume /...
mv: rename //System/Library/Extensions/IO80211Family.kext to //Library/Application Support/JAMF/DisabledExtensions/IO80211Family.kext: Operation not permitted
Error running script: return code was 1.
Solved! Go to Solution.
Posted on 06-21-2016 11:41 AM
Hello All,
Thanks for your responses! Yeap it is SIP trying to protect me from myself.
Ended up using following script, based on my limited knowledge of scripting it will only turn off power on the WIFI (airport) interface if Ethernet is 'UP" - that takes care of never locking myself out , if the script ever gets scoped incorrectly, or when the script encounters MacBook or MacBook Air or MacBook Pro Retina w/o a real ethernet adapter. Did limited testing in our environment and i can say it works with 10.9, 10.10 and 10.11 fairly good.
#!/bin/sh
ACTIVEIF=`/usr/sbin/netstat -rn 2>&1 | /usr/bin/grep -m 1 'default' | /usr/bin/awk '{ print $6 }'`
WIFIIF=`/usr/sbin/networksetup -listallhardwareports | grep -A 1 Wi-Fi | awk '/Device/{ print $2 }'`
WIFIPWR=`/usr/sbin/networksetup -getairportpower $WIFIIF | sed 's/Wi-Fi Power.*: //g'`
if [ "$ACTIVEIF" == "$WIFIIF" ]; then
exit 0
else
if [ "$WIFIPWR" != "On" ]; then
exit 0
else
/usr/sbin/networksetup -setairportpower $WIFIIF off
fi
fi
Got this script from somewhere here on JAMFNation, and I apologize but don't know whose handiwork it it. - all borrowed work.
Posted on 06-20-2016 04:39 PM
Hi mate,
I think you're right about the SIP Protection. This script tries to write to the System folder and that's not possible anymore with El Capitan. I would recommend to disable the airport using a manage preference or even better, convert it to a Configuration Profile and then restrict access to System Preferences.
I hope it helps,
m
Posted on 06-20-2016 08:55 PM
You can use the following command to disable airport
networksetup -setairportpower airport off
The network device name may alter the command a little. The device name could be airport, Wi-Fi, en0, en1, etc. Just adjust accordingly. My MacBook Pro uses en0.
networksetup -setairportpower en0 off
It is however able to be turned on again!
Posted on 06-20-2016 09:50 PM
This is what we used, there is potential for it to trip up if there was more than one Wi-Fi adaptor... But that hasn't happened as yet. Also if you find other references other that Airport or Wi-Fi you could add them to the awk.
WFINT=$(networksetup -listallhardwareports | awk '/Airport|Wi-Fi/ {getline; print $NF }')
if [ "$WFINT" != "" ]; then
echo "Disabling Wi-Fi on $WFINT"
networksetup -setairportpower $WFINT off
fi
Posted on 06-21-2016 11:41 AM
Hello All,
Thanks for your responses! Yeap it is SIP trying to protect me from myself.
Ended up using following script, based on my limited knowledge of scripting it will only turn off power on the WIFI (airport) interface if Ethernet is 'UP" - that takes care of never locking myself out , if the script ever gets scoped incorrectly, or when the script encounters MacBook or MacBook Air or MacBook Pro Retina w/o a real ethernet adapter. Did limited testing in our environment and i can say it works with 10.9, 10.10 and 10.11 fairly good.
#!/bin/sh
ACTIVEIF=`/usr/sbin/netstat -rn 2>&1 | /usr/bin/grep -m 1 'default' | /usr/bin/awk '{ print $6 }'`
WIFIIF=`/usr/sbin/networksetup -listallhardwareports | grep -A 1 Wi-Fi | awk '/Device/{ print $2 }'`
WIFIPWR=`/usr/sbin/networksetup -getairportpower $WIFIIF | sed 's/Wi-Fi Power.*: //g'`
if [ "$ACTIVEIF" == "$WIFIIF" ]; then
exit 0
else
if [ "$WIFIPWR" != "On" ]; then
exit 0
else
/usr/sbin/networksetup -setairportpower $WIFIIF off
fi
fi
Got this script from somewhere here on JAMFNation, and I apologize but don't know whose handiwork it it. - all borrowed work.
Posted on 06-22-2016 10:25 AM
@ChicagoGuy1984 Am I mistaken, but does this script only turn off wifi?
I've attempted to create a script which 1) turns off wifi 2) disables the wifi network service and 3) removes the wifi symbol from the menubar. Parts 1 & 2 were relatively simple, but I wasn't able to programmatically remove the Wifi symbol from the menubar without doing it via System Preferences manually.
My programmatic method for the latter was to use defaults
to rewrite the com.apple.systemuiserver.plist file array to remove the "/System/Library/CoreServices/Menu Extras/AirPort.menu" string. But a killall SystemUIServer command doesn't actually apply the change and remove the Wifi symbol.
As anyone had any luck on this front on 10.11.5?