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

      Noticed 3 little things,

      1.  postfix_postwhite.template isn't copied to /usr/local/etc/postwhite.conf

      		//save file
      		$postwhite_domains = preg_replace("/\s+/"," ",$domains);
      		include("/usr/local/pkg/postfix_postwhite.template");
      		file_put_contents($postwhite_conf , POSTFIX_LOCALBASE . "/etc/postwhite.conf" , LOCK_EX);
      

      2. additional domains don't get added to postwhite.conf, maybe because of 1.

      3. postwhite is looking for postwhite.conf in a different place anyway

      # Read config file options
      if [ -s /etc/postwhite.conf ] ; then
      	printf "\nReading options from /etc/postwhite.conf...\n"
      	source /etc/postwhite.conf
      else
      	printf "\nCan't find /etc/postwhite.conf. Exiting.\n\n"
      	exit 1
      fi
      

      and I had a cronjob for this every morning, cant see where postwhite is executed here?

      Thanks. :)

      /edit

      We need policyd-spf_time_limit = 3600 in main.cf if SPF Lookup is enabled or we get a lot of those lines in maillog:

      Mar  5 14:03:26 mail postfix/spawn[57894]: warning: /usr/local/bin/policyd-spf: process id 58877: command time limit exceeded
      Mar  5 14:32:21 mail postfix/spawn[57894]: warning: /usr/local/bin/policyd-spf: process id 60423: command time limit exceeded
      Mar  5 15:13:00 mail postfix/spawn[62387]: warning: /usr/local/bin/policyd-spf: process id 62501: command time limit exceeded
      Mar  5 15:30:07 mail postfix/spawn[62387]: warning: /usr/local/bin/policyd-spf: process id 63269: command time limit exceeded
      
      1 Reply Last reply Reply Quote 0
      • I
        Igor Filth
        last edited by

        Great job! Package works fine.
        Thank you very much guys!

        I found a little mistake.
        On "Access Lists" page, when i click on field "Sender" and "MIME" i'm redirected to http://www.postfix.org/pcre_table.5.html page  :)

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

          Another bug ??

          I found that widget is not displaying correct status.

          I have configured postfix as backup relay MX2 on Site2 - it receive external mail from WAN if primary mail server MX1 on Site1 is unreachable and it store and forward all email by VPN Site - to - Site.
          I also receive all emails from Site2 - from all LANs - and forward them to primary email server on Site1 by VPN Site - to - Site.

          But until it receive a email from WAN ( Update Sqlite was on 1h and now is on 10 min), widget is not display anything for that day; emails from LAN are not showed;
          As you can see it is missing day 10 and day 11 was displayed only if I blocked primary mail server to receive emails from WAN and email was delivered to MX2 and then forwarded to MX1…

          p.s.
          I just found also this one in log probably related to Postwhite:

          postfix/postscreen[34560]: error: open /usr/local/etc/postfix/postscreen_spf_whitelist.cidr: No such file or directory
          

          Screenshot_2017-04-11_14-31-48.png
          Screenshot_2017-04-11_14-31-48.png_thumb

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

            @ecfx:

            p.s.
            I just found also this one in log probably related to Postwhite:

            postfix/postscreen[34560]: error: open /usr/local/etc/postfix/postscreen_spf_whitelist.cidr: No such file or directory
            

            Because you need to run /usr/local/bin/postwhite manually first, can't find any code atm in the package, which would trigger it automatically.

            Just running Postfix as a Mail Proxy and my widget stats are very accurate.

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

              no luck:

              /usr/local/bin: ./postwhite
              ./postwhite: Permission denied.
              ...
              /usr/local/bin: ls -la post*
              -rw-r--r--  1 root  wheel  9789 Apr  9 14:59 postwhite
              /usr/local/bin: chmod 755 postwhite
              /usr/local/bin: ls -la post*
              -rwxr-xr-x  1 root  wheel  9789 Apr  9 14:59 postwhite
              /usr/local/bin: ./postwhite
              ./postwhite: Command not found.
              
              
              1 Reply Last reply Reply Quote 0
              • BismarckB
                Bismarck
                last edited by

                nano /usr/local/bin/postwhite
                

                1 line change from

                
                #! /bin/bash
                

                to

                #! /usr/local/bin/bash
                

                next

                fetch -q -o /usr/local/etc/postwhite.conf https://raw.githubusercontent.com/stevejenkins/postwhite/master/postwhite.conf
                

                and

                ln -s /usr/local/etc/postwhite.conf /etc/postwhite.conf
                
                nano /usr/local/etc/postwhite.conf
                
                

                edit paths

                # FILE PATHS
                spftoolspath=/usr/local/bin/spf-tools
                postfixpath=/usr/local/etc/postfix
                postfixbinarypath=/usr/local/sbin
                whitelist=postscreen_spf_whitelist.cidr
                blacklist=postscreen_spf_blacklist.cidr
                yahoo_static_hosts=/usr/local/etc/postfix/yahoo_static_hosts.txt
                

                now run

                /usr/local/bin/postwhite
                

                Good luck!

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

                  Thank you but is exactly the same as before.
                  I can live without postwhite and widget as before…

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

                    @ecfx:

                    Thank you but is exactly the same as before.
                    I can live without postwhite and widget as before…

                    fixed postwhite config file creation and etc path call

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

                    Help a community developer! ;D

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

                      Thanks, the widget shortcuts are handy.  :)

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

                        Can I run "install_postfix_23.sh" script again or I must remove all installed packages first  ::)

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

                          @Igor:

                          Can I run "install_postfix_23.sh" script again or I must remove all installed packages first  ::)

                          As far as I can see, it should not be a issue, just run the script again.

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

                            Included postfwd functions to limit messages per user and time based on package.

                            To use this funcion you must run the install cpan modules script from pkg-mailscanner

                            https://raw.githubusercontent.com/marcelloc/Unofficial-pfSense-packages/master/pkg-mailscanner/files/install_cpan_modules_23.sh

                            Fist time implementation, not used to run postfwd, so feedbacks are always welcome.

                            postfwd.PNG
                            postfwd.PNG_thumb

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

                            Help a community developer! ;D

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

                              @marcelloc:

                              @Bismarck:

                              Yes, but it looks like the widget just counts high scored spam and not all, same when searching for spam in postfix_search.php it just finds high scored spam and the numbers of high scored spam are are always the same in the widget and MailMatch.

                              The point is that database gets the last status from message. 'Normal spam' on your configuration are sent to user, this way, last state is sent, instead of spam.

                              I've pushed a commit that updates the status only when it's not a spam message
                              https://github.com/marcelloc/Unofficial-pfSense-packages/commit/d6dcd6d63ae83886aa9da00f545137fa2cd6b046

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

                              Help a community developer! ;D

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

                                Also, I've include 7zip, rar and PDFID patch to mailscanner package, just re-run  install to get latest updates.

                                Thanks for  Bismarck and danny at tweegy.nl  8)

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

                                Help a community developer! ;D

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

                                  Thanks, I'm not at the office at the moment, will check it out when back.  8)

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

                                    Hey guys, would it be possible to include a pop3 connector like fetchmail or getmail?

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

                                      @Bigdaddy168:

                                      Hey guys, would it be possible to include a pop3 connector like fetchmail or getmail?

                                      There was a package for it(p3scan) but it's too old and abandoned http://p3scan.sourceforge.net

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

                                      Help a community developer! ;D

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

                                        updated but now have two 'Mailscanner' Service menu items… Looks like the check_mailscanner_service.php is looking for menu item 'mailscanner' not 'Mailscanner'...

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

                                          @danjeman:

                                          updated but now have two 'Mailscanner' Service menu items… Looks like the check_mailscanner_service.php is looking for menu item 'mailscanner' not 'Mailscanner'...

                                          Thanks for the feedback. I'll fix it.

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

                                          Help a community developer! ;D

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

                                            Was not getting any sqllite db's from the logs despite all settings being correct then found an old post referencing an issue if you have other characters in the hostname (- for instance which I do). So took a look at postfix.php and updated the regex match looking for date and hostname from:
                                            preg_match("/(\w+\s+\d+\s+[0-9,:]+) (\w+))….. to
                                            preg_match("/(\w+\s+\d+\s+[0-9,:]+) (\w+([.-]?\w+))….... and voilla now have widget and search logs available...

                                            Will verify stats are valid but looks good so far  :)

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