MacOS – Deploying default Wifi settings and Passwords

airportconfiguration-managementkeychainmacospreferences

I am building a default 10.8 image for our corporate Mac users. We have a local Wifi network which should be set up by default on this image. I have used PackageMaker to set up all the other deployed software and settings, and would like to keep it that way. I am using InstaDMG to build the image (another reason to prefer the modular packaging method I have in place).

I have tried deploying a .keychain file to /Library/Keychains/, but the AP is not picked up; I am also aware of /Library/SystemConfiguration/com.apple.airport.preferences.plist but after deploying this, the system still does not result in the expected behavior.

How can I deploy system-wide Wifi settings to a unbooted images using packages?

Best Answer

I believe PackageMaker includes some first-run scripts, does it not? The easiest way is probably to make use of the networksetup command line tool in a script set to run on the first launch of an image.

To add a WPA network:

networksetup -addpreferredwirelessnetworkatindex AirPort mynetworkSSID 0 WPA superSecretPassword

The encryption type can be one of:

  • OPEN — open hotspot, no passphrase necessary of course.
  • WPA
  • WPAE (WPA Enterprise)
  • WPA2
  • WPA2E (WPA2 Enterprise)
  • WEP
  • 8021XWEP (802.1X WEP)