Wednesday, September 06, 2006

custom transport for postfix on RHEL 4/AS (CentOS 4.3)

I was told to use a special server to relay outbound emails for a new NMS server I built. The NMS server has POSTFIX installed and is configured to send production alerts to a new duty pager, a Blackberry 6230 with BIS account served by T-mobile. I did POSTFIX relay thingy once elsewhere, so, I instantly did the following
  • vi /etc/postfix/transport & added the following two lines at the bottom of the file
tmo.blackberry.net smtp:smartrelay2.intranet.com
intranet.com smtp:10.9.9.99
  • run 'postmap' to generate the hashed transport:
postmap /etc/postfix/transport
  • vi /etc/postfix/main.cf and commented out the global relay
#relayhost = 10.9.9.99
  • reload configuration for the running postfix. Reloading was met with some nonsense error/warnings, so I ended up with a full restart.
/etc/init.d/postfix reload OR service postfix reload
  • tested it and it didn't work. it seemed that the transport map doesn't exist, since it looked up MX record to find SMTP servers to send mail to.
man postmap, man postfix, man 5 transport, grep -i transport main.cf.
  • It became obvious that main.cf doesn't have reference to use which transport hash at all. so I added the following then restarted POSTFIX. Bingo!
transport_maps = hash:/etc/postfix/transport

It still made me curious why this is not enabled by default since one needs to consciously insert rules into the transport configuration file as well as to consciously run postmap to generate the hash. This would save me the hassle to figure out it is not there, and save a service outage in production environment should custom transport becomes necessary. The only argument I can find up to now is the security, only if it takes different credentials to modify transport.db and to start use transport.db at first place.

Of course, "crazy" default behavior can be identified on other modern operating systems also. Don't get me started with that Solaris halts if it receives the POWER Fail signal sent by a resetting serial console.

No comments: