LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 10-26-2010, 11:31 AM   #1
jcoxen
LQ Newbie
 
Registered: Aug 2010
Distribution: Red Hat, Centos, Ubuntu
Posts: 8

Rep: Reputation: 0
Postfix - domain to single IP mapping


I'm configuring a postfix server for the company I work for and have a question about limiting access by IP address.

First off, we're not using this for SPAM. We're a manufacturing/direct marketing company and will use the email server to contact our salespeople. We do not send UCE. That said, we have had problems in the past with our legitimate email being labeled as spam by a few carriers. This email server is being setup specifically to avoid future problems on that type.

Because of the nature of our business we operate several domains. We want to be able to limit outbound email for a given domain to a single IP Address. For example, say we have have 3 domains - a.com, b.com and c.com - and 3 IP addresses - 1.2.3.1, 1.2.3.2 and 1.2.3.3. We want to set things up so that a.com can only send out email on 1.2.3.1, b.com can only send out email on 1.2.3.2 and c.com can only send out email on 1.2.3.3.

My first impulse is to set these up as virtual domains on the Postfix server but I'm not sure that's the best method. Are there alternatives? What are your recommendations for doing this?

Any help will be appreciated.

Thanks,

John
 
Old 10-27-2010, 05:54 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

Have a look at the trasport table. You'll need something like the following:
Code:
a.com smtp:[1.2.3.1]
b.com smtp:[1.2.3.2]
c.com smtp:[1.2.3.3]
Regards
 
Old 10-27-2010, 08:11 AM   #3
jcoxen
LQ Newbie
 
Registered: Aug 2010
Distribution: Red Hat, Centos, Ubuntu
Posts: 8

Original Poster
Rep: Reputation: 0
Postfix - domain to single IP mapping

Thanks for the reply. I've read through the man page you referenced. It appears as if the transport table allows me to specify a downstream destination for my email based on sending domain i.e. Postfix will send email from a.com to downstream email server 1.2.3.1, from b.com to 1.2.3.2, etc.

What I'm being asked to do is the mirror image of that. In our case, the application servers that generate the email will use a single Postfix server. Each application server can host several virtual domains. The Postfix server will have one NIC setup on it for each virtual domain. The Postfix server needs to accept email from a.com ONLY on the NIC with IP 1.2.3.1, accept email from b.com ONLY on NIC 1.2.3.2, etc. All the email will leave the Postfix server via a common outbound interface (X.X.X.X) to our upstream provider.

Something like this...
Code:
---------
|appsvr1|
|-------|
| a.com |-------
| b.com |----  |
---------   |  |
            |  |   --------------------------
            |  |   |         Postfix        |
            |  |   |         Server         |
---------   |  |   |------------------------|
|appsvr2|   |  ----| 1.2.3.1 ----           |
|-------|   -------| 1.2.3.2 -| |           |
| c.com |----------| 1.2.3.3 -+-+-+ X.X.X.X |----Internet-->
| d.com |----------| 1.2.3.4 -| | |         |
---------   -------| 1.2.3.5 ---| |         |
            |  ----| 1.2.3.6 ------         |
            |  |   --------------------------
            |  |
---------   |  |
|appsvr3|   |  |
|-------|   |  |
| e.com |----  |
| f.com |-------
---------
Locking it down still further, 1.2.3.1 must only accept email from a.com. Anything from any other domain MUST be rejected. The same for every other interface.

Will the transport table do this as well? Is this even possible?

Thanks,

John

Last edited by jcoxen; 10-27-2010 at 08:38 AM. Reason: [Code] tags around ASCII drawing
 
Old 10-27-2010, 12:38 PM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

This is a matter of dns at a first place. If every domain has an MX record pointing to the specific IP, like
Code:
a.com MX mail.a.com.
mail.a.com. A 1.2.3.1
then mail for a specific domain will be delivered to postfix through that IP. Of course all those domains should exist in relay_domains.
From there it's postfix that has to either deliver the message, or forward it to x.x.x.x
Quote:
Locking it down still further, 1.2.3.1 must only accept email from a.com. Anything from any other domain MUST be rejected. The same for every other interface.

Will the transport table do this as well? Is this even possible?
I really don't know how this can be done per domain, as we are talking for one postfix installation serving multiple domains.
The transports table is used to route email for a specific domain through a specific mailserver (or an IP as in the example above).

Regards
 
Old 11-19-2010, 12:20 PM   #5
jcoxen
LQ Newbie
 
Registered: Aug 2010
Distribution: Red Hat, Centos, Ubuntu
Posts: 8

Original Poster
Rep: Reputation: 0
Would running multiple instances of Postfix do what I need?
 
Old 11-19-2010, 04:04 PM   #6
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
Originally Posted by jcoxen View Post
Would running multiple instances of Postfix do what I need?
Theoretically it should do, but again you need a dns to give the MX RR for each domain and thus the postfix instance listening on that IP.
 
Old 11-22-2010, 07:31 AM   #7
jcoxen
LQ Newbie
 
Registered: Aug 2010
Distribution: Red Hat, Centos, Ubuntu
Posts: 8

Original Poster
Rep: Reputation: 0
Let me rephrase my last question a bit. Assuming all required DNS records are properly setup, would running multiple instances of Postfix be a better solution for my needs?
 
Old 11-22-2010, 12:18 PM   #8
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

Given your 2 requirements:
Quote:
We want to be able to limit outbound email for a given domain to a single IP Address. For example, say we have have 3 domains - a.com, b.com and c.com - and 3 IP addresses - 1.2.3.1, 1.2.3.2 and 1.2.3.3. We want to set things up so that a.com can only send out email on 1.2.3.1, b.com can only send out email on 1.2.3.2 and c.com can only send out email on 1.2.3.3.

Locking it down still further, 1.2.3.1 must only accept email from a.com. Anything from any other domain MUST be rejected. The same for every other interface.
Since you want both these features, I think that this is the only way. 3 different instances (meaning 3 different configurations), that each one accepts and sends mail from/to a specific domain.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Postfix virtual alias for second domain not mapping correctly gr33d Linux - Software 4 06-29-2010 09:20 AM
Multiple postfix smtp server for a single domain satish.apg Linux - Server 2 03-16-2010 07:36 AM
Postfix - Single domain with multipe relay host jignesh.vasani Linux - Software 10 11-30-2009 04:53 PM
POstfix domain mapping, how? kuplo SUSE / openSUSE 1 12-14-2005 09:56 PM
IP address to domain name mapping htm Linux - Software 0 06-20-2004 07:16 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 10:01 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration