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.2m 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
      n3by
      last edited by

      I think I am in the same situation as I have some hosts and email addresses that contain " - " and widget is not updating.

      Can you please be more specific where in the file and what to change/patch as searching for

      preg_match("/(\w+\s+\d+\s+[0-9,:]+) (\w+)
      ```=```
      preg_match("/(\\w+\\s+\\d+\\s+[0-9,:]+) (\\w+)
      ```find many instances of that code.
      
      Please use "Insert Code" to preserve the format.
      
      thank you.
      1 Reply Last reply Reply Quote 0
      • marcellocM
        marcelloc
        last edited by

        @ecfx:

        Can you please be more specific where in the file and what to change/patch.

        At the beginning of every log pregmatch under /usr/local/www/postfix.php

        I'll modify it to get hostname from system or xml

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

        Help a community developer! ;D

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

          This is just for matching the system hostname from the log…

          There are 10 instances of that code at lines 253, 263, 275, 284, 295, 300, 305, 309, 319 and 357. Each one is parsing for a particular process log (postfix/smtpd, Mailscanner etc)

          Replace

          preg_match("/(\w+\s+\d+\s+[0-9,:]+) (\w+)
          

          with

          preg_match("/(\w+\s+\d+\s+[0-9,:]+) (\w+([\.-]?\w+))
          

          There's probably a neater way to get the hostname but this does the job for my case at least.

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

            Thank you now is clear, patched.

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

              Ok so widget crashed now due to memory allocation error… also not seeing any sent mails being logged but that could be configuration error (or will it not log those?)...

              
              					Crash report begins.  Anonymous machine information:
              
              amd64
              10.3-RELEASE-p17
              FreeBSD 10.3-RELEASE-p17 #10 6da131e75c7(RELENG_2_3_3): Wed Mar  8 14:24:33 CST 2017     root@ce23-amd64-builder:/builder/pfsense-233/tmp/obj/builder/pfsense-233/tmp/FreeBSD-src/sys/pfSense
              
              Crash report details:
              
              PHP Errors:
              [19-Apr-2017 12:47:34 Europe/London] PHP Fatal error:  Allowed memory size of 262144000 bytes exhausted (tried to allocate 1262797654 bytes) in 
              
              /usr/local/www/widgets/widgets/postfix.widget.php on line 146
              [19-Apr-2017 12:47:34 Europe/London] PHP Stack trace:
              [19-Apr-2017 12:47:34 Europe/London] PHP   1\. {main}() /usr/local/www/index.php:0
              [19-Apr-2017 12:47:34 Europe/London] PHP   2\. include_once() /usr/local/www/index.php:438
              [19-Apr-2017 12:48:41 Europe/London] PHP Fatal error:  Allowed memory size of 262144000 bytes exhausted (tried to allocate 1262797654 bytes) in /usr/local/www/widgets/widgets/postfix.widget.php on line 146
              [19-Apr-2017 12:48:41 Europe/London] PHP Stack trace:
              [19-Apr-2017 12:48:41 Europe/London] PHP   1\. {main}() /usr/local/www/index.php:0
              [19-Apr-2017 12:48:41 Europe/London] PHP   2\. include_once() /usr/local/www/index.php:438
              
              Filename: /var/crash/minfree
              2048
              
              1 Reply Last reply Reply Quote 0
              • marcellocM
                marcelloc
                last edited by

                What is the max file size you configured for widget?

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

                Help a community developer! ;D

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

                  Left it blank so assuming default of 100mb? Will specify and test again.

                  Currently files are less than 1M each and only 4 of them…

                  
                  -rw-r--r--  1 root     postfix   200K Apr 18 17:05 2017-04-15.db
                  -rw-r--r--  1 root     postfix   184K Apr 18 16:31 2017-04-17.db
                  -rw-r--r--  1 root     postfix   516K Apr 19 14:18 2017-04-18.db
                  -rw-r--r--  1 root     postfix   976K Apr 19 14:20 2017-04-19.db
                  
                  

                  EDIT: Also noticed widget only has one line with yesterday's date although the totals and reject and spam stats are increasing…

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

                    Just noticed on the Access Lists page I couldn't edit sender, MIME or body filters and spotted the 'a' tag was still open… Line 109 of /usr/local/pkg/postfix_acl.xml is missing the closing tag

                    <description>PCRE filters [that are applied to initial message helo info. Hint:
                    [/code]
                    
                    Should be
                    [code]<description>PCRE filters</description>](http://www.postfix.org/pcre_table.5.html) [that are applied to initial message helo info.](http://www.postfix.org/pcre_table.5.html) Hint:
                    [/code][/code]</description>
                    
                    1 Reply Last reply Reply Quote 0
                    • marcellocM
                      marcelloc
                      last edited by

                      @danjeman:

                      Just noticed on the Access Lists page I couldn't edit sender, MIME or body filters and spotted the 'a' tag was still open… Line 109 of /usr/local/pkg/postfix_acl.xml is missing the closing tag

                      Fixed. Thanks for the feedback

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

                      Help a community developer! ;D

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

                        @danjeman:

                        Ok so widget crashed now due to memory allocation error…

                        I've updated the widget file to allow more php memory use.

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

                        Help a community developer! ;D

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

                          @danjeman:

                          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

                          I've changed the preg_match from (\w+) to (\S+)

                          https://github.com/marcelloc/Unofficial-pfSense-packages/commit/0893d4a2e523688ccd56d419ff1d7c8be5c51cd2

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

                          Help a community developer! ;D

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

                            @marcelloc:

                            I've changed the preg_match from (\w+) to (\S+)

                            https://github.com/marcelloc/Unofficial-pfSense-packages/commit/0893d4a2e523688ccd56d419ff1d7c8be5c51cd2

                            Re- ran the installer and all looks good so far, thanks! :)

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

                              Noticed that the options for 'SPF lookup HELO' and 'SPF lookup Mail From' are missing 'Fail' option..

                              Looks like option Null for 'HELO' has value Fail set as well as option Fail so 'Fail' never displays (also would mean selecting Null didn't do what you expect).

                              For 'Mail From' option Null shouldn't be an option (according to the commented policyd-spf.conf) so removing this will correct the available options.

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

                                @danjeman:

                                Noticed that the options for 'SPF lookup HELO' and 'SPF lookup Mail From' are missing 'Fail' option..

                                Looks like option Null for 'HELO' has value Fail set as well as option Fail so 'Fail' never displays (also would mean selecting Null didn't do what you expect).

                                For 'Mail From' option Null shouldn't be an option (according to the commented policyd-spf.conf) so removing this will correct the available options.

                                thanks for the pull request on github  :)

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

                                Help a community developer! ;D

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

                                  Widget start to display strange data…

                                  ![2017-04-22 20.53.41.jpg](/public/imported_attachments/1/2017-04-22 20.53.41.jpg)
                                  ![2017-04-22 20.53.41.jpg_thumb](/public/imported_attachments/1/2017-04-22 20.53.41.jpg_thumb)
                                  ![2017-04-22 18.48.31.jpg](/public/imported_attachments/1/2017-04-22 18.48.31.jpg)
                                  ![2017-04-22 18.48.31.jpg_thumb](/public/imported_attachments/1/2017-04-22 18.48.31.jpg_thumb)

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

                                    Are you waiting first refresh?

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

                                    Help a community developer! ;D

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

                                      Looks good so far here. :)

                                      marcelloc postfwd pkg is missing in the setup script? I've installed it manually and set postfwd.cf and the port to 10045 in the rc file, now its running.

                                      ![2017-04-22 19.41.54.png](/public/imported_attachments/1/2017-04-22 19.41.54.png)
                                      ![2017-04-22 19.41.54.png_thumb](/public/imported_attachments/1/2017-04-22 19.41.54.png_thumb)

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

                                        @Bismarck:

                                        Looks good so far here. :)

                                        marcelloc postfwd pkg is missing in the setup script? I

                                        I'll check but I remember including it on install script. Maybe I forgot to push it to GitHub repo

                                        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:

                                          I'll check but I remember including it on install script. Maybe I forgot to push it to GitHub repo

                                          Gui creates the file when there are rules on it. what's the behavior on your box?

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

                                          Help a community developer! ;D

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

                                            @marcelloc:

                                            @marcelloc:

                                            I'll check but I remember including it on install script. Maybe I forgot to push it to GitHub repo

                                            Gui creates the file when there are rules on it. what's the behavior on your box?

                                            I had to manually install postfix-postfwd-1.35_1 to make it run and listen on 127.0.0.1:10045, otherwise postfix will give warnings about it.

                                            Apr 21 16:40:16 zonk postfix/smtpd[4740]: warning: connect to 127.0.0.1:10045: Operation timed out
                                            Apr 21 16:40:16 zonk postfix/smtpd[4740]: warning: problem talking to server 127.0.0.1:10045: Operation timed out
                                            
                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.