Breaking the Law (of Hostname Canonicalization)

Posted on June 09, 2006

Mailman is a great little program written in Python that lets you manage mailing lists. I was tasked with installing it on a new machine last week, and I got to learn about canonicalization the hard way. All of the emails sent by our server out to the mailing lists were using the host name instead of the DNS A record for the Mailman VirtualHost. I tried for days to fix this and eventually got the feeling that it was DNS related. However, I still couldn’t see why Sendmail would force the To-header back to the canonical name when Mailman was setting it correctly.

Eventually, I happened across this email on Mailman’s dev list that solved the problem by removing one of sendmail.cf’s canonicalization rules. I’m sure this violates some RFC. Although, the hack does indeed solve the problem. The actual wizardry was to comment out the following line in sendmail.cf.

# pass to name server to make hostname canonical
# R$* $| $* < @ $* > $*         $: $2 < @ $[ $3 $] > $4

It’s absolutely wrong to do this because if you edit sendmail.mc, and restart sendmail, the cf file gets regenerated automatically which obliterates the change. Is there a better way to fix this without violating RFCs and changing sendmail rulesets? Note: I don’t have access to the DNS server.