LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 05-10-2006, 02:09 AM   #1
jignesh.vasani
LQ Newbie
 
Registered: May 2006
Posts: 5

Rep: Reputation: 0
Question Postfix - Single domain with multipe relay host


I am trying to setup a solution using Postfix as MTA.
My requirement is as follows:
- A mail for a particular domain should be relayed to one server.
- In addition to this another copy for the same user, same domain should be relayed to another server.

Basically, one incoming smtp stream split into 2 distinct outgoing relay streams.

See if any one knows how to achieve this through Postfix.

regards
Jignesh Vasani
 
Old 05-10-2006, 10:13 AM   #2
RomKnight
LQ Newbie
 
Registered: Jul 2004
Posts: 23

Rep: Reputation: 15
Quote:
Originally Posted by jignesh.vasani
I am trying to setup a solution using Postfix as MTA.
My requirement is as follows:
- A mail for a particular domain should be relayed to one server.
- In addition to this another copy for the same user, same domain should be relayed to another server.

Basically, one incoming smtp stream split into 2 distinct outgoing relay streams.

See if any one knows how to achieve this through Postfix.

regards
Jignesh Vasani
vi /etc/postfix/transport
domain.tld smtp:[relay.host]ort
.domain.tld smtp:[relay.host]ort
anotherdomain.tld smtp:[relay.host]ort
.anotherdomain.tld smtp:[relay.host]ort

DONT FORGET TO: postmap hash:/etc/postfix/transport


in /etc/postfix/main.cf
transport_maps = hash:/etc/postfix/transport


Now if I could only relay by sender AND authenticate the postfix client to the relayhost of my choice with sender_transport_maps and sasl... (hint, hint)
 
Old 05-10-2006, 05:37 PM   #3
Berhanie
Senior Member
 
Registered: Dec 2003
Location: phnom penh
Distribution: Fedora
Posts: 1,625

Rep: Reputation: 165Reputation: 165
Suppose that the domain in question is fake.domain, and that mail of the form user@fake.domain should be sent to both user@first.domain and user@second.domain. It's probably a bad idea to accept mail to just anyone at fake.domain because of all the spam we would receive. So, let's say that him@fake.domain and her@fake.domain are the only valid addresses for fake.domain.

First, /etc/postfix/main.cf should contain the following:
Code:
virtual_alias_domains = fake.domain
virtual_alias_maps = hash:/etc/postfix/virtual
Next, create the file /etc/postfix/virtual containing the following:
Code:
him@fake.domain     him@first.domain,  him@second.domain
her@fake.domain     her@first.domain,  her@second.domain
Finally, build the hash table and reload postfix:
Code:
# postmap /etc/postfix/virtual
# postfix reload
The documentation on the postfix site explains how to do most things.

Last edited by Berhanie; 05-10-2006 at 05:55 PM.
 
Old 05-11-2006, 12:11 AM   #4
jignesh.vasani
LQ Newbie
 
Registered: May 2006
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by RomKnight
vi /etc/postfix/transport
domain.tld smtp:[relay.host]ort
.domain.tld smtp:[relay.host]ort
anotherdomain.tld smtp:[relay.host]ort
.anotherdomain.tld smtp:[relay.host]ort

DONT FORGET TO: postmap hash:/etc/postfix/transport


in /etc/postfix/main.cf
transport_maps = hash:/etc/postfix/transport


Now if I could only relay by sender AND authenticate the postfix client to the relayhost of my choice with sender_transport_maps and sasl... (hint, hint)
Thank you RomKnight,

By the transport method that you suggested, mail for domain.tld gets relayed to only the first relay.host
What I want is that it should relay to both the relay host?
Let me know if you know how to make that work.

regs
Jignesh
 
Old 05-11-2006, 12:15 AM   #5
jignesh.vasani
LQ Newbie
 
Registered: May 2006
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Berhanie
Suppose that the domain in question is fake.domain, and that mail of the form user@fake.domain should be sent to both user@first.domain and user@second.domain. It's probably a bad idea to accept mail to just anyone at fake.domain because of all the spam we would receive. So, let's say that him@fake.domain and her@fake.domain are the only valid addresses for fake.domain.

First, /etc/postfix/main.cf should contain the following:
Code:
virtual_alias_domains = fake.domain
virtual_alias_maps = hash:/etc/postfix/virtual
Next, create the file /etc/postfix/virtual containing the following:
Code:
him@fake.domain     him@first.domain,  him@second.domain
her@fake.domain     her@first.domain,  her@second.domain
Finally, build the hash table and reload postfix:
Code:
# postmap /etc/postfix/virtual
# postfix reload

Thank you berhanie!
By the method you suggested, domain name will be changed to first and second. I want to retain the domain. Further, I do not want to specify all the users for that domain. The user rule set will be set on the 2 relay hosts that I am trying to relay the domain.

regards
Jignesh

Last edited by jignesh.vasani; 05-11-2006 at 01:47 AM.
 
Old 05-11-2006, 03:05 AM   #6
RomKnight
LQ Newbie
 
Registered: Jul 2004
Posts: 23

Rep: Reputation: 15
jignesh.vasani:

I guess I mislead you.


Where it reads:
anotherdomain.tld smtp:[relay.host]ort
.anotherdomain.tld smtp:[relay.host]ort

should be
anotherdomain.tld smtp:[another_relay.host]ort
.anotherdomain.tld smtp:[another_relay.host]ort

Again, use postmap and reload postfix
 
Old 05-11-2006, 07:01 AM   #7
jignesh.vasani
LQ Newbie
 
Registered: May 2006
Posts: 5

Original Poster
Rep: Reputation: 0
RomKnight,
Let me explain my requirement clearly.
-> A mail coming in for lets say an email ID jigs@jigs.com
-> It is recieved by the server and relayed to an IP Address e.g. 10.1.1.1
-> Another copy of the mail is relayed to another IP Address e.g. 10.1.1.2
-> In both the relaying domain name remains the same. The mail is simply relayed to 2 IP addresses simultaneously.

According to the solution you provided, mail for one domain (jigs@jigs.com) will be relayed to an IP Address and mail for another domain (jigs@xyz.com) will be relayed to another.

I want a solution for one domain relayed to 2 IP addresses at the same time.

Last edited by jignesh.vasani; 05-11-2006 at 07:09 AM.
 
Old 05-12-2006, 09:57 AM   #8
RomKnight
LQ Newbie
 
Registered: Jul 2004
Posts: 23

Rep: Reputation: 15
My bad... sorry. I've interpreted something wrong :s

I don't think i can help much then... never think of that situation until now.

The way to go is reading about the features os postfix on mail routing and some "hacks" on master.cf... i guess.
 
Old 08-26-2008, 09:01 AM   #9
gabsik
Member
 
Registered: Dec 2005
Location: This planet
Distribution: Debian,Xubuntu
Posts: 546

Rep: Reputation: 30
Wink maybe a solution ....

Have a look to this postfix.org page , http://www.postfix.org/SOHO_README.html , "Supporting multiple ISP accounts in the Postfix SMTP client" , i dont' know if it is your case but it sounds like !!!
 
Old 11-30-2009, 03:21 AM   #10
bouba
LQ Newbie
 
Registered: Nov 2009
Posts: 1

Rep: Reputation: 0
Does anyone found a solution for this pb please ? I have the same.
 
Old 11-30-2009, 04:53 PM   #11
bschumacher
LQ Newbie
 
Registered: Nov 2009
Posts: 1

Rep: Reputation: 0
Quote:
Originally Posted by bouba View Post
Does anyone found a solution for this pb please ? I have the same.
I'm assuming you guys just want to keep an archived copy of the email so....

Install MailScanner and Spamassassin

Create a ruleset for non-spam emails

Ex.
{
To: domain.com deliver store-/var/archive/incoming/domain_com forward archive@domain.com
From: domain.com deliver store-/var/archive/outgoing/domain_com forward archive@domain.com
}

This will take any mail from domain.com deliver it to the intended user, store the email in a file in /var/archive/<direction>/domain_com and then send it to another email account.

If you want it to go to a seperate mail server you can edit the transport map for that subdomain that the mail is forwarded to point to another sub-domain and change "forward archive@domain.com" to "forward archive@archive.domain.com". Otherwise get exim4 and do split spools.


You can also do per user for the ruleset so you could do something like this.

Ex.
{
To: user1@domain.com deliver store-/var/archive/incoming/domain_com forward user1@archive.domain.com
From: user1@domain.com deliver store-/var/archive/outgoing/domain_com forward user1@archive.domain.com
}

If you are really that concerned about it being the same "domain" the servers can "think" they are both part of the same domain but the server sending them the mail doesn't have to. Just edit the hosts file of the server that is splitting the mail so it thinks it is on a subdomain.

Problem solved.

If you need further help, please let me know.
 
  


Reply

Tags
copies, domain, multiple, postfix, relay


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
DHCPD is updating BIND with <host>.<domain>.<domain>. diabelek Linux - Networking 15 10-11-2007 05:58 AM
postfix and relay host mozilla Linux - Networking 1 11-23-2005 08:42 PM
Postfix as a mail relay (getting relay access denied) hypexr Linux - Software 3 09-13-2005 07:15 PM
PostFix with a SendMail Relay Host & SSH Wrappers jgrafals Linux - Software 0 02-13-2004 10:24 AM
PostFix multipe domains (virtual setup) dulaus Linux - Networking 0 10-10-2002 04:58 PM


All times are GMT -5. The time now is 05:56 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration