pfSense Gold Subscription

Author Topic: email server behind pfSense  (Read 8809 times)

0 Members and 1 Guest are viewing this topic.

Offline marcelloc

  • Hero Member
  • *****
  • Posts: 9996
  • Karma: +4/-0
    • View Profile
Re: email server behind pfSense
« Reply #45 on: May 17, 2012, 02:02:42 pm »
Now the problem is how can I configure Postfix forwarder with MailScanner. I came through a post by you where you mentioned that port 25 NAT should be removed and all traffic should be sent to Wan Address. In my case my WAN Address is not my Email Server IP. So what will be the solution here.

If the ip address is one of virtual ips assigned to your pfsense, listen postfix on localhost and forward virtual ip port 25 to 127.0.0.1 instead of internal server.

The postfix needs to be between internet and your internal server to fiter email, just like podilarius posted.

att,
Marcello Coutinho

Offline nahid

  • Jr. Member
  • **
  • Posts: 77
  • Karma: +0/-0
    • View Profile
Re: email server behind pfSense
« Reply #46 on: May 17, 2012, 04:05:05 pm »
Another question,

Under Serach email tab in Postfix forwarder Sqlite files are empty. Is my configuration is wrong or I have made something error.

Offline nahid

  • Jr. Member
  • **
  • Posts: 77
  • Karma: +0/-0
    • View Profile
Re: email server behind pfSense
« Reply #47 on: May 17, 2012, 04:18:16 pm »
One more question how can choose localhost as the interface in Postfix? Appending a line in main config file or some thing else.

The second task that I am going to perform is that I will make a port forward on 25 from my external mail server ip to localhost. But question is my internal mail server ip is 10.10.1.5 and how will I connect this with external mail server. I mean how will the email traffic will receive and send between them?

Offline nahid

  • Jr. Member
  • **
  • Posts: 77
  • Karma: +0/-0
    • View Profile
Re: email server behind pfSense
« Reply #48 on: May 17, 2012, 04:21:14 pm »
Or is it the thing that my local mail server ip is the localhost in postfix forward? Is that so then in domain tab which server ip I am going to provide: local or external email server ip.

Please consider me as a beginner thats why I am asking so many questions.

Offline marcelloc

  • Hero Member
  • *****
  • Posts: 9996
  • Karma: +4/-0
    • View Profile
Re: email server behind pfSense
« Reply #49 on: May 17, 2012, 05:46:38 pm »
Another question,

Under Serach email tab in Postfix forwarder Sqlite files are empty. Is my configuration is wrong or I have made something error.

set log Destination to /var/log/maillog and Update Sqlite to every minute on general tab.

Offline nahid

  • Jr. Member
  • **
  • Posts: 77
  • Karma: +0/-0
    • View Profile
Re: email server behind pfSense
« Reply #50 on: May 18, 2012, 02:02:24 am »
Marcelo,

Please look at the screen shots of my Postfix Forwarder. I have done what you say about the sqlite but still it is empty.

Offline marcelloc

  • Hero Member
  • *****
  • Posts: 9996
  • Karma: +4/-0
    • View Profile
Re: email server behind pfSense
« Reply #51 on: May 18, 2012, 09:27:56 am »
what you get on

tail -f /var/log/maillog?
and
/usr/local/bin/php -q /usr/local/www/postfix.php 01min

Offline nahid

  • Jr. Member
  • **
  • Posts: 77
  • Karma: +0/-0
    • View Profile
Re: email server behind pfSense
« Reply #52 on: May 18, 2012, 10:01:28 am »
[2.0.1-RELEASE][root@pfsense.localdomain]/root(1): tail -f /var/log/maillog
May 18 12:35:10 pfsense MailScanner[19799]: Using locktype = flock
May 18 12:35:13 pfsense MailScanner[31018]: Connected to Processing Attempts Database
May 18 12:35:13 pfsense MailScanner[31018]: Found 0 messages in the Processing Attempts Database
May 18 12:35:13 pfsense MailScanner[31018]: Using locktype = flock
May 18 12:35:19 pfsense MailScanner[37752]: Connected to Processing Attempts Database
May 18 12:35:19 pfsense MailScanner[37752]: Found 0 messages in the Processing Attempts Database
May 18 12:35:19 pfsense MailScanner[37752]: Using locktype = flock
May 18 12:35:24 pfsense MailScanner[41484]: Connected to Processing Attempts Database
May 18 12:35:24 pfsense MailScanner[41484]: Found 0 messages in the Processing Attempts Database
May 18 12:35:24 pfsense MailScanner[41484]: Using locktype = flock

[2.0.1-RELEASE][root@pfsense.localdomain]/root(1): /usr/local/bin/php -q /usr/local/www/postfix.php 01min
/usr/bin/grep '^May 18 17:59.*\(MailScanner\|postfix.cleanup\|postfix.smtp\|postfix.error\|postfix.qmgr\)' /var/log/maillog
writing to database...writing to database...24[2.0.1-RELEASE][root@pfsense.localdomain]/root(2):
 

this are the execution data I got.


"The second task that I am going to perform is that I will make a port forward on 25 from my external mail server ip to localhost. But question is my internal mail server ip is 10.10.1.5 and how will I connect this with external mail server. I mean how will the email traffic will receive and send between them?" -- How I solve this?

Thanks a lot for your reply.

Offline marcelloc

  • Hero Member
  • *****
  • Posts: 9996
  • Karma: +4/-0
    • View Profile
Re: email server behind pfSense
« Reply #53 on: May 18, 2012, 10:39:42 am »
94.55.x.x will be an virtual ip on your pfsense?

if so,
 just change 94.55.x.x on postfix gui to 10.10.1.5

Internet ----> 94.55.x.x pfsense--->10.10.1.5 internal mail server

You will have sqlite databases when you have mail traffic on logs

Offline nahid

  • Jr. Member
  • **
  • Posts: 77
  • Karma: +0/-0
    • View Profile
Re: email server behind pfSense
« Reply #54 on: May 18, 2012, 11:11:25 am »
Marcelo,

 I have changed following way:

Offline marcelloc

  • Hero Member
  • *****
  • Posts: 9996
  • Karma: +4/-0
    • View Profile
Re: email server behind pfSense
« Reply #55 on: May 18, 2012, 11:52:12 am »
On port forward, create a nat rule from virtual ip 94.55.x.x to 127.0.0.1

The port forward will create the rule you need on wan interface

O postfix config, choose loopback and lan interface.

Offline nahid

  • Jr. Member
  • **
  • Posts: 77
  • Karma: +0/-0
    • View Profile
Re: email server behind pfSense
« Reply #56 on: May 18, 2012, 01:13:46 pm »
Dear Marcello,

Do I have to disable those port forward on 25 from ExternalMailServer to InternalMailServer or they will be there as like as they are?

Offline nahid

  • Jr. Member
  • **
  • Posts: 77
  • Karma: +0/-0
    • View Profile
Re: email server behind pfSense
« Reply #57 on: May 18, 2012, 01:39:47 pm »
recent status of the config:

Offline marcelloc

  • Hero Member
  • *****
  • Posts: 9996
  • Karma: +4/-0
    • View Profile
Re: email server behind pfSense
« Reply #58 on: May 18, 2012, 01:50:00 pm »
Do I have to disable those port forward on 25 from ExternalMailServer to InternalMailServer or they will be there as like as they are?

yes, all external traffic must go to postfix (rdr from virtual ip to 127.0.0.1 with associated rule applied)

Offline nahid

  • Jr. Member
  • **
  • Posts: 77
  • Karma: +0/-0
    • View Profile
Re: email server behind pfSense
« Reply #59 on: May 18, 2012, 02:06:28 pm »
Hurrah!!!

Marcelo,

I can send emails but can't receive. Is there anything wrong?