Editing the Apple Menu

Editing the Apple Menu

juin 15, 2012 Add Comment

¡Super-Awesome Edit!


Don't you just love it when your super long work around to disable shutting down can actually be accomplished with two simple commands? I do!


sudo defaults write /Library/Preferences/com.apple.loginwindow ShutDownDisabled -bool true
sudo defaults write /Library/Preferences/com.apple.loginwindow ShutDownDisabledWhileLoggedIn -bool true


These two commands will disable the Shut Down option at the Login Window and the pop up that is shown with a click of the power button or the control-eject shortcut. I'm unable to reproduce, but I've been told it remove the Shut Down option from the Apple menu and if a user does use the forced shut down shortcut (control-option-command-eject), the computer simply reboots.

Source:
http://hints.macworld.com/article.php?story=20091104040449752

Original Post:

One of the more exciting things about upgrading Mac Mini's in classrooms is that they can be hidden! Now that the Mini's Superdrive has been moved to an external device, the Mac can be neatly hidden away and attached to a USB hub for peripherals. Now that the Mini is hidden, we have a new concern. What if it gets turned off?

With the meat of the Mac hidden, we had concerns about users accidentally shutting it down. There would little to no way for them to reach a power button. I've seen other companies solder wires to the power switch to allow an external button, but have you seen the new Mini's guts? Our solution was to remove the Shut Down and Sleep options.

After some research, this seemed like a simple fix. To remove the Shut Down and Sleep options from the Apple Menu, all I had to do was edit a NIB file, remove an object, save and reboot. However, this simple trick also had a negative side effect. The Finder would crash, repeatedly, when I selected the Apple Menu.

Thanks to StackTrace for the initial answer:
http://apple.stackexchange.com/questions/22535/can-i-remove-the-log-out-item-from-the-apple-menu/53810#53810

Here is the file I needed to edit
/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Resources/English.lproj/StandardMenus.nib/objects.xib

After messing around a bit, I started looking closely at the objects. Each object had it's own "id". When I was looking for the Shut Down option in the Carbon.framework, I remembered seeing lists of ids in other interface files. I started to wonder if these id's were referenced else where, causing the Finder to unexpectedly quit when they couldn't be found.


Example Object:
<object class="IBCarbonMenuItem" id="238">
  <string name="title">Shut Down…</string>
  <boolean name="dynamic">TRUE</boolean>
  <boolean name="notPreviousAlternate">TRUE</boolean>
  <ostype name="command">rsdn</ostype>
</object>

I found, in the same objects.xib file, all of the id's under reference tags. After I removed all of these references, the Finder behaved and the Shut Down and Sleep options were gone!

References:

<reference idRef="236"/>
<reference idRef="285"/>
<reference idRef="238"/>


If you decide to remove the Sleep and Shut Down options, look for these id's in object and reference tags. Delete the entire object, one for the Sleep option and two for the Shut Down option, and each of the references.

id's:
Sleep - 236
Shut Down - 238, 285

As an aside, there are two Shut Down options because one is for the standard Shut Down (graceful shutdown) and the other for holding the option key and clicking Shut Down (force a shut down). 

P.S. I can't tell you how hard it was for me not to type Shit Down...

802.1x User Profile for Kiosks

802.1x User Profile for Kiosks

avril 25, 2012 Add Comment
Quick Link: Download the Code

I was given the task of configuring 802.1x for our Portable Sig Stations. These MacBooks are used throughout the campus on wireless to allow students to agree to the terms of our network. Previously these MacBooks used an older wireless solution that was being retired in July. When the machines are set up in the morning, different consultants and student workers need to authenticate the wireless. In order to keep them working over the next few months, we had to add the new 802.1x wireless config. This was not as easy as it seemed...

User Profile 802.1x seems to be configured in four places:

~/Library/Preferences/com.apple.eap.profiles.plist
This is the system wide 802.1x config for the wireless


~/Library/Preferences/ByHost/com.apple.eapbinding.[UUID] 
This is the preferred network for the user. This was required for our setup, others may not need it.
Where the UUID could be the MAC address or UUID of the Mac.


/Library/Prefernces/SystemConfiguration/preferences.plist  
The Airport is turned on and off here.
There is also a preferred network setting here.


/Library/Prefernces/SystemConfiguration/com.apple.airport.preferences.plist
Recent networks

After watching the file changes using FSEventer, and the checking out scripts of a few other Mac Admins (Steve Yuroff and Bryan Lee), I was able to bring together the pieces I needed to get it to work.

Some other useful links:
http://www.afp548.com/article.php?story=20100421100144943
http://www.afp548.com/article.php?story=20090901010221742
http://hints.macworld.com/article.php?story=20101004114849586
http://bigmaconcampus.wordpress.com/2009/08/27/wireless-installer-the-next-generation/

Manually Configuring:


I used the instructions provided here and FSEventer to watch the files being modified:
https://www.work.psu.edu/access/dot1x/prod/mac1053.html

Now Script It!

First, manually setup and export the profile to the current directory:
networksetup -export8021xUserProfiles AirPort . yes

On a new machine:


Install the 802.1x file into "/Library/PSUshared/psu-8021x-profile.plist"
Install the script to "/Library/PSUshared/psuWirelessSetup.sh"
Install the launchd item into "/Users/kiosk/Library/LaunchAgents/edu.psu.clc.wirelesssetup.plist"
Run the visudo code in the terminal, with sudo.

UPDATE: I tried my damnedest to paste the code, Google Blogger does NOT like it. Just get the download!

While this script is designed to be for a single user, this code could be changed to be used for any user logging in, although for a standard user account a launchd item would be excessive. Also, 10.7 negates the need for this because it uses the 802.1x profile, which works much better with multiple users!

I've also included an attachment with the file, as the web isn't the best way to display scripts properly. Don't try to copy and paste the code from the browser, just download it here.

Rusty