Upgrading to OpenBSD 5.2

Upgrading via the snapshot process was painless, but OpenSMTPD ceased to operate.

The first problem was that the /etc/mail/smtpd.conf file had been overwritten, thereby eliminating the include of the local smtpd configuration, that is /etc/mail/smptd.conf.local.

After adding the "include" directive, smptd then complained about the smptd.conf.local syntax. This turned out to be mostly due to the change of the keyword all to any. In addition (not sure if completely necessary), I had to add the protocol to the string identifying the external MTAs.

I also took the opportunity to add a rule to handle mail to other servers on the local network in a more general fashion than my last attempt. To this end I created a file for input to makemap to define domain mappings for the local machine names. The file, /etc/mail/localnet looks like;

  topaz   topaz.hydrus.org.uk
  crimson crimson.hydrus.org.uk
  steel   steel.hydrus.org.uk
  amber   amber.hydrus.org.uk
  silver  silver.hydrus.org.uk
  chrome  chrome.hydrus.org.uk

The map is then built (as root) using the command:

  makemap localnet

In researching this approach, I was initially confused, as the man page for makemap didn't match the usage error message. I finally realised I was using the OpenSMTPD variant of makemap. makemap creates the /etc/mail/localnet.db file, and is referenced in the /etc/mail/smptd.conf.local file.

  # cobalt.hydrus.org.uk local smtpd configuration file
  #
  # 26th November, 2011 MPW
  #
  # 2012-12-14:
  # Revised for 5.2: all -> any; added protocol to host strings
  # Added map localnet for hydrus.org.uk destined email
  #

  # define aliases map for local net machines
  map localnet source db "/etc/mail/localnet.db"

  # listen for mail on external interface, normal smtp port (ipv4 only)
  listen on fxp0 port 25

  # expire time for bounce back
  expire 4h

  # accept mail from the local machine (lo0) to localhost accounts and
  # pass to the recipient's procmail rules. Address mapping is derived
  # from the aliases file.  This rule is for internal machine mail only.
  accept from local for local alias aliases deliver to mbox

  # Handle outgoing mail to a machine on the local network
  # It seems impossible to generalise this; all machines must be
  # specified.
  accept from local for domain map localnet \
         relay via "smtp://topaz.hydrus.org.uk" 
  accept from local for domain "*.hydrus.org.uk" \
         relay via "smtp://topaz.hydrus.org.uk" 

  # accept mail from any ip address to the hostnames defined. Address
  # mapping is derived from the aliases file.  This rule is for external
  # mail being sent to a local account.
  accept from any for domain "hydrus.org.uk" alias aliases deliver to mbox
  accept from any for domain "*.hydrus.org.uk" alias aliases deliver to mbox
  accept from any for domain "reuniongang.org.uk" alias aliases deliver to mbox
  accept from any for domain "fractionalspace.ath.cx" alias aliases deliver to mbox

  # external outgoing mail is accepted from localhost only and relayed
  # through bethere.  This rule is for local users _only_ to send mail
  # through external mail gateway. No open relays!
  accept from local for any relay via "smtp://smtp.isp.com" \
         as "@hydrus.org.uk"