LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-04-2007, 02:32 PM   #1
Cyberitas
LQ Newbie
 
Registered: Oct 2007
Posts: 13

Rep: Reputation: 0
Configure Postfix for Store and Forward


I am currently using Postfix for e-mail, but have recently installed an Exchange server. What I want to do now is have my Exchange server act as primary MX and the Postfix server act as secondary. The scenario would be that if the Exchange server cannot be accessed for whatever reason, the Postfix server would store the e-mails until the Exchange server was accessible again.

So, in short, I want the Postfix server to store and forward e-mails when the Exchange server is inaccessible. I also want the Postfix server to store and forward e-mails sent to anyone @mydomain.com so that I do not have to add users to Postfix and Exchange.

Also, I need to be able to do this in a Postfix install that uses MySQL.

I have found a lot of stuff on Postfix, but nothing that addresses all of these needs in a clear manner. I am not that familiar with Postfix, so I need some guidance. Thanks in advance!
 
Old 12-05-2007, 04:33 AM   #2
Berhanie
Senior Member
 
Registered: Dec 2003
Location: phnom penh
Distribution: Fedora
Posts: 1,625

Rep: Reputation: 165Reputation: 165
You just need to define relay_domains in main.cf. If you want to accept mail for anyone (keep in mind the spam problem and the fact that anything rejected by Exchange is backscatter), make sure relay_recipient_maps is empty.
 
Old 12-06-2007, 10:53 AM   #3
Cyberitas
LQ Newbie
 
Registered: Oct 2007
Posts: 13

Original Poster
Rep: Reputation: 0
Thanks for the reply, but could you give me a working example? Let's say that my Postfix server is mail.domain.com and my exchange server is exchange.domain.com. How would that be configured?

I apologize for my lack of comprehension here.
 
Old 12-06-2007, 11:24 AM   #4
Berhanie
Senior Member
 
Registered: Dec 2003
Location: phnom penh
Distribution: Fedora
Posts: 1,625

Rep: Reputation: 165Reputation: 165
Before asking questions, you should be somewhat familiar with the documentation. Start with this and this.
 
Old 12-07-2007, 11:24 AM   #5
Cyberitas
LQ Newbie
 
Registered: Oct 2007
Posts: 13

Original Poster
Rep: Reputation: 0
OK, I looked over the documentation and I could even adapt that to our MySQL lookup table environment. However, there is one minor problem that I forgot to mention in my original post.

This server acts as the e-mail gateway for my company, plus several clients that we are hosting. Therefore, I need this server to act as the secondary MX for my e-mails, but remain as the primary MX for our clients. Is this even possible? If so, what changes would I need to make to the standard configuration to allow this?

I appreciate all of your help.
 
Old 12-07-2007, 12:30 PM   #6
dyasny
Member
 
Registered: Dec 2007
Location: Canada
Distribution: RHEL,Fedora
Posts: 995

Rep: Reputation: 115Reputation: 115
what you are saying is that posfix will be the front end for the exchange server, right?
just google postfix+front+end+exchange - everything is very easy and simple.

as for the mx settings, I suppose you are using active directory and its DNS service on the LAN, right?
and the external DNS settings are taken care of the ISP, usually. so the ISP will have the settings stating your postfix is primary MX, while the internal DNS for the domain.local will hold settings for exchange. BTW, with this kind of config it is a good idea to keep exchange away from the internet (maybe just open outgoing port 25, so it can send mails without using postfix as smarthost).
 
Old 12-07-2007, 02:39 PM   #7
Cyberitas
LQ Newbie
 
Registered: Oct 2007
Posts: 13

Original Poster
Rep: Reputation: 0
No, Postfix won't be the front-end. Postfix will be the backup mail server and Exchange will be the front-end, primary mail server. The issue is that the Postfix server acts as an e-mail server for us as well as some our of our hosted clients. So, The setup I need is this:

For My Company-
Exchange Front-End
Postfix as Secondary, Backup, Store-and-Forward

For Our Clients-
Postfix as Front-End

And this needs to be accomplished on the same Postfix server, using the same config.

We host our own DNS in our Datacenter, and I have no issues with configuring the MX records. Both Postfix and Exchange are firewalled with Static NATs.
 
Old 12-07-2007, 03:16 PM   #8
dyasny
Member
 
Registered: Dec 2007
Location: Canada
Distribution: RHEL,Fedora
Posts: 995

Rep: Reputation: 115Reputation: 115
but your company's domain is not the same the the client domains, right?

if so - just set up mail preferences for MX servers the way you need them. it's even easier
 
Old 12-07-2007, 03:27 PM   #9
Cyberitas
LQ Newbie
 
Registered: Oct 2007
Posts: 13

Original Poster
Rep: Reputation: 0
I'm not sure I understand you.

I want Exchange to send and receive all mail for my company.
I want Postfix to send and receive all mail for my clients.
I want Postfix to store e-mails sent to my company if Exchange is not responding.
I want Postfix to send stored e-mails to Exchange once Exchange begins responding.

This is what I need. I know it takes some configuration of Postfix to accomplish this. I am just looking for what I need to configure in Postfix for the above conditions to be met.

This is how DNS will be configured:
/var/named/zones/mydomain.com.dns
IN MX 20 mail.mydomain.com.
IN MX 10 exchange.mydomain.com.

/var/named/zones/clientdomain.com.dns
IN MX 10 mail.mydomain.com.

I appreciate any help.
 
Old 12-07-2007, 05:36 PM   #10
dyasny
Member
 
Registered: Dec 2007
Location: Canada
Distribution: RHEL,Fedora
Posts: 995

Rep: Reputation: 115Reputation: 115
DNS looks right. so what you need is for postfix to act as a backup mx basically.
there are different ways, depending on how long the planned downtime for exchange is - if it is short there is no config necessary, just make postfix act as a front end for the exchange - it will not drop mails, it will retry to send them over. and if the downtime is longer - use exchange pop connector to retrieve mails from mail.domain.com. that will require a pop service there of course.

or did I get what you are looking for wrong again?
 
Old 12-07-2007, 06:41 PM   #11
Berhanie
Senior Member
 
Registered: Dec 2003
Location: phnom penh
Distribution: Fedora
Posts: 1,625

Rep: Reputation: 165Reputation: 165
Quote:
OK, I looked over the documentation
Excellent. So, by now you are familiar with the configuration of postfix as a backup MX, as discussed here.

Quote:
This server acts as the e-mail gateway for my company, plus several clients that we are hosting. Therefore, I need this server to act as the secondary MX for my e-mails, but remain as the primary MX for our clients.
This is not clear to me. Are you hosting email for several domains on your postfix box, and want postfix to be a primary MX for some and a backup for others? If so, what do you want to do with mail for which postfix is the primary MX? Deliver it to Exchange along with mail for which you're the backup MX?

Or, do you just want some of your remote clients to be able to use postfix as their outgoing mail server?

Last edited by Berhanie; 12-07-2007 at 06:43 PM.
 
Old 12-08-2007, 12:49 PM   #12
Cyberitas
LQ Newbie
 
Registered: Oct 2007
Posts: 13

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Berhanie View Post
This is not clear to me. Are you hosting email for several domains on your postfix box, and want postfix to be a primary MX for some and a backup for others? If so, what do you want to do with mail for which postfix is the primary MX? Deliver it to Exchange along with mail for which you're the backup MX?
We have one server runnig Postfix. This server provides incoming and outgoing e-mail for several companies, including my own. I want Postfix as the primary MX for my client's domains and the primary MX for my domain.

So, when someone sends an e-mail to user@clientdomain.com, Postfix handles it and the user accesses the e-mail via webmail or a client. This is what currently takes place.

When someone sends an e-mail to user@mydomain.com, I want Exchange to handle it and the user can access it via OWA or a client. This is configured.

However, let's say that Exchange becomes inaccessible. Now, when someone sends an e-mail to user@mydomain.com, Postfix stores the e-mail.

Now, let's say that Exchange is accessible again. All stored e-mails get forwarded by Postfix to Exchange and all new e-mails go directly to Exchange.

While all of this is taking place, any e-mails sent to user@clientdomain.com are still handled by Postfix and the user can access them via webmail or a client. No client e-mail should be forwarded to Exchange.

We host DNS in our datacenter, so I can change the MX records for mydomain.com without affecting the MX records for clientdomain.com. However, Postfix is currently configured NOT to store-and-forward, and while I could configure it to do so, I am not sure how to configure it to store-and-forward for my domain (accepting all e-mails sent to @mydomain.com) as a backup, while still handling all e-mail for @clientdomain.com as the primary and not relaying those e-mails anywhere.
 
Old 12-08-2007, 03:20 PM   #13
Berhanie
Senior Member
 
Registered: Dec 2003
Location: phnom penh
Distribution: Fedora
Posts: 1,625

Rep: Reputation: 165Reputation: 165
Quote:
I want Postfix as the primary MX for my client's domains and the primary MX for my domain.
...
However, let's say that Exchange becomes inaccessible. Now, when someone sends an e-mail to user@mydomain.com, Postfix stores the e-mail.
Sorry, I don't understand. Are you saying that you want postfix to be the primary MX, yet still deliver to Exchange?

I think what you meant to say is that postfix is to be the backup MX for your own domain, i.e. only to "store and forward" to Exchange, not to be the primary MX, as you said. If this is the case, you need to add all such store-and-forward domains to relay_domains, as explained in detail in the link in my last post.

Last edited by Berhanie; 12-08-2007 at 03:22 PM.
 
Old 12-09-2007, 03:55 AM   #14
Cyberitas
LQ Newbie
 
Registered: Oct 2007
Posts: 13

Original Poster
Rep: Reputation: 0
Yes, I meant that Postfix should be the primary MX for my clients, and the secondary MX for my domain.

So, just to be clear, adding just my domain to the relay_domains will store-and-forward for my domain, but will leave the other (client) domains as they are now?

Thanks for all of your help.
 
Old 12-09-2007, 08:21 AM   #15
Berhanie
Senior Member
 
Registered: Dec 2003
Location: phnom penh
Distribution: Fedora
Posts: 1,625

Rep: Reputation: 165Reputation: 165
Quote:
So, just to be clear, adding just my domain to the relay_domains will store-and-forward for my domain, but will leave the other (client) domains as they are now?
Yes. Also, make sure you understand the role of relay_recipient_maps (follow the link post #11 above). Finally (but, not likely in your case), if you had previously added your domain to something like mydestination or virtual_mailbox_domains, you should remove your domain from that list.
 
  


Reply


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Postfix - Bounce AND forward? wachaca Linux - Server 1 12-12-2006 08:33 PM
Postfix forward mail rickylim Linux - Server 1 10-25-2006 10:41 PM
store emails on database (postfix) eduac Linux - General 1 07-30-2006 02:31 AM
Postfix forward arjanhs Linux - Software 4 04-06-2006 03:01 AM
How do I configure postfix master to forward all email to an email server ? hello321_1999 Linux - Software 1 11-18-2004 04:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:10 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration