zen.org Communal Weblog

June 6, 2007

Mac Mini becomes Network Grand Master

Filed under: — brendan @ 11:53 GMT

My desktop system has sporadically been freezing up on me, even as I try to swap out various parts to figure out what’s causing my grief. I’m finally giving in and accepting that it’s a 9 year-old system with a mixture of 1-year and 7-year parts. It’s wasted too much of my time. So I’ll start figuring out what to do for a replacement (yay tax deductions for work).

To be practical, I need to move some things to not depend on it until I get the replacement. First on the list is all of my mail folders which are usually available via the IMAP server (running courier-imap) on my desktop system. The little Mac Mini on the corner of my desk is probably the answer; having just upped its memory I figure it’s ready for the task.

Luckily David Bondes in Sweden has spelled out most of the steps to get the Courier IMAP server to build and run under OS X. Elsewhere, I found ttya.net with a more complete and up-to-date set of instructions about how to make authentication work.

The best discovery is MacPorts (formerly DarwinPorts), which uses a FreeBSD-style ports system to make it really easy to build and install random software to run on the system. As you’re about to see, though, the efforts of the MacPorts version of courier IMAP needs some further polishing.

The steps I did:

  • Install MacPorts.
  • Downloaded and installed everything with the fun command
    sudo /opt/local/bin/port install courier-imap
    which did all of: db44, courier-authlib, zlib, openssl, and courier-imap.
  • Edited /opt/local/etc/courier-imap/imapd and set IMAPDSTART to YES (may actually be irrelevant)
  • The command the script said to run to make it start up when we boot:
    sudo launchctl load -w /Library/LaunchDaemons/org.macports.courier-imap.plist
  • sudo cp /opt/local/etc/authlib/authdaemonrc.dist /opt/local/etc/authlib/authdaemonrc
  • and edit authdaemonrc to have authmodulelist be just authuserdb.

  • Following the instructions from ttya.net, put entries in a new file /opt/local/etc/authlib/userdb
    that look like
    username uid=511|gid=511|home=/Users/username|shell=/bin/bash|systempw=*|gecos=Real Name
    with userdbpw to generate the hash that replaces the * for systempw. Then run makeuserdb to convert the userdb into a DB4 database. Make sure you have a TAB character, not a space, between username and uid.
  • sudo mkdir -p /opt/local/var/spool/authdaemon
    sudo /opt/local/sbin/authdaemond start
  • I also had to do this to make it generate the SSL key:
    sudo sh /opt/local/share/courier-imap/mkimapdcert
  • And the command to make it start now without having to reboot:
    sudo /opt/local/etc/LaunchDaemons/org.macports.courier-imap/courier-imap.wrapper start
  • I didn’t have to run maildirmake Maildir because I’m syncing mine over en masse.

And it works! The manual bits after port did its deeds were pretty tedious, and the majority should be able to be done as part of the Portfile included with courier-authlib. It should also be possible to use the DirectoryServices API to make an ‘authosx’ sort of module to not require the userdb hack. (That file needs to be regenerated any time someone changes their password, for instance.)

That’s ok—at least I’ve let go of a major depencency on my dying desktop system.

Powered by WordPress