Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 03-04-2013, 05:35 AM   #1
LQ Newbie
Registered: Mar 2013
Posts: 2

Rep: Reputation: Disabled
Question Hide a mail servers IP address - postfix headers and email relay


I have a mail server running cPanel (WHM), I have close to 3000 clients that check their mail from cPanel's webmail options.

The mail server gets DDoS attacked fairly frequently and I've lost over a thousand dollars on different hosts who have terminated my account because of these attacks.

I am trying to sort out an elaborate system to hide the cPanel server and make the site as a whole harder to attack.

What I have so far:

For apache:
                             --> EC2 server
                            |     (load shared)
Mail Server---Reverse Proxy----> EC2 server
(cPanel)                    |     (load shared)
                             --> EC2 server
                                  (load shared)
That all works fine. The mail servers IP is hidden from the user (+headers), they can access their webmail and the site is load shared with instances from all over the world to help with the DDoS attacks.

But my problem is with setting up mail relays, I have no idea what my postfix config file should look like and really don't understand smart hosts or mail relays enough to set it up, I've tried heaps of tutorials online about setting up a mail relay and still can't get it working. Ideally I need something like this:

Mail Outgoing:
(I already have Exim routing to a random EC2 instance working, I set up a smart host in WHM to do it)
Mail-->Exim route       
   random smarthost (EC2 instance)-->EC2 server
                                    -Strip mailserver IP from headers
                                    -Send mail
Mail Incoming:
Mail--->EC2 server (MX #1)
        -Send mail to cPanel mail server IP address
        -Strips cPanel mail server IP address from header
So put together you have a mail relay that pretends it's the final destination for mail:
                 Mail server on EC2 instance
                 Stripping any mention of the cpanel
Mail Server------IP address in the mail headers------ INTERNET
                 before either sending mail to
                 the destination or sending mail
                 to the cPanel server for Exim to
                          deal with.
So I need advice on how to go about this.

a) Is the best method for me? I know a lot of EC2 IP addresses are registered as spammers but EC2 offers some help with that...

b) Should I choose postfix or exim, I've spent literally hundreds of hours trying to get this working on EC2 and postfix but just don't have the knowledge to make this work.

c) Could you please help me with setting this up? Show me what my postfix config file should look like or give me any tips.

Last edited by pagespony; 03-04-2013 at 05:38 AM.
Old 03-06-2013, 09:51 PM   #2
LQ Newbie
Registered: Mar 2013
Posts: 2

Original Poster
Rep: Reputation: Disabled
Does anyone have any suggestions to help me out?


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
[SOLVED] Setup Postfix to Send Local Mail to Internet Email Address sumit1203 Linux - Newbie 1 09-02-2012 02:55 AM
Postfix SMTP relay via gmail using original sender email address? bdobolina Linux - Server 4 05-01-2012 07:21 AM
Configure Postfix to relay mail to multiple internal mail servers w/different domains tristopherr Linux - Server 2 05-08-2011 07:23 AM
Why is PostFix sending mail using the email address of the smtp account? taigon Linux - Server 34 02-09-2007 02:09 AM
Postfix as a mail relay (getting relay access denied) hypexr Linux - Software 3 09-13-2005 08:15 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:00 AM.

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