Tag Archives: pki

Configuring basic RADIUS on OS X 10.8 Server

For small deployments of Mac OS X Server, RADIUS based Wi-Fi referencing Open Directory can be a clean, secure way to provide employee access to the business network, and mitigates the problems of having one shared passphrase that rarely changes. Apple have provided automatic configuration of RADIUS and Airport base stations in OS X server for a while, but the FreeRADIUS install used by Mac OS X is of course able to provide RADIUS services to non-Apple APs and VPN services. Whilst not recommended for large deployments, this setup can do a very good job for many small to medium businesses with a highly mobile workforce.

In 10.8 server, like many services embraced in years gone by, RADIUS has disappeared into the deep dark depths of command line configuration. The following commands will get basic RADIUS functional on 10.8 Mountain Lion server for use with whichever RADIUS authenticator you wish.

All of the commands below assume that you are elevated to superuser:

sudo -s

Firstly, we have to create the SACL for accessing the RADIUS service:

dseditgroup -q -o create -u -n . com.apple.access_radius

Now, set some logging options for the RADIUS service. We want to log authentication attempts good and bad, and rotate logs and accounting information regularly:

radiusconfig -setconfig auth yes
radiusconfig -setconfig auth_badpass yes
radiusconfig -setconfig auth_goodpass yes
radiusconfig -autorotatelog on -n 15

Now we are going to add a client (RADIUS authenticator – access point, VPN endpoint). The first argument here is the IP of the client, the second is a shortname (alias), and the third is the client type. In most cases, this is other. More info can be found on types by reading the config files in /etc/raddb:

radiusconfig -addclient <IP> <short-name> other

Now, we need to generate or export an existing certificate for use with the RADIUS service. You need your certificate identity (certificate and private key) in a .p12 file to be referenced in the next set of commands. If you are unsure how to do this, the whole process is completed in the video at the bottom of this post.

Next, split the certificate identity into a separate, unencrypted certificate and private key, then install them into your RADIUS configuration:

openssl pkcs12 -in /Users/admin/Desktop/Identity.p12 -out /etc/raddb/certs/server.key -nodes -nocerts
openssl pkcs12 -in /Users/admin/Desktop/Identity.p12 -out /etc/raddb/certs/server.crt -nodes -nokeys
radiusconfig -installcerts /etc/raddb/certs/server.key /etc/raddb/certs/server.crt

At this stage, you can run radiusd with a debug flag to ensure everything is running as planned. With the -X flag on, you will see far more verbose output than you will ever see in the service logs, so if you are having any trouble, use this flag and look for problems:

radiusd -X

If everything went as planned, you will see Ready to process requests. at the end of your output. Now, add a user to the com.apple.radius_access local server group, and test authentication. You should see a whole lot of output fly by, and eventually catch a Sending-Access-Accept block when the user is authenticated, authorised, and connects.

Now, you can kill the debug process with Control-C, and start the service properly. This will start the RADIUS service and make it persistent across reboots:

radiusconfig -start

With that, you should have a fully functional basic RADIUS setup going. For all the commands inline, head over to this github:gist. For a more involved overview of the steps, check out the video.

The video below is a run through of all the steps required to get basic RADIUS configuration functional on a fresh 10.8 server instance, including Open Directory promotion, user and SACL creation, and importing a new self-signed certificate into your config. In this lab, we are using an Aerohive AP330 access point as the authenticator and access point for our wireless network.

I hope you found the commands and video lab useful.

List of all commands on github:gist


Verifying plugin bundles using code signing

Code signing your apps is a great way of verifying that they haven’t been messed with before an end user executes your code, but you can also utilise the same techniques to implement a very secure plugin system for your apps.

If your application implements a plugin architecture based on NSBundles, you can use the following snippet in your loading code to ensure that each plugin is signed by an appropriate certificate.

You will need to create a certificate authority, and then have that sign a code signing certificate for your plugins. Doing it this way means that you can provide valid signing certificates to third parties to create plugins for your app if desired. TechRepublic have a good article on creating a CA in Keychain Access on your Mac.

Update (14 July 2012): Updated the snippet to be ARC compliant.

- (BOOL) validateSignature:(NSBundle*)pluginBundle {
NSTask * task = [[NSTask alloc] init];
NSPipe * pipe = [NSPipe pipe];
NSFileHandle * handle = [pipe fileHandleForReading];
NSData * taskData;
NSString * taskString;
NSArray* args = [NSArray arrayWithObjects:@"--verify", [NSString stringWithFormat:@"-R=anchor = \"%@\"", [[NSBundle mainBundle] pathForResource:@"BlargsoftCodeCA" ofType:@"cer"]], [pluginBundle bundlePath], nil];
[task setLaunchPath:@"/usr/bin/codesign"];
[task setStandardOutput:pipe];
[task setStandardError:pipe];
[task setArguments:args];
[task launch];
[task waitUntilExit];
taskData = [handle readDataToEndOfFile];
taskString = [[NSString alloc] initWithData:taskData encoding:NSASCIIStringEncoding];

if ([task terminationStatus] != 0) {
// Something went wrong. Check for specific errors

if ([taskString rangeOfString:@"modified"].length &gt; 0 || [taskString rangeOfString:@"a sealed resource is missing or invalid"].length &gt; 0) {
// The plugin has been modified or resources removed since being signed. You probably don't want to load this.
NSLog(@"Plugin modified - not loaded"); // log a real error here
} else if ([taskString rangeOfString:@"failed to satisfy"].length &gt; 0) {
// The plugin is missing resources since being signed. Don't load.
// throw an error
NSLog(@"Plugin not signed by correct CA - not loaded"); // log a real error here
} else if ([taskString rangeOfString:@"not signed at all"].length &gt; 0) {
// The plugin was not code signed at all. Don't load.
NSLog(@"Plugin not signed at all - don't load."); // log a real error here
} else {
// Some other codesign error

return FALSE;

} else {

// The plugin passed validation!
return TRUE;