Munki is a great tool for installing/updating/uninstalling software packages. Munki provides a central repository of software and allows for easy software-build management. With Munki, you can keep all your software in the repo, write manifests for each of your builds and push out the manifests out. Another advantage of Munki (that may be later utilized in our environment) is that it allows non-admin users to update the software on their machines through the updates provided by Munki.
Previously we were using DeployStudio to push out tiered builds, however the downside of this method is that it’s not simple to mass-update/uninstall software. The methods to make these changes would include either (a) writing a script that uninstalls packages, (b) rebuilding the machine with the new software build. With Munki, all of that is eliminated, and it comes down to maintaining a software manifest.
Currently we’ve installed Munki on https://adams.cul.columbia.edu. The wiki pages used for this are the following:
- Installing On Standalone Machine
- Using Munki With SSL Client Certificates
- Creating Disk Images with Munki
- Munki’s configuration plist values
- Securing Munki Using Basic Authentication
Step 1: Create a CA and certificate for our Munki Server to use
When setting up Adams, I more or less followed the instructions above (Using Munki with SSL client certificates). A quick outline of the steps would be:
1. Download materials
2. Edit config/openssl.conf (optional, either do this step to setup default values or enter in values as you run the following steps)
3. run bin/createCA.sh – creates cert, use Common Name MUNKI_CA (identifies which CA you’re creating).
4. run bin/newServer.sh – create server certificate, use the domain of your server as the Common Name (e.g. Common Name = adams.cul.columbia.edu).
5. run bin/addClient.sh – creates client certificate, use Common Name has to be the argument you used to start the script.
6. Store the contents of the parent folder (that contains bin, demoCA, servers, clients) in /private/etc/munki)
7. In Server Admin (assuming your munki server is running on an OS X server 10.6+), under add the certificates you just created.
Step 2: Set up your repo
1. Add a site under “Web” with Server Admin, under the security tab, use the certificate you have just imported.
2. Within the directory of your site, create the following directories:
Step 3: Configure Munki on the server
When setting up Munki, you could follow the steps in “Installing on a standalone machine”, but I found a very useful alternative to that in the “Creating Disk Images” page. The nugget being: /usr/local/munki/munkiimport, which will import .pkg files and turn .mpkg files into a disk image for Munki. That’s not the best part though, the best part is that it creates the catalog files, pkginfos and puts the disk image/pkg in the repository. The only setup that needs to be done is running /usr/local/munki/munkiimport –configure to set up the basic values, i.e. the repo path, munki’s url.
Step 4: Secure the server with some basic authentication
Firstly, in Server Admin, go to Web -> Sites -> YOUR SITE -> Options and enable all overrides. Then in terminal cd to your repo directory and create a .htpasswd file with the following command:
$ htpasswd -c .htpasswd munki New password: Re-type new password: Adding password for user munki
Then you need to create the .htaccess file in your repo’s directory with the following content:
AuthType Basic AuthName "Munki Repository" AuthUserFile /path/to/your/munki/repo_root/.htpasswd Require valid-user
Step 5: Configure Munki on the client
First move munki_client.pem from clients/munki_client/ and cacert.pem from demoCA/ to the certs directory in /Library/Managed Installs/ folder (or wherever you’ve set the ManagedInstallDir) on the client, you may have to create this directory.
Munki’s configuration plist values lists all the possible values for the plist that we’ll use on the clients. Make sure the following are set properly:
- ClientIdentifier (the manifest that the client is going to use)
- ManagedInstallDir (local directory that Munki will use to store pkgs)
- UseClientCertificate (set to TRUE)
- SoftwareRepoCAPath (set to the certs directory)
- SoftwareRepoCACertificate (set to cacert.pem’s path)
- SuppressUserNotification (if set to true, will make the process silent)
There’s more on that page, customize your own.
In our deployment we plan to:
1. Create a custom Munki client pkg, which will contain the certificates and ManagedInstalls.plist (as well as create custom directories if we see move in that direction). We will deploy this package via DeployStudio, and then run a script that will call Munki to install software.
2. Create sub directories within our repo based on software vendor and manifest.