Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

So, I have two servers, I will call then Internal and External.

When I send emails within Internal postfix, it gets relayed by External which does the job of actually sending the email. Normal relay, works great:

sendmail on External -> go to destination

sendmail on Internal -> go to External -> go to destination

I have an aliases file which defines a small list of equivalences on both servers. The main email that I want to alias is 'root'. That works to some extend, that is, I receive all emails sent to the root user from either Internal or External.

The aliases on External is:

root: user1@example.com, user2@example.com

The aliases on Internal is:

root: user1@example.com

Yet user2 receives root email from Internal and External.

Is there a way to forward root emails sent by Internal to only user1@example.com and not both user1 & user2@example.com?

I try the .forward feature instead and that did not help either. root@example.com are still forwarded as such and thus distributed to all the managers of the External server when they should not be.

There is an example of an unwanted email Received, From and To fields:

Received: from halk.m2osw.com (162-226-130-121.lightspeed.frokca.sbcglobal.net [162.226.130.121])
    by mail.m2osw.com (Postfix) with ESMTP id 50BD6CE2253
    for <root@m2osw.com>; Tue,  1 Oct 2013 08:18:27 -0700 (PDT)
Received: by halk.m2osw.com (Postfix, from userid 0)
    id 0443B4C009F; Tue,  1 Oct 2013 08:18:26 -0700 (PDT)
From: Anacron <root@m2osw.com>
To: root@m2osw.com

There are some of the Internal main.cf file (i.e. halk.m2osw.com):

myhostname = halk.m2osw.com
mydestination = halk, halk.m2osw.com, localhost.m2osw.com, localhost
masquerade_domains = m2osw.com
relay_domains = halk.m2osw.com
alias_maps = hash:/etc/postfix/aliases
alias_database = hash:/etc/postfix/aliases
share|improve this question
1  
-1 and no comment? Maybe you could explain why you consider this a stupid question. –  Alexis Wilke Sep 29 '13 at 6:30
    
The configuration from internal might be useful, as it seems like it is forwarding, rather than aliasing root. –  84104 Sep 30 '13 at 16:48

2 Answers 2

Your aliases are set up correctly, but your hosts are not.

As 84104 hinted, the culprit must be in the way you have set up your postfix/forwarding, either on the Internal or External host, but more - if not highly - likely on Internal. You should start by investigating why the root account (or postmaster) on External receives the Mail you've sent on Internal.

The problem can be as easy as a forgotten newaliases run on Internal, or as complicated as a completely wrong setup. It's impossible to solve your problem with the current information available, even more so in the form of Q/A. Have a good, thorough look at the Headers of the wrongly received email in order to trace where it went, and why.

P.S. I have implemented part of the functionality you desire at one place I worked at, so it is possible.

share|improve this answer
    
I put a header as you mentioned that. To me it look like what it would look if it were what we wanted... I'll post more info about the main.cf file later. –  Alexis Wilke Oct 1 '13 at 22:29
    
I put some of my setup. Would the masquerade_domains or the relay_domains be wrong? Internal is halk.m2osw.com and External is mail.m2osw.com –  Alexis Wilke Oct 2 '13 at 5:44

Try getting rid of masquerade_domains. It is rewriting halk.m2osw.com to m2osw.com, which is not in mydestination, so it relays it on to the external server.

http://www.postfix.org/postconf.5.html#masquerade_domains

share|improve this answer
    
Testing... we'll see. It seemed logical to use the masquerade, but I suppose that would mean it needs to be on the other server, or maybe it is not needed at all. –  Alexis Wilke Oct 4 '13 at 6:55
    
That did not work... so probably not the issue here! –  Alexis Wilke Oct 5 '13 at 4:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.