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.
    • marcellocM
      marcelloc
      last edited by

      @DQM:

      • Did you updated it to 2.10.0 version? Is that correct? Because I saw on the Package Management of my pfsense box (pls see the attached file for more details).

      Yes. 2.10 is the latest stable version.

      @DQM:

      • Does new version work smoothly? Does it has any new features? (Ex: SMTP Relay server by authentication or Trusted IPs methods)

      Yes. The new feature on gui is an helo acl and new sync code and also working on pfsense 2.1 .
      I'll include some thay mem cache for postscreen. I'm running my antispam boxes without issues with postfix 2.10.

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

      Help a community developer! ;D

      1 Reply Last reply Reply Quote 0
      • D
        DQM
        last edited by

        @marcelloc:

        @DQM:

        • Did you updated it to 2.10.0 version? Is that correct? Because I saw on the Package Management of my pfsense box (pls see the attached file for more details).

        Yes. 2.10 is the latest stable version.

        @DQM:

        • Does new version work smoothly? Does it has any new features? (Ex: SMTP Relay server by authentication or Trusted IPs methods)

        Yes. The new feature on gui is an helo acl and new sync code and also working on pfsense 2.1 .
        I'll include some thay mem cache for postscreen. I'm running my antispam boxes without issues with postfix 2.10.

        Thanks for your information, Marcello !

        1 Reply Last reply Reply Quote 0
        • V
          virusbcn
          last edited by

          @marcelloc:

          @virusbcn:

          what is the more easy way to config this, to make my first level barrier of spam in pfsense ¿???

          Follow default options on gui, it will be easy  :)

          @virusbcn:

          I don't want put all domains or users or ldap sync with my server :-(   It is this possible ??

          you have to configure it on pfsense to filter unknow domains, mailboxes, spf, forged sender domains, etc, etc ,etc during message header. this way, you save bandwidth while rejecting most spams before they send data.

          Thank you Marcelo i try to search some information to sync ldap with my postfix server and try to make some tests, and search for get some free time :-(

          1 Reply Last reply Reply Quote 0
          • B
            biggsy
            last edited by

            I decided to auto-start my test pfSense 2.1 VM when booting ESXi - postfix failed to start and left the following log entries:

            User.Error	192.168.111.51	May 24 16:35:28 php: : Stopping postfix
            User.Error	192.168.111.51	May 24 16:35:28 php: : Stopping postfix
            Mail.Critical	192.168.111.51	May 24 16:35:28 postfix/postfix-script[17736]: fatal: the Postfix mail system is not running
            User.Error	192.168.111.51	May 24 16:35:28 php: : The command '/usr/local/etc/rc.d/postfix.sh stop' returned exit code '1', the output was '/usr/pbi/postfix-amd64/sbin/postconf: warning: /usr/pbi/postfix-amd64/etc/postfix/master.cf: unused parameter: user=postfix'
            Mail.Critical	192.168.111.51	May 24 16:35:28 postfix/postfix-script[17885]: fatal: the Postfix mail system is not running
            User.Error	192.168.111.51	May 24 16:35:28 php: : The command '/usr/local/etc/rc.d/postfix.sh stop' returned exit code '1', the output was '/usr/pbi/postfix-amd64/sbin/postconf: warning: /usr/pbi/postfix-amd64/etc/postfix/master.cf: unused parameter: user=postfix'
            Syslog.Error	192.168.111.51	May 24 16:35:29 syslogd: exiting on signal 15
            Kernel.Info	192.168.111.51	May 24 16:35:30 syslogd: kernel boot file is /boot/kernel/kernel
            User.Error	192.168.111.51	May 24 16:35:29 php: : Writing out configuration
            Syslog.Error	192.168.111.51	May 24 16:35:30 syslogd: exiting on signal 15
            Kernel.Info	192.168.111.51	May 24 16:35:30 syslogd: kernel boot file is /boot/kernel/kernel
            User.Error	192.168.111.51	May 24 16:35:30 php: : Writing out configuration
            User.Error	192.168.111.51	May 24 16:35:32 php: : Writing rc_file
            User.Error	192.168.111.51	May 24 16:35:32 php: : Writing rc_file
            User.Error	192.168.111.51	May 24 16:35:33 php: : Stopping postfix
            Mail.Critical	192.168.111.51	May 24 16:35:33 postfix/postfix-script[27296]: fatal: the Postfix mail system is not running
            User.Error	192.168.111.51	May 24 16:35:33 php: : The command '/usr/local/etc/rc.d/postfix.sh stop' returned exit code '1', the output was '/usr/pbi/postfix-amd64/sbin/postconf: warning: /usr/pbi/postfix-amd64/etc/postfix/master.cf: unused parameter: user=postfix'
            User.Error	192.168.111.51	May 24 16:35:33 php: : Stopping postfix
            User.Error	192.168.111.51	May 24 16:35:34 php: : The command '/usr/local/etc/rc.d/postfix.sh stop' returned exit code '126', the output was '/usr/local/etc/rc.d/postfix.sh: Permission denied'
            User.Notice	192.168.111.51	May 24 16:35:34 check_reload_status: Syncing firewall
            Syslog.Error	192.168.111.51	May 24 16:35:34 syslogd: exiting on signal 15
            Kernel.Info	192.168.111.51	May 24 16:35:35 syslogd: kernel boot file is /boot/kernel/kernel
            User.Error	192.168.111.51	May 24 16:35:35 php: : Writing out configuration
            Syslog.Error	192.168.111.51	May 24 16:35:35 syslogd: exiting on signal 15
            Kernel.Info	192.168.111.51	May 24 16:35:36 syslogd: kernel boot file is /boot/kernel/kernel
            User.Error	192.168.111.51	May 24 16:35:36 php: : Writing out configuration
            User.Error	192.168.111.51	May 24 16:35:38 php: : Writing rc_file
            User.Error	192.168.111.51	May 24 16:35:38 php: : Writing rc_file
            User.Error	192.168.111.51	May 24 16:35:39 php: : Stopping postfix
            User.Error	192.168.111.51	May 24 16:35:39 php: : Stopping postfix
            Mail.Critical	192.168.111.51	May 24 16:35:39 postfix/postfix-script[39090]: fatal: the Postfix mail system is not running
            User.Error	192.168.111.51	May 24 16:35:39 php: : The command '/usr/local/etc/rc.d/postfix.sh stop' returned exit code '1', the output was '/usr/pbi/postfix-amd64/sbin/postconf: warning: /usr/pbi/postfix-amd64/etc/postfix/master.cf: unused parameter: user=postfix'
            User.Error	192.168.111.51	May 24 16:35:39 php: : The command '/usr/local/etc/rc.d/postfix.sh stop' returned exit code '126', the output was '/usr/local/etc/rc.d/postfix.sh: Permission denied'
            Syslog.Error	192.168.111.51	May 24 16:35:41 syslogd: exiting on signal 15
            Kernel.Info	192.168.111.51	May 24 16:35:42 syslogd: kernel boot file is /boot/kernel/kernel
            User.Error	192.168.111.51	May 24 16:35:41 php: : Writing out configuration
            Syslog.Error	192.168.111.51	May 24 16:35:42 syslogd: exiting on signal 15
            Kernel.Info	192.168.111.51	May 24 16:35:42 syslogd: kernel boot file is /boot/kernel/kernel
            User.Error	192.168.111.51	May 24 16:35:42 php: : Writing out configuration
            User.Error	192.168.111.51	May 24 16:35:44 php: : Writing rc_file
            User.Error	192.168.111.51	May 24 16:35:44 php: : Writing rc_file
            User.Error	192.168.111.51	May 24 16:35:45 php: : Stopping postfix
            User.Error	192.168.111.51	May 24 16:35:45 php: : Stopping postfix
            Mail.Critical	192.168.111.51	May 24 16:35:45 postfix/postfix-script[50014]: fatal: the Postfix mail system is not running
            User.Error	192.168.111.51	May 24 16:35:45 php: : The command '/usr/local/etc/rc.d/postfix.sh stop' returned exit code '1', the output was '/usr/pbi/postfix-amd64/sbin/postconf: warning: /usr/pbi/postfix-amd64/etc/postfix/master.cf: unused parameter: user=postfix'
            User.Error	192.168.111.51	May 24 16:35:45 php: : The command '/usr/local/etc/rc.d/postfix.sh stop' returned exit code '126', the output was '/usr/local/etc/rc.d/postfix.sh: Permission denied'
            User.Notice	192.168.111.51	May 24 16:35:46 check_reload_status: Syncing firewall
            Syslog.Error	192.168.111.51	May 24 16:35:46 syslogd: exiting on signal 15
            Kernel.Info	192.168.111.51	May 24 16:35:47 syslogd: kernel boot file is /boot/kernel/kernel
            User.Error	192.168.111.51	May 24 16:35:47 php: : Writing out configuration
            Syslog.Error	192.168.111.51	May 24 16:35:47 syslogd: exiting on signal 15
            Kernel.Info	192.168.111.51	May 24 16:35:48 syslogd: kernel boot file is /boot/kernel/kernel
            User.Error	192.168.111.51	May 24 16:35:47 php: : Writing out configuration
            User.Error	192.168.111.51	May 24 16:35:49 php: : Writing rc_file
            User.Error	192.168.111.51	May 24 16:35:49 php: : Writing rc_file
            User.Error	192.168.111.51	May 24 16:35:50 php: : Stopping postfix
            User.Error	192.168.111.51	May 24 16:35:50 php: : Stopping postfix
            Mail.Critical	192.168.111.51	May 24 16:35:50 postfix/postfix-script[59480]: fatal: the Postfix mail system is not running
            User.Error	192.168.111.51	May 24 16:35:50 php: : The command '/usr/local/etc/rc.d/postfix.sh stop' returned exit code '1', the output was '/usr/pbi/postfix-amd64/sbin/postconf: warning: /usr/pbi/postfix-amd64/etc/postfix/master.cf: unused parameter: user=postfix'
            User.Error	192.168.111.51	May 24 16:35:50 php: : The command '/usr/local/etc/rc.d/postfix.sh stop' returned exit code '126', the output was '/usr/local/etc/rc.d/postfix.sh: Permission denied'
            Syslog.Error	192.168.111.51	May 24 16:35:51 syslogd: exiting on signal 15
            Kernel.Info	192.168.111.51	May 24 16:35:51 syslogd: kernel boot file is /boot/kernel/kernel
            User.Error	192.168.111.51	May 24 16:35:51 php: : Writing out configuration
            Syslog.Error	192.168.111.51	May 24 16:35:51 syslogd: exiting on signal 15
            Kernel.Info	192.168.111.51	May 24 16:35:51 syslogd: kernel boot file is /boot/kernel/kernel
            User.Error	192.168.111.51	May 24 16:35:53 php: : Writing rc_file
            User.Error	192.168.111.51	May 24 16:35:53 php: : Writing rc_file
            User.Error	192.168.111.51	May 24 16:35:54 php: : Stopping postfix
            Mail.Critical	192.168.111.51	May 24 16:35:54 postfix/postfix-script[70188]: fatal: the Postfix mail system is not running
            User.Error	192.168.111.51	May 24 16:35:54 php: : The command '/usr/local/etc/rc.d/postfix.sh stop' returned exit code '1', the output was '/usr/pbi/postfix-amd64/sbin/postconf: warning: /usr/pbi/postfix-amd64/etc/postfix/master.cf: unused parameter: user=postfix'
            User.Error	192.168.111.51	May 24 16:35:54 php: : Stopping postfix
            User.Error	192.168.111.51	May 24 16:35:54 php: : The command '/usr/local/etc/rc.d/postfix.sh stop' returned exit code '126', the output was '/usr/local/etc/rc.d/postfix.sh: Permission denied'
            Kernel.Critical	192.168.111.51	May 24 16:35:56 kernel: VMware memory control driver initialized
            Auth.Info	192.168.111.51	May 24 16:35:57 login: login on ttyv0 as root
            System4.Notice	192.168.111.51	May 24 16:35:57 sshlockout[84092]: sshlockout/webConfigurator v3.0 starting up
            Auth.Emerg	192.168.111.51	May 24 16:56:29 php: /index.php: Successful login for user 'admin' from: 192.168.111.7
            Auth.Emerg	192.168.111.51	May 24 16:56:29 php: /index.php: Successful login for user 'admin' from: 192.168.111.7
            Auth.Emerg	192.168.111.51	May 24 16:56:29 php: /index.php: Successful login for user 'admin' from: 192.168.111.7
            User.Error	192.168.111.51	May 24 16:57:21 php: /status_services.php: The command '/usr/local/etc/rc.d/postfix.sh stop' returned exit code '126', the output was '/usr/local/etc/rc.d/postfix.sh: Permission denied'
            Mail.Warning	192.168.111.51	May 24 16:57:24 postfix/postfix-script[62930]: warning: not owned by root: /var/spool/postfix
            Mail.Info	192.168.111.51	May 24 16:57:24 postfix/postfix-script[67208]: starting the Postfix mail system
            Mail.Info	192.168.111.51	May 24 16:57:24 postfix/master[67631]: daemon started -- version 2.10.0, configuration /usr/pbi/postfix-amd64/etc/postfix
            
            

            Started fine from the service status page though.

            1 Reply Last reply Reply Quote 0
            • B
              biggsy
              last edited by

              Just realized that I did an update to the latest 2.1 snap last night and forgot to re-enable postfix and pfBlocker.

              Why aren't these two packages re-enabled automatically after updating, if they were enabled before?

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

                @biggsy:

                Why aren't these two packages re-enabled automatically after updating, if they were enabled before?

                The uninstall process disables it.

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

                Help a community developer! ;D

                1 Reply Last reply Reply Quote 0
                • B
                  buv
                  last edited by

                  Hi Marcello,

                  first of all thank you very much for this excellent module! It makes my work much easier, since I am not really a postfix specialist.

                  @marcelloc:

                  I've never seen this error during package install.

                  check if pkg_info return two postfix installs or something.

                  EDIT:

                  Let me know if this feature works with zimbra ldap.
                  It's written for Active directory ldap search.

                  att,
                  Marcello Coutinho

                  I am using the package in combination with the Zimbra mail server. When I try to do the recipient retrival via LDAP, I come to a limitation which has its cause in the different LDAP structure of Zimbra compared to MS AD. Looking at the query your module submits, I see that it is expecting a SAMAccount. This entity is not present in the Zimbra LDAP. The Zimbra LDAP structure looks like the following:

                  dc=tld
                      dc=mydomain
                        ou=people
                          uid= <user id1="">mail=u1@b.c
                            mail=u1_alias1@b.c
                            mail=u1_alias2@b.c
                            …
                          uid= <user id2="">mail=u2@b.c
                            mail=u2_alias1@b.c
                            ...

                  uid is of types inetOrgPerson, zimbraAccount and amavisAccount. Is it possible for me to modify the query in one of the config files, or does it require a change in the source code? Would you be interested in extending the LDAP part to include Zimbra queries? If so, I could prepare the query and provide it to you.

                  Greetings,
                  Burkhard</user></user>

                  1 Reply Last reply Reply Quote 0
                  • B
                    buv
                    last edited by

                    Hi,

                    maybe I found the solution: The LDAP query is nicely wrapped in the /usr/local/bin/adexport.pl, so no recompile neccessary. I did the following modification:

                    
                    56c56
                    < our $filter  = '(|(objectClass=publicFolder)(&(sAMAccountName=*)(mail=*)))';
                    ---
                    > our $filter  = '(&(uid=*)(mail=*))';
                    
                    

                    It seems to work and only lists userIds with valid email addresses. The technical users like spam and ham do not get selected and are not forwarded.

                    Does it make sense to use the filter value a Perl script parameter and make it selectable from a drop down box for Exchange and Zimbra (and potentially further mail server types)?

                    Greetings,
                    Burkhard

                    1 Reply Last reply Reply Quote 0
                    • B
                      buv
                      last edited by

                      ok, was a bit more complicated:

                      
                      56c56
                      < our $filter  = '(|(objectClass=publicFolder)(&(sAMAccountName=*)(mail=*)))';
                      ---
                      > our $filter  = '(&(uid=*)(mail=*))';
                      92c92
                      <              attrs    => [ "proxyAddresses" ],
                      ---
                      >              attrs    => [ "mail" ],
                      163,164c163,164
                      <   my @mails = grep { /^smtp:/i && !$gSeen{$_}++ }
                      <                    $data->get_value( "proxyAddresses" );
                      ---
                      >   my @mails = grep { !$gSeen{$_}++ }
                      >                    $data->get_value( "mail" );
                      168c168
                      <     print map { s/^smtp:(.+)$/\L$1\n/i; $_ } @mails;
                      ---
                      >     print map { s/^(.+)$/\L$1\n/i; $_ } @mails;
                      
                      

                      I did not recognize the problem that the recipient list remained empty because all mails got forwarded to the mail server then anyhow…

                      Greetings,
                      Burkhard

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

                        I successfully upgraded to postfix v2.10  :)
                        I've noticed that with this new postfix package, the file /var/log/maillog is not deleted anymore after a reboot.

                        Does it mean that now there is a kind of logrotate configured for this file ? If yes how is it configured ?

                        This file is 238MB and keep growing…

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

                          @ics:

                          Does it mean that now there is a kind of logrotate configured for this file ? If yes how is it configured ?

                          No log rotate yet.

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

                          Help a community developer! ;D

                          1 Reply Last reply Reply Quote 0
                          • E
                            expert_az
                            last edited by

                            hello

                            I'm getting this error after update postfix 2.10

                            postfix/postscreen[63302]: fatal: btree:/var/db/postfix/postscreen_cache: unable to get exclusive lock: Resource temporarily unavailable

                            any solution?

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

                              Did you tried stopping postfix process and removing current /var/db file to start a new one?

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

                              Help a community developer! ;D

                              1 Reply Last reply Reply Quote 0
                              • E
                                expert_az
                                last edited by

                                Thank you marcelloc,after stoping postfix and deleting db file it's ok now,
                                I will monitor logs and will inform you if it happens again

                                1 Reply Last reply Reply Quote 0
                                • E
                                  expert_az
                                  last edited by

                                  Marcello

                                  It happened again:((

                                  Jun 29 09:03:51 postfix/postscreen[54318]: fatal: btree:/var/db/postfix/postscreen_cache: unable to get exclusive lock: Resource temporarily unavailable
                                  Jun 29 09:02:50 postfix/postscreen[61744]: fatal: btree:/var/db/postfix/postscreen_cache: unable to get exclusive lock: Resource temporarily unavailable
                                  Jun 29 09:01:49 postfix/postscreen[63059]: fatal: btree:/var/db/postfix/postscreen_cache: unable to get exclusive lock: Resource temporarily unavailable

                                  1 Reply Last reply Reply Quote 0
                                  • J
                                    jemarti
                                    last edited by

                                    I need to configure PostFix to accept mail from a specific IP address even though that address is both blacklisted and is presenting a non-existent host name during HELO.

                                    I have tried placing entries like this:
                                    123.231.132.213 OK
                                    in the "helo" section of the "Access Lists" tab, and also added them to /usr/local/etc/postfix/helo_check
                                    but I am still getting the following reject message in the logs:
                                    RCPT from unknown[123.231.132.213]: 550 5.7.1 Client host rejected: cannot find your hostname, [123.231.132.213]

                                    Could anyone advise me on the correct way to configure PostFix so that it will bypass the helo and RBL checks for specific IP addresses?

                                    Thanks.

                                    1 Reply Last reply Reply Quote 0
                                    • K
                                      KriogenBoard
                                      last edited by

                                      Hi guys! Sorry for my bad English. I found an interesting bug. The package is sensitive to the hostname. If you do not correct the host name does not occur the record in db file. Example: mail1.example.com working, mail-1.example.com not working. All the matter in the function function_grep_log in file /usr/local/www/postfix.php . Please note this bug in the next update. Thank you.  :)

                                      1 Reply Last reply Reply Quote 0
                                      • K
                                        kwaci
                                        last edited by

                                        Hi All,

                                        Im new in this forum. Im just installing pfSense with Postfix and Mailscanner package as SMTP relay for our Exchange 2003 server.
                                        It work very well. Postscreen and RBL checks are the day saver.  :)

                                        One thing i want to ask, is it possible to block certain email  address from my trusted (mynetworks) SMTP client ?

                                        I had put the email address in the Access List –> Sender, but it doestnt have any effect. I think it is because the order in the **_smtpd_client_restrictions_** and _**smtpd_recipient_restrictions**_ started by **_permit_mynetworks_** and followed by other rules. So if the first rule is passed, it wont check the following rules.
                                        Also im trying to change the order from the shell, but when im reload the Postfix from the GUI the main.cf back to default order.

                                        smtpd_recipient_restrictions = permit_mynetworks,
                                        reject_unauth_destination,
                                        reject_unauth_pipelining,
                                        check_client_access pcre:/usr/local/etc/postfix/cal_pcre,
                                        check_client_access cidr:/usr/local/etc/postfix/cal_cidr,
                                        check_sender_access hash:/usr/local/etc/postfix/sender_access,
                                        reject_non_fqdn_helo_hostname,
                                        reject_unknown_recipient_domain,
                                        reject_non_fqdn_recipient,
                                        reject_multi_recipient_bounce,
                                        reject_unverified_recipient,
                                        reject_spf_invalid_sender,
                                        permit

                                        Thank you

                                        SMTPD_SENDER.jpg
                                        SMTPD_SENDER.jpg_thumb

                                        1 Reply Last reply Reply Quote 0
                                        • K
                                          kwaci
                                          last edited by

                                          @expert_az:

                                          Marcello

                                          It happened again:((

                                          Jun 29 09:03:51 postfix/postscreen[54318]: fatal: btree:/var/db/postfix/postscreen_cache: unable to get exclusive lock: Resource temporarily unavailable
                                          Jun 29 09:02:50 postfix/postscreen[61744]: fatal: btree:/var/db/postfix/postscreen_cache: unable to get exclusive lock: Resource temporarily unavailable
                                          Jun 29 09:01:49 postfix/postscreen[63059]: fatal: btree:/var/db/postfix/postscreen_cache: unable to get exclusive lock: Resource temporarily unavailable

                                          Hi expert_az,

                                          I think you have configured the Postfix to listen on multiple interfaces.
                                          You can workaround this issue by listening postfix on localhost only and then nat external ips to 127.0.0.1. (http://forum.pfsense.org/index.php/topic,46334.msg242753.html#msg242753)

                                          Listen_Loopback_Only.jpg
                                          Listen_Loopback_Only.jpg_thumb
                                          NAT_to_Loopback.jpg
                                          NAT_to_Loopback.jpg_thumb

                                          1 Reply Last reply Reply Quote 0
                                          • E
                                            expert_az
                                            last edited by

                                            kwaci thank you for reply,i will try solution

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