For any of you who have ever tried to use or configure sendmail, you know it’s not a fun task. At best, you wince, try to browse some google groups as you make your way through the billions of posts regarding some tribal knowledge that has to do with this release of sendmail on that specific OS. Then throw DNS into the mix, sendmail’s partner in crime and we’ve got a real ho-down. Especially when DNS goes missing. When DNS doesn’t arrive for the party, sendmail gets mad.
Real mad.
Anyways, in alot of our networks, we have hosts that don’t have DNS. Why? Because we’re too lazy to set the shit up. Seriously tho, it’s mostly because work has me stuck on building machines ( ie: monkey work ) rather than trying to solve the real issues in our infrastructure. Since I just spent the last hour trying to figure out how to get a RedHat Enterprise 4 ( U4 ) machine to send mail without DNS to a smart relay host, I thought I’d share the results and how to do it.
First, make sure you have the sendmail-cf package installed. Either install it locally via media or use yum/up2date to get it.
rpm -ivh sendmail-cf-8.13.1-3.RHEL4.5.i386.rpm
Next, add your smart relay host to your /etc/hosts file
192.168.0.6 mailhost mailhost.domain.com
Go into /etc/mail/ and vi the sendmail.mc file. Add the following lines:
FEATURE(`accept_unresolvable_domains')dnl
FEATURE(`accept_unqualified_senders')dnl
FEATURE(nocanonify)
define(`confSERVICE_SWITCH_FILE', `/etc/mail/service.switch')dnl
define(`SMART_HOST',`mailhost')
Note: The first character after the “FEATURE(” is a tick mark ( ` ) from the tilde key, this is not a typo. The ending quotation is a single quote mark ( ‘ ). I’ve enclosed the code in pre tags, although it looks ugly, to ease copying and pasting into the configuration. Please look at the sendmail.mc file for more clarification.
Of course, replace the mailhost with the host you entered in your /etc/hosts file. Now create a file in /etc/mail called service.switch and add the following:
hosts files
For our last file modification, edit the submit.mc file in /etc/mail and add the following line:
define(`confDIRECT_SUBMISSION_MODIFIERS', `C')dnl
Now that we’re done making our file modifications, simply type ‘make’ while in the /etc/mail directory. You shouldn’t see any output, but if you do a directory listing, you should see some .bak files now. You can compare these with the current .cf files to see what changes were made.
Restart sendmail and the sm-client:
service sendmail restart
And voila! You should now successfully be able to send mail to your smart relay host with no DNS. To test, trying something like this:
mail -s test name@domain.com < /dev/null 2>&1 >> /dev/null
Cross your fingers, sacrifice a few goats and chickens, do a little dance, make a little love and check your inbox for the test email.
Recent Comments