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

    Postfix - antispam and relay package

    Scheduled Pinned Locked Moved pfSense Packages
    855 Posts 136 Posters 1.1m 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.
    • BismarckB
      Bismarck
      last edited by

      MAKE A BACKUP BEFORE YOU GO THIS ROUTE!

      Those are the files needed, for the manual install of the Postfix Package for pfSense 2.3.x

      **/usr/local/bin/adexport.pl

      /usr/local/www/shortcuts/pkg_postfix.inc

      /usr/local/www/postfix_view_config.php
      /usr/local/www/postfix_about.php
      /usr/local/www/widgets/widgets/postfix.widget.php
      /usr/local/www/postfix_queue.php
      /usr/local/www/postfix_search.php
      /usr/local/www/postfix_recipients.php
      /usr/local/www/postfix.php

      /usr/local/pkg/postfix_domains.xml
      /usr/local/pkg/postfix_antispam.xml
      /usr/local/pkg/postfix.inc
      /usr/local/pkg/postfix_recipients.xml
      /usr/local/pkg/postfix.xml
      /usr/local/pkg/postfix_sync.xml
      /usr/local/pkg/postfix_acl.xml

      /usr/local/etc/rc.d/postfix
      /usr/local/etc/rc.d/postfix.sh

      /etc/inc/priv/postfix.priv.inc

      /etc/inc/system.inc**

      • Download the attached pfSense-2.3-Postfix.zip, unzip and copy the files to your system root /.

      • Unlock the FreeBSD repo in

      /usr/local/etc/pkg/repos/FreeBSD.conf > enabled: yes

      /usr/local/etc/pkg/repos/pfSense.conf > enabled: yes

      • Install Postfix via pkg

      pkg install postfix

      • Next edit:

      /conf/config.xml

      • and add Postfix to the Service Status and Menu:

      <service><name>postfix</name>
      <rcfile>postfix.sh</rcfile>
      <executable>master</executable></service>

      **<menu>
      <name>Postfix Forwarder</name>
      <tooltiptext>Configure Postfix Forwarder</tooltiptext>
      Services
      <url>/pkg_edit.php?xml=postfix.xml&id=0</url>
      </menu>

      <menu>
      <name>Search Mail</name>
      <tooltiptext>Search postfix logs</tooltiptext>
      Diagnostics
      <url>/postfix_search.php</url>
      </menu>

      <menu>
      <name>Postfix Queue</name>
      <tooltiptext>check postfix queue</tooltiptext>
      Status
      <url>/postfix_queue.php</url>
      </menu>**

      • Now cross your fingers and reboot!  :P

      pfSense-2.3-Postfix.zip

      1 Reply Last reply Reply Quote 0
      • R
        Ralph-DE
        last edited by

        Bismarck, you are my hero! And Marcello of course.
        The installation is easy (for those knowing the howto) and everything seems to work like a charm.
        I don't see any logs, though. Shouldn't there be a mail log in var/log ?

        1 Reply Last reply Reply Quote 0
        • BismarckB
          Bismarck
          last edited by

          @Ralph-DE:

          I don't see any logs, though. Shouldn't there be a mail log in var/log ?

          Did you enabled it in the Postfix General Settings > Logging > Destination > /var/log/maillog ?

          And check /etc/syslog.conf there should be a line for it:

          …
          local7.* %/var/log/dhcpd.log
          mail. /var/log/maillog*
          .notice;kern.debug;lpr.info;mail.crit;daemon.none;news.err;local0.none;local3.none;local4.none;local7.none;security.;auth.info;authpriv.info;daemon.info %/var/log/system.log
          auth.info;authpriv.info |exec /usr/local/sbin/sshlockout_pf 15
          *.emerg *
          …

          Otherwise, everything will be logged in the system.log facility, which can be very noisy. :P

          1 Reply Last reply Reply Quote 0
          • R
            Ralph-DE
            last edited by

            Should it not be "%/var/log/maillog"?

            1 Reply Last reply Reply Quote 0
            • M
              mikle
              last edited by

              @Ralph-DE:

              Should it not be "%/var/log/maillog"?

              My syslog.conf:

              root@pfsense:/root# cat /etc/syslog.conf

              -cut-
              local4.*                                                        %/var/log/portalauth.log
              local7.*                                                        %/var/log/dhcpd.log
              mail.*                                                          /var/log/maillog
              -cut-

              It's without "%"

              1 Reply Last reply Reply Quote 0
              • R
                Ralph-DE
                last edited by

                The following message comes repeatedly from the pfSense Crash Reporter:

                [20-Oct-2016 14:30:00 Europe/Berlin] PHP Stack trace:
                [20-Oct-2016 14:30:00 Europe/Berlin] PHP  1. {main}() /usr/local/www/postfix.php:0
                [20-Oct-2016 14:30:00 Europe/Berlin] PHP  2. grep_log() /usr/local/www/postfix.php:542
                [20-Oct-2016 14:30:00 Europe/Berlin] PHP  3. create_db() /usr/local/www/postfix.php:208
                [20-Oct-2016 14:40:00 Europe/Berlin] PHP Fatal error:  Call to undefined function sqlite_open() in /usr/local/www/postfix.php on line 476

                Is that something to be repaired or can I ignore this Messages?

                1 Reply Last reply Reply Quote 0
                • BismarckB
                  Bismarck
                  last edited by

                  Little Update…

                  postfix_about.php and postfix_view_config.php is working again.

                  But postfix_search.php and postfix_queue.php is still broken.

                  If someone have the skills to fix the javascript code, you are more then welcome!  :P

                  pfSense-2.3-Postfix.zip

                  1 Reply Last reply Reply Quote 0
                  • I
                    ikbendeman
                    last edited by

                    Hi Bismarck,

                    I followed your guidance from #709 on the latest version of pfsense.

                    I wonder if the order of

                    <menu>and <service>in the config.xml does matter, because after the reboot I don't see the postfix-forwarder item in the menu.

                    You write to install postfix… but do we also need to install mailscanner?

                    Pls advice on how to get postfix forwarder working.

                    Kind regards,

                    Bob</service> </menu>

                    1 Reply Last reply Reply Quote 0
                    • BismarckB
                      Bismarck
                      last edited by

                      <menu>and <service>needs to be, where

                      <menu>and <service>items are  in the config.xml, no special order just right section.

                      If you need MailScanner, you can install it but its not required to run Postfix, its just another layer for email security.</service> </menu></service> </menu>

                      1 Reply Last reply Reply Quote 0
                      • kalessinK
                        kalessin
                        last edited by

                        Bismark, any hint to get mailscanner working as well?

                        thanks

                        1 Reply Last reply Reply Quote 0
                        • BismarckB
                          Bismarck
                          last edited by

                          @kalessin:

                          Bismark, any hint to get mailscanner working as well?

                          thanks

                          Sure, there you go: https://forum.pfsense.org/index.php?topic=43687.msg667576#msg667576

                          1 Reply Last reply Reply Quote 0
                          • kalessinK
                            kalessin
                            last edited by

                            Thanks a lot man!
                            I appreciate your time

                            1 Reply Last reply Reply Quote 0
                            • R
                              ReisBey
                              last edited by

                              it does not work for me. I have Provet so many times now I have abandoned.

                              Thansk :(

                              1 Reply Last reply Reply Quote 0
                              • BismarckB
                                Bismarck
                                last edited by

                                Sorry ReisBey, sadly there is no easy way to run Postfix on pfSense anymore.  :'(

                                1 Reply Last reply Reply Quote 0
                                • I
                                  Igor Filth
                                  last edited by

                                  Hi! I don't see any logs too.

                                  "Postfix General Settings > Logging > Destination > /var/log/maillog " enabled.

                                  I create maillog file in Command Prompt (touch /var/log/maillog), and insert  " mail.*      /var/log/maillog " in syslog file and restart postfix.
                                  But it did not solve my problem

                                  Any ideas?

                                  1 Reply Last reply Reply Quote 0
                                  • BismarckB
                                    Bismarck
                                    last edited by

                                    @Igor:

                                    Hi! I don't see any logs too.

                                    "Postfix General Settings > Logging > Destination > /var/log/maillog " enabled.

                                    I create maillog file in Command Prompt (touch /var/log/maillog), and insert  " mail.*      /var/log/maillog " in syslog file and restart postfix.
                                    But it did not solve my problem

                                    Any ideas?

                                    Sorry my fault, move system.inc from /etc/system.inc to /etc/inc/system.inc and reboot.

                                    https://github.com/marcelloc/pfsense/commit/2d6a9c9fffa654c9df04630bffbabfeb3dff5c84

                                    zip file and the howto updated

                                    1 Reply Last reply Reply Quote 0
                                    • S
                                      Sherby
                                      last edited by

                                      @Bismarck:

                                      @Ralph-DE:

                                      I don't see any logs, though. Shouldn't there be a mail log in var/log ?

                                      Did you enabled it in the Postfix General Settings > Logging > Destination > /var/log/maillog ?

                                      And check /etc/syslog.conf there should be a line for it:

                                      …
                                      local7.* %/var/log/dhcpd.log
                                      mail. /var/log/maillog*
                                      .notice;kern.debug;lpr.info;mail.crit;daemon.none;news.err;local0.none;local3.none;local4.none;local7.none;security.;auth.info;authpriv.info;daemon.info %/var/log/system.log
                                      auth.info;authpriv.info |exec /usr/local/sbin/sshlockout_pf 15
                                      *.emerg *
                                      …

                                      Otherwise, everything will be logged in the system.log facility, which can be very noisy. :P

                                      I've tried to play with /etc/syslog.conf to make the mail log working again, but it's seem to be a bad idea.
                                      This file is recreated after reboot and the previously added line disappear.

                                      So I added the line mail. /var/log/maillog* into the /etc/inc/system.inc instead.
                                      I add it after the line local7.* %/var/log/dhcpd.log
                                      then reboot.

                                      Now the file /etc/syslog.conf have the correct line for logging and postfix is logging correctly to the maillog.

                                      Thanks !

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

                                        Hi everyone!
                                        A special thanks to marcelloc for the work he done. it's awesome.
                                        I try to configure postfix at pfsense 2.3.2 and can't solve the problem with recipients from AD. Filled all the fields at the gui, but nothing done. I try to receive recepients in SSH with the command```
                                        /usr/local/bin/php /usr/local/www/postfix_recipients.php

                                        extracting from 10.168.1.1...error while binding:The wrong password was supplied or the SASL credentials could not be processed
                                        There is no backup file for 10.168.1.1...(0)
                                        Total ldap recipients:0 unique:0

                                        But I'm sure I wrote the password correctly. Can anybody help me with this problem?
                                        
                                        ![postfix_ad_recepients.png](/public/_imported_attachments_/1/postfix_ad_recepients.png)
                                        ![postfix_ad_recepients.png_thumb](/public/_imported_attachments_/1/postfix_ad_recepients.png_thumb)
                                        1 Reply Last reply Reply Quote 0
                                        • BismarckB
                                          Bismarck
                                          last edited by

                                          In Domain try: dc=testdoamin,dc=ru this is how its working in my setup.

                                          And you could check AD login via Diagnostics > Authentication but you need setup a DC in System > User Manager >  Authentication Servers first.

                                          Good luck.

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

                                            Thanks for your reply, Bismarck.
                                            Try your advice - the same result. Also try pfsense@testdomain.ru as Username - the same. But if I type CN=pfsense;DC=TESTDOMAIN,DC=RU in Username filed then I got an error:

                                            
                                            extracting from 10.168.1.1...Use of uninitialized value $passwd in string eq at /usr/local/lib/perl5/site_perl/Net/LDAP.pm line 427, <data>line 755.
                                            error while binding:The server requires the client which had attempted to bind anonymously or
                                            without supplying credentials to provide some form of credentials
                                            
                                            P@ssw0rd: not found</data> 
                                            

                                            But I'm not sure that ; is right here.
                                            Used Diagnostics > Authentication- everything allright. Moreover, I use AD authentication to the gui.

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