Solved

Postfix user with multiple domains

Posted on 2011-03-15
7
547 Views
Last Modified: 2012-05-11
I have a client who has multiple domains but wants to run them as alias domains. I use Postfix as my incoming mx and direct mail into destination servers from there. I would like to use the virtual_alias_maps to redirect the incoming mail to the main domain regardless of the domain it was addressed to.
The thing I'm looking for is something that would say, "send {any user}@domain2.com to {same user}@domain1.com" so I don't have to put in an individual line for each user.
Is this even possible?
0
Comment
Question by:scarpenter104
  • 4
  • 3
7 Comments
 
LVL 31

Expert Comment

by:farzanj
Comment Utility
Yes, it is possible.

First find the name of the table in your postfix system.

grep virtual_alias_maps /etc/postfix/main.cf | cut -d: -f2

Make sure that virtual_alias_maps line is not commented.

If you don't have it, put something like
virtual_alias_maps = hash:/etc/postfix/virtual

Once you find out what the name of the file is, you should put the following entry:
@mydomain.com             %1@anotherdomain.com
0
 
LVL 1

Author Comment

by:scarpenter104
Comment Utility
Using the suggested syntax, the server actually tries to deliver the mail to the literal:
%1@anotherdomain.com

I assume %1 is supposed to resolve but it does not.
0
 
LVL 31

Accepted Solution

by:
farzanj earned 500 total points
Comment Utility
Ok, here is the problem.  It was Sendmail syntax and I thought it might be same.

Now you have to do this:
1.  Try removing %1 and see what happens.
2.  Whether it works or not try the second suggestion I have.


In your postfix config file, make sure the following map is enabled.
smtp_generic_maps = hash:/etc/postfix/generic

Now, insert this line (modify domain names) into /etc/postfix/generic
@dom1.com      @dom2.com


  Please let me know about both of these.
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 1

Author Comment

by:scarpenter104
Comment Utility
Both suggestions work perfectly.
The generic file (I assumed I also had to do a "postmap generic", which I did) gave a slight twist:

Since the first method works on the recieve side it showed up in the logs as delivered to (user@dom2.com (originally user@dom1.com). The second method operates on the delivery side so it simply showed user@dom1.com in the log but delivered the mail to user@dom2.com.

Additionally, in the mail client, the first method maintained the actual sending domain and showed it was sent to user@dom1.com, while the second showed that it was sent to user@dom2.com.

Two excellect solutions that each are perfect for certain situations.
Thanks for the solutions.
0
 
LVL 31

Expert Comment

by:farzanj
Comment Utility
I am so glad it worked.

Where did you do "postmap generic"?  Please clarify.  I normally use sendmail.
0
 
LVL 1

Author Comment

by:scarpenter104
Comment Utility
generic is a text file and we specified a hash in the config:

smtp_generic_maps = hash:/etc/postfix/generic

So after creating the text file you use:

postmap generic

to create the generic.db that postfix looks for.
0
 
LVL 31

Expert Comment

by:farzanj
Comment Utility
Oh, ok.  Thanks for for your response.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now