sendmail not using mailertable...

Latest response

 

I'm having trouble getting my mailertable to work....
 
 
 
/etc/mail/sendmail.mc contains this line

    FEATURE(`mailertable', `hash -o /etc/mail/mailertable.db')dnl


    /etc/mail/mailertable contains this line

    domain1.com        esmtp:[10.210.5.22]
 
I ran these to "recompile" the settings...
 
makemap hash /etc/mail/mailertable.db < /etc/mail/mailertable

    m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

    service sendmail restart
Then tried to send a test
 
$ mail -s "test email" aaron@domain1.com
 
 
$ tail -f /var/log/maillog

    May  9 10:03:14 npsetl005 sendmail[27779]: p49E3EG0027777: to=<aaron@www.domain1.com>, ctladdr=<root@npsetl005.domain.domain1.pri> (0/0), delay=00:00:00, xdelay=00:00:00, mailer=esmtp, pri=120350, relay=www.domain1.com. [172.16.1.47], dsn=4.0.0, stat=Deferred: Connection refused by www.domain1.com.


We have this stupid problem on our internal network where DNS and MX records aren't really set up 100 percent correctly. Getting permission to change it, and test it are way beyond the scope of this question; So I just want sendmail to ignore what's in DNS and fire messages straight to our internal relay server (which works for dozens of other clients) - but it's not doing that. You can see that it's rewriting the addresses to user@www.domain1.com because the parent *.domain1.com is a cname to www.domain1.com (someone did this as a poor mans redirect. So if a user tries to go to a subdomain that doesn't exist, they go to the root website instead... I know. I know.)
 
What did I miss?

Responses

Contents of mailertable.db

 

 

root@npsetl005:/etc/mail$ strings mailertable.db
esmtp:[10.210.5.22]
domain1.com

It's been ages since I've bothered with Sendmail. That said, I seem to remember that, for a number of the keyed tables, if you wanted to map domains (i.e., your "domain1.com") as well as subdomains (i.e., your "www.domain1.com") you'd need your mailertable to look like:

domain1.com     esmtp:[IPADDR]
*.domain1.com   esmtp:[IPADDR]

I may be remembering for another table-type, though.

We only have 1 domain. (domain1.com in this case) the www.domain1.com is invalid. There aren't any subdomains being mapped here... I'll add it to the file and see what happens, or just go scream and yell at the DNS people and fix it properly. 

Same thing when I added *.domain1.com - it's still going to DNS and looking up mx records...

 

 

Mail addressed to aaron@domain1.com gets this in the log file... 

 

 

May  9 12:53:29 npsetl005 sendmail[29437]: p49Df1Rj027416: to=<aaron@www.domain1.com>, ctladdr=<root@npsetl005.kfbdom1.domain1.pri> (0/0), delay=03:12:28, xdelay=00:00:00, mailer=esmtp, pri=840351, relay=www.domain1.com., dsn=4.0.0, stat=Deferred: Connection refused by www.domain1.com.

Just checked the definitive guide (http://www.sendmail.org/m4/mailertables.html). Instead of "*.domain1.com" to catch the www.domain1.com value, it would be just ".domain1.com". It might be interpreting the "*" literally.

You want to leave the asterisk off to glob everything underneath.

 

mydomain.com     ESMTP:[10.0.0.1]

.mydomain.com    ESMTP:[10.0.0.1]

 

This behavior is controlled by two features in Sendmail FEATURE(`relay_hosts_only') or FEATURE(`relay_subdomains').

 

You can test your mailertable directives with "sendmail -bt", specifying a ruleset of "/map mailertable" and a destination domain.

 

Example:

 

> /map mailertable somedomain.com
map_lookup: mailertable (somedomain.com) returns ESMTP:[139.87.6.16],[139.87.6.17] (0)