[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Stuck trying to config sendmail for virtual domains



I've been trying (for days now) to configure sendmail to support multiple 
domain names as per the "Virtual Hosting with Sendmail" page at:

  <http://sendmail.org/virtual-hosting.html>

I think i have BIND configured correctly, complete with an MX record for 
my domain, and everything appears to resolve correctly using nslookup, 
dnsquery and ping.

I suspect my problem might be that sendmail isn't listening correctly for 
(or accepting?) the virtual domain, but i could be wrong.  When i try 
sending mail to this virtual domain, nothing happens immediately, but 
eventually i get a "Warning: could not send message for past 4 hours" 
eMail, which contains this line:  "Deferred: Connection refused by 
mail.yourdomain.com"

Does "refused" mean sendmail is configured for and listening on behalf of 
"yourdomain.com", but is rejecting (or ignoring) everything for it?  Is 
this a relaying issue of some kind?  Any insight would be greatly 
appreciated.  Here are the specifics of what i've tried...

To create a "master.mc" file i cloned 
/usr/share/sendmail/cf/openbsd-proto.mc and immediately after the 
"OSTYPE(openbsd)" line inserted:

  DOMAIN(yourdomain.com)dnl
  FEATURE(`virtusertable', `hash /etc/mail/virtusertable')dnl

The "yourdomain.com.m4" file contains:

  VERSIONID(`@(#)yourdomain.com.m4   1.0 (yourdomain.com) 1-Feb-2003')
  define(`confMAX_HEADERS_LENGTH', `32768')dnl
  FEATURE(`use_cw_file')dnl

When i do a "cat sendmail.cf | grep yourdomain.com" i get:
      
  #####  @(#)yourdomain.com.m4   1.0 (yourdomain.com) 1-Feb-2003  #####

Which leads me to believe the "yourdomain.com.m4" file is compiling when 
i build the sendmail.cf file (as that comment is directly from the 
yourdomain.com.m4 file), but it leaves me wondering if i shouldn't be 
seeing more references to "yourdomain.com" in my sendmail.cf file?  Now 
as i understand it, the "use_cw_file" directive causes sendmail to read 
the "/etc/mail/local-host-names" to determine which domains to listen 
for.  My local-host-names contains "yourdomain.com",  
"mail.yourdomain.com" and "porthos.yourdomain.com".

I do not have a "/etc/mail/generics-domains" file as i am not concerned 
about reverse-mapping the domain and believe it to be optional.

The MX record (from a dnsquery) looks like this:

  yourdomain.com. 7200    IN      MX      10 mail.yourdomain.com.

When i do a "echo '$=w' | sudo sendmail -bt" i get:

  ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
  Enter <ruleset> <address>
  > [IPv6:::1]
  [192.168.1.xxx]
  [IPv6:xxxx::1]
  porthos
  localhost
  [localhost.mydom.com]
  localhost.mydom.com
  [127.0.0.1]
  mail.yourdomain.com
  porthos.yourdomain.com
  [IPv6:xxxx::xxx:xxxx:xxxx:xxxx]
  porthos.mydom.com
  > 

[Note:  "porthos" is the name of the machine and its domain is set to 
"mydom.com".  I've masked out some numbers with x's for security reasons 
and because i don't think they are pertinent to this discussion.] 

To compile my sendmail.cf file, i'm issuing this command from my home 
directory (not root):

  m4 /usr/share/sendmail/m4/cf.m4 master.mc > sendmail.cf

This seems to work (originally, i was able to reproduce the stock OpenBSD 
sendmail.cf, with a different build date, of course.)  Once built, i then 
move the newly built sendmail.cf into place with:

  sudo mv sendmail.cf /etc/mail/sendmail.cf

and issue a:

  sudo kill -HUP `sudo head -1 /var/run/sendmail.pid`

To create the virtusertable.db i did:

  cd /etc/mail
  sudo makemap hash virtusertable < virtusertable

And it does contain a catchall entry:

  @yourdomain.com  mylocalid

where "mylocalid" is my local login ID.

I do have a "relay-domains" file, but am not sure i've told sendmail to 
pay any attention to it (haven't changed the default config in respect to 
relaying; don't want to open up the box to spammers inadvertently):

  .mydom.com
  192.168.1
  localhost

I'm now totally convinced that sendmail configuration is a black art.  
Should i be sacrificing a goat at the altar or something?  Any help, 
insights, pointers, magic spells, incantations, etc. would all be most 
appreciated.  TIA.