[MacTUG] Controlling Wireless and Bluetooth in clients with Profile Manager...

Donald Duff-McCracken dsmccrac at uwaterloo.ca
Tue Oct 29 12:10:18 EDT 2013


Or how to control it because Profile Manager (in my experience) does not control it! ;-)

Back in the days of Workgroup Manager, I could get the menu to not display icons for things like TimeMachine, Bluetooth, and Airport. Even with WGM, it was not that straightforward, if I remember, but is certainly could be done with MCX.

If I remember correctly (a lot of my WGM knowledge has self-purged as I have not used it for half a year!) you could also ensure these were disabled.

At any rate, I had not figured out how to hide these or ensure they are disabled when someone creates a new account on my lab machines.

To be clear, even if you use profile manager to prohibit access to the Network system preference, users can click on the bluetooth or airport icon and turn those services on. I decided that if I could at least ensure that these services were turned off at the start of each session (and turned off when a new user logs on) that this would be sufficient. My goal was just to not have a lab full of macs wasting bandwidth talking to the local access points.

I had a loginhook that ensured these services turned off, so I turned this into a launchagent. Please note that while there is an easy way to turn off wireless by command line, turning off bluetooth by command line is not as easy. Fortunately someone wrote a little command that I use to do this called blueutil — http://www.frederikseiffert.de/blueutil/

At any rate my launchagent to turn off wireless is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
                <key>RunAtLoad</key>
                <true/>
        <key>Label</key>
        <string>ca.uwaterloo.wireless_off</string>
        <key>ProgramArguments</key>
        <array>
                <string>/Library/Lab/scripts/wireless_off</string>
        </array>
</dict>
</plist>

I chose to have the launchagent run an external script as I figured to would be easier that way if I needed to modify it. The script it is running is:

#!/bin/bash
#ABOUT THIS SCRIPT
#TURN OFF AIRPORT AND BLUETOOTH
##THE NEXT LINE REQUIRES BLUEUTIL TO BE IN /LIBRARY/LABS/SCRIPTS
/Library/Lab/scripts/blueutil off
##MAKE SURE THAT AIRPORT IS TURNED OFF
wifi=$(networksetup -listallhardwareports | grep -E "Wi-Fi" -A 1 | grep -o en.)
networksetup -setairportpower $wifi off

exit 0


At any rate, it is likely that this could have been done in a more elegant manner, but this works for me. (If you have suggestions for how to make this better, please let me know, as I am a launchagent noob.)

As I was thinking about this (and remembering a bit about MCX, I came across this: https://github.com/timsutton/mcxToProfile This looks interesting.

------------------------------------
Donald Duff-McCracken
Technical Services Manager
Mapping, Analysis & Design
Faculty of Environment
University of Waterloo
(519) 888-4567 x32151
https://uwaterloo.ca/environment-computing/about/people/donald-duff-mccracken

------------
To request help from MAD please use Request Tracker. For info see:
https://rt.uwaterloo.ca/~wwwrt/cgi-bin/rtuser.pl

------------
This email communication is intended as a private communication for the sole use of the primary addressee and those individuals listed for copies in the original message. The information contained in this email is private and confidential and If you are not an intended recipient you are hereby notified that copying, forwarding or other dissemination or distribution of this communication by any means is prohibited.  If you are not specifically authorized to receive this email and if you believe that you received it in error please notify the original sender immediately.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.uwaterloo.ca/pipermail/mactug/attachments/20131029/e32c7c8a/attachment.html>


More information about the MacTUG mailing list