Sendmail Configuration

The next challenge was to configure sendmail on crimson to act as my mail server. My knowledge of sendmail configuration was non-existent, but armed with a copy of the bat book (the O'Reilly bible on sendmail) I was ready to start.

It looked like I didn't have to do much. I copied the standard sendmail.mc file to crimson.mc and set the SMART_HOST macro to point to my ISP's SMTP server (define (SMART_HOST, 'estmp:smtp.xx.xx.com)). I also added a MASQUERADE_AS macro to use my domain name as the sender address. make cf was sufficient to process the crimson.mc file into the crimson.cf file. make install copies the crimson.cf to sendmail.cf. I restarted sendmail, which seemed to come up OK. Now to test. I issued a tail -f /var/log/maillog and sent a mail to mark@hydrus.org.uk from my ISP mail account. Hmm, the mail was rejected because sendmail thought my ISP email address was an invalid domain. The documentation indicated this was a DNS issue. I tried looking up my email domain using nslookup. It told me there was no such domain. I set the DNS server to the primary server from my ISP, using the server xx.xx.xx.xx command. Nslookup now found the email domain, but no address was provided. I was a bit puzzled as to why just the name was returned, rather than an IP address, as happened with other domains I tested. I assumed this was because the ISP email domain did not exist as a physical address. Anyway, I figured if I could tell crimson to try my ISPs servers as well as my local DNS server it would solve the problem of resolving my ISP email address. I'd read that /etc/resolv.conf was where the nameservers to try for DNS were defined. If the machine was given an IP address by DHCP, then these address were sent by the DHCP server. In /etc/resolv.conf I had:

        search hydrus.org.uk
        nameserver 192.168.0.1
        nameserver 192.168.0.1

I removed one of the 192.168.0.1 entries (my router/DNS/DHCP server) and entered my ISP's two DNS servers. I tried looking up my email domain via nslookup - exactly the same problem. So it looked like DNS did not try each nameserver in turn, it just tried the first one listed. I assumed that sendmail acted exactly the same - a false assumption, as I later discovered. It appeared I needed another solution. I turned to the sendmail configuration and discovered the FEATURE (accept_unresolvable_domains) macro. OK, that'll sort it, I thought. I returned /etc/resolv.conf to its original state.

With this option turned on, I tried resending from my ISP account. Success! The email arrived in my FreeBSD mailbox. OK, next test - can I send outward? I composed a mail addressed to my ISP email account and sent it off, watching the log file. Sendmail said "Transient parse error -- message queued for future delivery". Damn, what was this?

A little googling later, it seemed to be another DNS issue. Sendmail was looking up the recipient mail address through DNS and failing to find it. Same problem as before. This should have been a warning signal to me that I was just patching round the problem. The solution suggested on the web involved changes to a file called service.switch, making sure that the contents were "hosts: file" and made no mention of DNS. /etc/mail had no service.switch file, so I created one with the prescribed contents. Still the same problem. Back to google - but no other solutions turned up. Then I noticed that some other advice on the same topic involved slightly different contents for the service.switch file, namely "hosts file" - no colon. I took the colon out and, yes now it works!

Finally, I had email working from my own server.

Apache

Upgrading apache was a breeze by comparison. I had installed apache using the package approach. I issued pkg_delete to remove the existing version of apache (which complained a bit since I had files in the data directory), and then cd'd to /usr/ports/www/apache-1.3.7 and issued make install. Done!