Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Email server behind pfSense

    Scheduled Pinned Locked Moved NAT
    69 Posts 5 Posters 29.9k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • N
      nahid
      last edited by

      Marcello,

      When I configure OutBound NAT InternalMailServer with the Virtual IP (IP Aliases) IntrnalMailServer (10.10.1.5) could not able to access Internet. Actually it should access through the Internet with its external ip I mean with the virtual ip that configured for it.

      How can I solve this?

      1 Reply Last reply Reply Quote 0
      • N
        nahid
        last edited by

        Thanks to everybody, the problem has solved through creating the virtual ip as IP Aliases and then NAT them as 1:1 with internal mail server.

        Now I want to use Postfix Forwarder with MailScanner.

        Marcello, could you please help me to configuring these packages? If possible please give me some screen shots of settings.

        Thanks in advance.

        1 Reply Last reply Reply Quote 0
        • marcellocM
          marcelloc
          last edited by

          @nahid:

          Thanks to everybody, the problem has solved through creating the virtual ip as IP Aliases and then NAT them as 1:1 with internal mail server.

          Now I want to use Postfix Forwarder with MailScanner.

          Marcello, could you please help me to configuring these packages? If possible please give me some screen shots of settings.

          Thanks in advance.

          Follow this thread to see if posted messages could help you on configuring mailscanner.
          I'll post there a small shortcut for a default mailscanner setup.

          http://forum.pfsense.org/index.php/topic,43687.msg226301.html#msg226301

          Treinamentos de Elite: http://sys-squad.com

          Help a community developer! ;D

          1 Reply Last reply Reply Quote 0
          • N
            nahid
            last edited by

            Dear Marcello,

            I have installed both postfix and MailScanner. I configured  MailScanner as default just providing my domain address in general tab.

            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.

            Could you please explain a little bit for me.

            Thanks a lot.

            1 Reply Last reply Reply Quote 0
            • P
              podilarius
              last edited by

              Nahid, That is going to be the case for most mail servers. The idea is that your pfSense machine becomes a proxy hence why you use your firewall address for your MX records.

              1 Reply Last reply Reply Quote 0
              • marcellocM
                marcelloc
                last edited by

                @nahid:

                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

                Treinamentos de Elite: http://sys-squad.com

                Help a community developer! ;D

                1 Reply Last reply Reply Quote 0
                • N
                  nahid
                  last edited by

                  Another question,

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

                  1 Reply Last reply Reply Quote 0
                  • N
                    nahid
                    last edited by

                    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?

                    1 Reply Last reply Reply Quote 0
                    • N
                      nahid
                      last edited by

                      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.

                      1 Reply Last reply Reply Quote 0
                      • marcellocM
                        marcelloc
                        last edited by

                        @nahid:

                        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.

                        Treinamentos de Elite: http://sys-squad.com

                        Help a community developer! ;D

                        1 Reply Last reply Reply Quote 0
                        • N
                          nahid
                          last edited by

                          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.

                          generaltabpf.png
                          generaltabpf.png_thumb
                          domaintabpf.png
                          domaintabpf.png_thumb
                          searchmailpf.png
                          searchmailpf.png_thumb

                          1 Reply Last reply Reply Quote 0
                          • marcellocM
                            marcelloc
                            last edited by

                            what you get on

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

                            Treinamentos de Elite: http://sys-squad.com

                            Help a community developer! ;D

                            1 Reply Last reply Reply Quote 0
                            • N
                              nahid
                              last edited by

                              [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.

                              1 Reply Last reply Reply Quote 0
                              • marcellocM
                                marcelloc
                                last edited by

                                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

                                Treinamentos de Elite: http://sys-squad.com

                                Help a community developer! ;D

                                1 Reply Last reply Reply Quote 0
                                • N
                                  nahid
                                  last edited by

                                  Marcelo,

                                  I have changed following way:

                                  domainpftab.png
                                  domainpftab.png_thumb
                                  wanrules.png
                                  wanrules.png_thumb
                                  NATrules.png
                                  NATrules.png_thumb

                                  1 Reply Last reply Reply Quote 0
                                  • marcellocM
                                    marcelloc
                                    last edited by

                                    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.

                                    Treinamentos de Elite: http://sys-squad.com

                                    Help a community developer! ;D

                                    1 Reply Last reply Reply Quote 0
                                    • N
                                      nahid
                                      last edited by

                                      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?

                                      1 Reply Last reply Reply Quote 0
                                      • N
                                        nahid
                                        last edited by

                                        recent status of the config:

                                        loopback.png
                                        loopback.png_thumb
                                        portForward.png
                                        portForward.png_thumb
                                        rulesTab.png
                                        rulesTab.png_thumb

                                        1 Reply Last reply Reply Quote 0
                                        • marcellocM
                                          marcelloc
                                          last edited by

                                          @nahid:

                                          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)

                                          Treinamentos de Elite: http://sys-squad.com

                                          Help a community developer! ;D

                                          1 Reply Last reply Reply Quote 0
                                          • N
                                            nahid
                                            last edited by

                                            Hurrah!!!

                                            Marcelo,

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

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.