Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Virtusertable -DNS mail routing question

27 views
Skip to first unread message

NPG

unread,
Mar 19, 2012, 6:21:30 PM3/19/12
to
We have a subdomain, lets say

sub.example.com

In DNS we have sub.example.com pointing to a different server which is
where the website for sub.example.com lives.

On the MX for example.com, we have a couple of email addresses defined
at sub.example.com in virtusertable like this

us...@sub.example.com somelocaluser
us...@sub.example.com some...@remote.com

From what I can tell from our logs, the MX is trying to relay all mail
for sub.example.com through the web server, and ignoring virtusertable.

My guess is its resolving sub.example.com to the web server via DNS, and
then since we have
example.com RELAY
in access
its ignoring virtusertable

Am I right?
How do I fix it?
Thanks

--
Sincerely,

Nathan Gibbs

Systems Administrator
Christ Media
http://www.cmpublishers.com

Robert Bonomi

unread,
Mar 20, 2012, 12:06:12 AM3/20/12
to
In article <jk8bhe$1t6$1...@cs6.cmpublishers.com>,
NPG <nat...@cmpublishers.com> wrote:
>We have a subdomain, lets say
>
>sub.example.com
>
>In DNS we have sub.example.com pointing to a different server which is
>where the website for sub.example.com lives.
>
>On the MX for example.com, we have a couple of email addresses defined
>at sub.example.com in virtusertable like this
>
>us...@sub.example.com somelocaluser
>us...@sub.example.com some...@remote.com
>
>From what I can tell from our logs, the MX is trying to relay all mail
>for sub.example.com through the web server, and ignoring virtusertable.
>
>My guess is its resolving sub.example.com to the web server via DNS, and
>then since we have
>example.com RELAY
>in access
>its ignoring virtusertable
>
>Am I right?

Iffy. Do you have a DNS MX record for 'sub.example.com'?
Does sendmail on exmple.com know that it should accept mail for
'sub.example.com'? i.e. is 'sub.exmple.com in the 'w' class?

Andre

unread,
Mar 20, 2012, 5:16:40 AM3/20/12
to
Do you have an entry in local-host-names corresponding with all the
names your server should receive mail for??
André

NPG

unread,
Mar 20, 2012, 11:31:41 AM3/20/12
to
What I have is

localhost
example.com
mx.example.com

Should I add sub.example.com ?

NPG

unread,
Mar 20, 2012, 11:36:25 AM3/20/12
to
On 3/20/2012 12:06 AM, Robert Bonomi wrote:
> In article <jk8bhe$1t6$1...@cs6.cmpublishers.com>,
> NPG <nat...@cmpublishers.com> wrote:
>> We have a subdomain, lets say
>>
>> sub.example.com
>>
>> In DNS we have sub.example.com pointing to a different server which is
>> where the website for sub.example.com lives.
>>
>> On the MX for example.com, we have a couple of email addresses defined
>> at sub.example.com in virtusertable like this
>>
>> us...@sub.example.com somelocaluser
>> us...@sub.example.com some...@remote.com
>>
>>From what I can tell from our logs, the MX is trying to relay all mail
>> for sub.example.com through the web server, and ignoring virtusertable.
>>
>> My guess is its resolving sub.example.com to the web server via DNS, and
>> then since we have
>> example.com RELAY
>> in access
>> its ignoring virtusertable
>>
>> Am I right?
>
> Iffy. Do you have a DNS MX record for 'sub.example.com'?

No.
sub.example.com is a CNAME to the web server
Should I add an MX for that.

I tried changing the CNAME to an A last night, got a nice mail loop, but
that was about it.
:-)

> Does sendmail on exmple.com know that it should accept mail for
> 'sub.example.com'? i.e. is 'sub.exmple.com in the 'w' class?
>

If that's the same thing as putting it in local-host-names, then no.
Should I add it there?

NPG

unread,
Mar 20, 2012, 8:25:53 PM3/20/12
to
Answered my own question. yes that is the same.
:-)

Tried adding sub.example.com to local-host-names and restarting
sendmail. Resulting with no change.

The mail server still relays all mail for sub.example.com to the web
server, which then then relays ( via smarthost and / or mailhub ) it
back to mx.example.com

According to the mail server logs the to address is changed from
us...@sub.example.com to us...@mx.example.com.
According to a mail client the to address is changed from
us...@sub.example.com to us...@webserver.example.com

This of course bounces or gets delivered depending if user exists, but
either way the mail goes to the wrong place.
:-)

As mentioned earlier, I tried changing the DNS record for
sub.example.com from a CNAME to an A with the result that the mail
bounced between the two servers, and never was delivered.
:-)

sendmail, great when it works, infuriating when I have way too many
options.
My guess is that it is something trivially simple, but not necessarily
obvious that I am missing.

NPG

unread,
Mar 20, 2012, 9:31:36 PM3/20/12
to
On 3/20/2012 12:06 AM, Robert Bonomi wrote:
> In article <jk8bhe$1t6$1...@cs6.cmpublishers.com>,
> NPG <nat...@cmpublishers.com> wrote:
>> We have a subdomain, lets say
>>
>> sub.example.com
>>
>> In DNS we have sub.example.com pointing to a different server which is
>> where the website for sub.example.com lives.
>>
>> On the MX for example.com, we have a couple of email addresses defined
>> at sub.example.com in virtusertable like this
>>
>> us...@sub.example.com somelocaluser
>> us...@sub.example.com some...@remote.com
>>
>>From what I can tell from our logs, the MX is trying to relay all mail
>> for sub.example.com through the web server, and ignoring virtusertable.
>>
>> My guess is its resolving sub.example.com to the web server via DNS, and
>> then since we have
>> example.com RELAY
>> in access
>> its ignoring virtusertable
>>
>> Am I right?
>
> Iffy. Do you have a DNS MX record for 'sub.example.com'?

OK, tried adding an MX record to sub.example.com, also had to change the
CNAME record to an A record that pointed to the web server.
And surprise, mail started working right.

Thanks for hinting me in the right directions. I appreciate it.
I thought that the MX record in the example.com zone would have made
sure all mail in example.com or its sub domains would go to and stay at
mx.example.com.

Guess I don't know everything.
:-)

> Does sendmail on exmple.com know that it should accept mail for
> 'sub.example.com'? i.e. is 'sub.exmple.com in the 'w' class?
>

After implementing the changes covered above, it doesn't seem to make a
difference. I tried it with sub.example.com in local-host-names, and
not. mail routing worked the same, so to keep it simple it isn't in there.

I think I have everything as it should be, am I missing anything?

Andre

unread,
Mar 21, 2012, 8:45:16 AM3/21/12
to
Yes you should.
You alos can add ip Addresses.
André

Kees Theunissen

unread,
Mar 21, 2012, 2:08:54 PM3/21/12
to
NPG wrote:

>> Does sendmail on exmple.com know that it should accept mail for
>> 'sub.example.com'? i.e. is 'sub.exmple.com in the 'w' class?
>>
>
> After implementing the changes covered above, it doesn't seem to make a
> difference. I tried it with sub.example.com in local-host-names, and
> not. mail routing worked the same, so to keep it simple it isn't in there.
>
> I think I have everything as it should be, am I missing anything?
> Thanks

"sub.example.com" must be a member of the '{w}' class or the '{VirtHost}'
class. See cf/README for details how to populate the '{VirtHost}' class.
You can show the memberships of these classes with:

echo '$={w}' | sendmail -bt
echo '$={VirtHost}' | sendmail -bt

If you are using the FEATURE(`virtuser_entire_domain') the it is
sufficient if a parent domain is a member of the '{VirtHost}' class.

I guess that one of these cases applies to your situation.


Regards,

Kees.

--
Kees Theunissen.

Robert Bonomi

unread,
Mar 21, 2012, 6:42:01 PM3/21/12
to
In article <jkb76p$b26$1...@cs6.cmpublishers.com>,
It may, or may *not*, be -- it depends on how class 'w' is defined in *YOUR*
'sendmail.cf' file.

>
>Answered my own question. yes that is the same.
>:-)
>
>Tried adding sub.example.com to local-host-names and restarting
>sendmail. Resulting with no change.

Implementing only one part of a required two-part solution does not
work.

>The mail server still relays all mail for sub.example.com to the web
>server, which then then relays ( via smarthost and / or mailhub ) it
>back to mx.example.com

Expected behavior -- *AS*CONFIGURED*.

>As mentioned earlier, I tried changing the DNS record for
>sub.example.com from a CNAME to an A with the result that the mail
>bounced between the two servers, and never was delivered.
>:-)

Didn't follow directions, did you? <wry grin>


>sendmail, great when it works, infuriating when I have way too many
>options.

Have you read the 'bat book'? (i.e. 'sendmail, published by O'Reilly Assoc.?
online at www.ora.com )

>My guess is that it is something trivially simple, but not necessarily
>obvious that I am missing.

You need a 'MX' record for 'sub.example.com'. *IF* you want mail handled
by a _different_ machine than the one at the address that 'sub.exmaple.com'
resolves to.

*AND* you have to tell sendmail on that 'different' machine that _it_ handles
mail for that sub-domain.

*BOTH* items are _required_.


NPG

unread,
Mar 22, 2012, 3:32:07 PM3/22/12
to
On 3/21/2012 6:42 PM, Robert Bonomi wrote:
> In article <jkb76p$b26$1...@cs6.cmpublishers.com>,
> NPG <nat...@cmpublishers.com> wrote:
>
> Have you read the 'bat book'? (i.e. 'sendmail, published by O'Reilly Assoc.?
> online at www.ora.com )
>

Several years ago, I'm obviously a bit rusty.
Its on the book shelf, and was on the desk & open when I posted my
question here. I had been trying for a few hours to figure out where in
1200+ pages the answer was hiding.
:-)

>> My guess is that it is something trivially simple, but not necessarily
>> obvious that I am missing.
>
> You need a 'MX' record for 'sub.example.com'. *IF* you want mail handled
> by a _different_ machine than the one at the address that 'sub.exmaple.com'
> resolves to.
>

Yes, I finally got that figured out and implemented.
It can't be a sendmail issue until the DNS is set up correctly.

> *AND* you have to tell sendmail on that 'different' machine that _it_ handles
> mail for that sub-domain.
>

Would these entries in virtusertable

us...@sub.example.com somelocaluser
us...@sub.example.com some...@remote.com

this entry in access

example.com RELAY

or an MX record for example.com that points to mx.example.com

be sufficient to do that?


If no, then, I am still confused.
As I now have something that is working right and shouldn't be working
at all.

Currently mail is going to the right place and things are working as
expected.

"sub.example.com" is not be a member of the '{w}' class or the
'{VirtHost}' class.

echo '$={w}' | sendmail -bt returns
example.com
mx
localhost
[ip.ad.of.mx]
mx.example.com

echo '$={VirtHost}' | sendmail -bt returns
example1.com
example2.com
example3.com
example4.com

example1-4.com have been set up in virtusertable and VIRTUSEER_DOMAIN
for years & work as expected.

FEATURE(`virtuser_entire_domain') isn't used in our configuration.

the only place that sub.example.com shows up is in virtusertable

It works now & I don't know why.
:-)

> *BOTH* items are _required_.
>
>

That's what I am hearing, but not what I am seeing
From here it looks like an MX record in DNS for sub.example.com was all
that I needed.
Any ideas?


--
Sincerely,

Nathan Gibbs

Christ Media
(315) 548-7647
http://www.cmpublishers.com

NPG

unread,
May 9, 2012, 5:13:22 PM5/9/12
to
On 3/22/2012 3:32 PM, NPG wrote:
>
> It works now & I don't know why.
> :-)
>
Figured out why.
Had added sub.example.com in the 'w' class
and restarted the sendmail process.
removed it and didn't restart the process.

Took the server down for some hardware upgrades, and when it came back
up, things didn't work.
:-)

>> *BOTH* items are _required_.
>>
>>
>
> That's what I am hearing, but not what I am seeing
> From here it looks like an MX record in DNS for sub.example.com was all
> that I needed.
> Any ideas?
>
>

Here is an idea, try restarting the sendmail process after making
changes to the conf files.
Man do i feel stupid.
:-)
0 new messages