Installing the Apache authentication module under MacOS X
IMPORTANT: see section 'OS 10 server' (below) if installing on OS 10 server version 10.4.6 or later.
1. Log in as administrator (aka admin) and install the Xcode tools if you haven't already got them installed on your system. This will give you all the stuff you need for writing code on your Mac.
You can pick the Xcode tools up from http://developer.apple.com/tools/download/ or install it from your distribution CD.
To install Xcode tools from the CD:
- Insert the CD labelled "Mac OS X Xcode Tools" and double-click on the XcodeTools.mpkg icon.
- Enter your administrator password.
- Follow the instructions in the installer.
To install the Xcode tools from the the package (i.e.. XcodeTools1.5_CD.dmg) that you downloaded from the developer.apple.com site:
- Double-click on the XcodeTools1.5_CD.dmg.
- Enter your administrator password.
- Follow the instructions in the installer.
2. Download a copy of mod_ucam_webauth from https://raven.cam.ac.uk/project/apache/files/ (By default this will be downloaded into a folder called mod_ucam_webauth-1.06 on your desktop)
- Start the Terminal application.
- Type the command "cd Desktop/mod_ucam_webauth-1.0.6".
- To build ucam_webauth type the command "make".
You should see something along the following lines:
admin$ make /usr/sbin/apxs -c -lcrypto \ mod_ucam_webauth.c gcc -DDARWIN -DUSE_HSREGEX -DUSE_EXPAT -I../lib/expat-lite -g -Os -pipe -DHARD_SERVER_LIMIT=2048 -DEAPI -DSHARED_MODULE -I/usr/include/httpd -c mod_ucam_webauth.c cc -bundle -undefined suppress -flat_namespace -Wl,-bind_at_load -o mod_ucam_webauth.so mod_ucam_webauth.o -lcrypo
- Then copy the module into the /usr/libexec/httpd/ directory by typing "sudo make install"
You should see something along the following lines:
sudo make install Password: /usr/sbin/apxs -c -lcrypto \ mod_ucam_webauth.c gcc -DDARWIN -DUSE_HSREGEX -DUSE_EXPAT -I../lib/expat-lite -g -Os -pipe -DHARD_SERVER_LIMIT=2048 -DEAPI -DSHARED_MODULE -I/usr/include/httpd -c mod_ucam_webauth.c cc -bundle -undefined suppress -flat_namespace -Wl,-bind_at_load -o mod_ucam_webauth.so mod_ucam_webauth.o -lcrypto /usr/sbin/apxs -i mod_ucam_webauth.so cp mod_ucam_webauth.so /usr/libexec/httpd/mod_ucam_webauth.so chmod 755 /usr/libexec/httpd/mod_ucam_webauth.so
3. Download the necessary RSA public keys from https://raven.cam.ac.uk/project/keys/ and place them in /usr/conf/webauth_keys/.
The Apache module only needs the "PEM formated PKCS#1 RSA public key" which is stored in a file named pubkey<n> (currently pubkey2). The names of the key files should not be changed - beware that they have no filename suffix but that some browsers may add .txt or similar when downloading them.
4. Add the following to /etc/httpd/httdp.conf, after the line that reads "ClearModuleList":
LoadModule ucam_webauth_module libexec/httpd/mod_ucam_webauth.so AddModule mod_ucam_webauth.c AACookieKey "some random string" <Directory "path to protected directory"> AuthType Ucam-WebAuth Require valid-user </Directory>
This is the minimum configuration required to restrict access to resources in a particular directory to users with a Ucam-WebAuth login. See https://raven.cam.ac.uk/project/apache/README.Config for further customisation options.
OS 10 server
By default Apache on OS 10 server uses Apple's own authentication module, mod_auth_apple, in place of the standard Apache module, mod_auth. In OS version 10.4.6 (and probably in future versions) mod_auth_apple won't inter-work with mod_ucam_webauth.
To work around this, disable use of mod_auth_Apple and re-enable mod_auth (which Apple continue to supply). To do so, edit /etc/httpd/httdp.conf and replace
LoadModule apple_auth_module libexec/httpd/mod_auth_apple.so
with
LoadModule auth_module libexec/httpd/mod_auth.so
and
AddModule mod_auth_apple.c
with
AddModule mod_auth.c
It may also be possible to make this change using the Apache management GUI - see Apple documentation for details. Removing Apple's module will disable some Apple-specific integration features with other authentication services on the OS 10 server platform and is only an option if those features are not themselves required.