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

    state counters, firewall rules resetting?

    Scheduled Pinned Locked Moved General pfSense Questions
    32 Posts 9 Posters 8.3k 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.
    • B
      bigsy @johnpoz
      last edited by bigsy

      @johnpoz Do you have the patch for redmine #14016 applied?

      I had a problem on 23.01 with pfBlocker IP counters resetting overnight until I applied this. I didn't notice the firewall counters. Something in the default cron jobs must have been resetting it?

      J T johnpozJ 3 Replies Last reply Reply Quote 3
      • J
        jdeloach @bigsy
        last edited by jdeloach

        This post is deleted!
        1 Reply Last reply Reply Quote 0
        • T
          tman222 @bigsy
          last edited by

          @bigsy said in state counters, firewall rules resetting?:

          @johnpoz Do you have the patch for redmine #14016 applied?

          I had a problem on 23.01 with pfBlocker IP counters resetting overnight until I applied this. I didn't notice the firewall counters. Something in the default cron jobs must have been resetting it?

          Thanks @bigsy for calling out this patch. I have been running into the same issue (pfBlockerNG IP counters resetting overnight) and then noticed similar to @johnpoz that my traffic counters didn't make sense. Applied the patch and will monitor to see if that has hopefully fixed it.

          Relevant thread:
          https://forum.netgate.com/topic/178107/23-01-periodic-scripts-have-been-re-enabled-and-are-broken/5

          T 1 Reply Last reply Reply Quote 0
          • johnpozJ
            johnpoz LAYER 8 Global Moderator @bigsy
            last edited by johnpoz

            @bigsy I think you might of found it, I do have 2 patches installed for state issues

            https://github.com/pfsense/pfsense/commit/d9fa4584e3fb63d6051e9f1db7655f931cb1be19.patch

            and one I manually applied

            diff --git a/blah/usr/local/www/rrd_fetch_json.php b/blah/usr/local/www/rrd_fetch_json.php
            index df0401f96e89..4d7574819ac9 100644
            --- a/blah/usr/local/www/rrd_fetch_json.php
            +++ b/blah/usr/local/www/rrd_fetch_json.php
            @@ -226,7 +226,8 @@ foreach ($side as $settings) {
                                            $ds = "state changes";
                                            break;
                                    case "pfnat":
            -                               $ignore = true;
            +                               $unit_acronym = "";
            +                               $ds = "NAT states";
                                            break;
                                    case "inpass":
                                            $ninetyfifth = true;
            

            Looking into the details now.

            edit: ok applied ff715efce5e6c65b3d49dc2da7e1bdc437ecbf12 lets see if resets tonight or next couple of days.

            An intelligent man is sometimes forced to be drunk to spend time with his fools
            If you get confused: Listen to the Music Play
            Please don't Chat/PM me for help, unless mod related
            SG-4860 24.11 | Lab VMs 2.8, 24.11

            GertjanG 1 Reply Last reply Reply Quote 0
            • stephenw10S
              stephenw10 Netgate Administrator
              last edited by

              Same here. Let's see....

              1 Reply Last reply Reply Quote 0
              • GertjanG
                Gertjan @johnpoz
                last edited by

                @johnpoz said in state counters, firewall rules resetting?:

                edit: ok applied ff715efce5e6c65b3d49dc2da7e1bdc437ecbf12

                I had that one already active.
                My counter are still good / plausible.

                No "help me" PM's please. Use the forum, the community will thank you.
                Edit : and where are the logs ??

                johnpozJ 1 Reply Last reply Reply Quote 0
                • johnpozJ
                  johnpoz LAYER 8 Global Moderator @Gertjan
                  last edited by

                  @gertjan nope reset...

                  WTF???

                  An intelligent man is sometimes forced to be drunk to spend time with his fools
                  If you get confused: Listen to the Music Play
                  Please don't Chat/PM me for help, unless mod related
                  SG-4860 24.11 | Lab VMs 2.8, 24.11

                  B GertjanG 2 Replies Last reply Reply Quote 0
                  • B
                    bigsy @johnpoz
                    last edited by

                    @johnpoz Did you reboot or trigger a rewrite of the cron config after applying the patch per this link?

                    johnpozJ 1 Reply Last reply Reply Quote 0
                    • johnpozJ
                      johnpoz LAYER 8 Global Moderator @bigsy
                      last edited by johnpoz

                      @bigsy valid point - I did not reboot.. That is the only way to redo the crons? Got to be a better way ;)

                      ok - I went in and did a save on couple crons, without changing anything... This should of kicked them in, but no I didn't do that after apply the patch. Did that now.. Lets see..

                      An intelligent man is sometimes forced to be drunk to spend time with his fools
                      If you get confused: Listen to the Music Play
                      Please don't Chat/PM me for help, unless mod related
                      SG-4860 24.11 | Lab VMs 2.8, 24.11

                      1 Reply Last reply Reply Quote 0
                      • GertjanG
                        Gertjan @johnpoz
                        last edited by

                        @johnpoz

                        You have (default I guess) :

                        8453eb24-f5d3-4e41-92e7-43437e32afca-image.png

                        I have

                        34a69239-650c-4f7f-bb43-9dae2375e33c-image.png

                        Which says : ones a day, at minute 15.
                        as I'm not trying to update my single DNSBL (ADs_basic) that often - it's actually set to 'Weekly'.

                        Which means my pfBlockerng tries to actually update my single list ones a week.

                        I'll do a force update .... nothing changed.

                        Btw : take note : I have no IP feeds so no pfBlockerng firewall rules what so ever. My floating pane is empty.

                        No "help me" PM's please. Use the forum, the community will thank you.
                        Edit : and where are the logs ??

                        johnpozJ 1 Reply Last reply Reply Quote 0
                        • johnpozJ
                          johnpoz LAYER 8 Global Moderator @Gertjan
                          last edited by johnpoz

                          @gertjan said in state counters, firewall rules resetting?:

                          Which says : ones a day, at minute 15.

                          No not minute - that is hour.

                          hour.jpg

                          15 is 3pm for non 24 hour clock people ;)

                          Something lost in translation with the cron setting in pfblocker it seems..

                          An intelligent man is sometimes forced to be drunk to spend time with his fools
                          If you get confused: Listen to the Music Play
                          Please don't Chat/PM me for help, unless mod related
                          SG-4860 24.11 | Lab VMs 2.8, 24.11

                          GertjanG 1 Reply Last reply Reply Quote 0
                          • GertjanG
                            Gertjan @johnpoz
                            last edited by Gertjan

                            @johnpoz said in state counters, firewall rules resetting?:

                            non 24 hour clock people ;)

                            By any chance, are these flat-earthers related ?
                            I was told a day has 24 hours.

                            Anyway :

                            240388e9-3e48-4ab3-985f-64cf198e44fe-image.png

                            What I make of it : "15 minutes after midnight".
                            If it's something else : fine to me 😊

                            No "help me" PM's please. Use the forum, the community will thank you.
                            Edit : and where are the logs ??

                            johnpozJ 1 Reply Last reply Reply Quote 0
                            • bingo600B
                              bingo600
                              last edited by bingo600

                              I just applied the patch

                              This is my Crontab after applying the patch , but nothing else

                              Pre-Reroot
                              
                              /root: vi /etc/crontab
                              
                              # /etc/crontab - root's crontab for FreeBSD
                              #
                              # $FreeBSD$
                              #
                              SHELL=/bin/sh
                              PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
                              #
                              15      4       *       *       6       root    periodic weekly
                              30      5       1       *       *       root    periodic monthly
                              #
                              # Adjust the time zone if the CMOS clock keeps local time, as opposed to
                              #
                              # pfSense specific crontab entries
                              # Created: March 10, 2023, 7:06 am
                              #
                              
                              1,31    0-5     *       *       *       root    /usr/bin/nice -n20 adjkerntz -a
                              1       3       1       *       *       root    /usr/bin/nice -n20 /etc/rc.update_bogons.sh
                              1       1       *       *       *       root    /usr/bin/nice -n20 /etc/rc.dyndns.update
                              */60    *       *       *       *       root    /usr/bin/nice -n20 /usr/local/sbin/expiretable -v -t 3600 virusprot
                              30      12      *       *       *       root    /usr/bin/nice -n20 /etc/rc.update_urltables
                              1       0       *       *       *       root    /usr/bin/nice -n20 /etc/rc.update_pkg_metadata
                              */1     *       *       *       *       root    /usr/sbin/newsyslog
                              1       3       *       *       *       root    /etc/rc.periodic daily
                              15      4       *       *       6       root    /etc/rc.periodic weekly
                              30      5       1       *       *       root    /etc/rc.periodic monthly
                              */1     *       *       *       *       root    /usr/local/pkg/servicewatchdog_cron.php
                              #
                              # If possible do not add items to this file manually.
                              # If done so, this file must be terminated with a blank line (e.g. new line)
                              #
                              
                              :q!
                              
                              

                              Same contents after restarting Cron aka no change in the jobs

                              /root: /etc/rc.d/cron restart
                              Stopping cron.
                              Waiting for PIDS: 31184.
                              

                              I did a "Reroot" , and didn't even loose my webradio stream 👍

                              Post Reroot
                              #
                              # pfSense specific crontab entries
                              # Created: March 10, 2023, 11:59 am
                              #
                              SHELL=/bin/sh
                              PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
                              
                              1,31    0-5     *       *       *       root    /usr/bin/nice -n20 adjkerntz -a
                              1       3       1       *       *       root    /usr/bin/nice -n20 /etc/rc.update_bogons.sh
                              1       1       *       *       *       root    /usr/bin/nice -n20 /etc/rc.dyndns.update
                              */60    *       *       *       *       root    /usr/bin/nice -n20 /usr/local/sbin/expiretable -v -t 3600 virusprot
                              30      12      *       *       *       root    /usr/bin/nice -n20 /etc/rc.update_urltables
                              1       0       *       *       *       root    /usr/bin/nice -n20 /etc/rc.update_pkg_metadata
                              */1     *       *       *       *       root    /usr/sbin/newsyslog
                              1       3       *       *       *       root    /etc/rc.periodic daily
                              15      4       *       *       6       root    /etc/rc.periodic weekly
                              30      5       1       *       *       root    /etc/rc.periodic monthly
                              */1     *       *       *       *       root    /usr/local/pkg/servicewatchdog_cron.php
                              #
                              # DO NOT EDIT THIS FILE MANUALLY!
                              # Use the cron package or create files in /etc/cron.d/.
                              #
                              
                              
                              

                              That cleaned up the crontab file

                              Seems like this is taken out by the patch

                              #
                              15      4       *       *       6       root    periodic weekly
                              30      5       1       *       *       root    periodic monthly
                              #
                              # Adjust the time zone if the CMOS clock keeps local time, as opposed to
                              #
                              

                              /Bingo

                              If you find my answer useful - Please give the post a 👍 - "thumbs up"

                              pfSense+ 23.05.1 (ZFS)

                              QOTOM-Q355G4 Quad Lan.
                              CPU  : Core i5 5250U, Ram : 8GB Kingston DDR3LV 1600
                              LAN  : 4 x Intel 211, Disk  : 240G SAMSUNG MZ7L3240HCHQ SSD

                              1 Reply Last reply Reply Quote 0
                              • johnpozJ
                                johnpoz LAYER 8 Global Moderator @Gertjan
                                last edited by

                                @gertjan said in state counters, firewall rules resetting?:

                                I was told a day has 24 hours.

                                It does 0 to 23 ;)

                                What version are you on - your cron package looks different than mine.

                                An intelligent man is sometimes forced to be drunk to spend time with his fools
                                If you get confused: Listen to the Music Play
                                Please don't Chat/PM me for help, unless mod related
                                SG-4860 24.11 | Lab VMs 2.8, 24.11

                                GertjanG 1 Reply Last reply Reply Quote 1
                                • stephenw10S
                                  stephenw10 Netgate Administrator
                                  last edited by

                                  Ha, same! I can fail to follow instructions like any user. 🙄

                                  You should just be able to remove those cron jobs and the patch would prevent them being re-added.

                                  Steve

                                  johnpozJ 1 Reply Last reply Reply Quote 0
                                  • johnpozJ
                                    johnpoz LAYER 8 Global Moderator @stephenw10
                                    last edited by

                                    @stephenw10 haha - yeah I can not follow instructions with the best of them... Users have nothing on me when it comes to not paying attention or missing details that is for sure.

                                    So ELI5 - why wouldn't the patch remove old crons if they are not needed.. So we are suppose to manually remove those daily, weekly, monthly crons?

                                    I went in and saved cron job, and even restarted the cron services - I still how them in the cron package - am I suppose to delete them? And then restart cron?

                                    An intelligent man is sometimes forced to be drunk to spend time with his fools
                                    If you get confused: Listen to the Music Play
                                    Please don't Chat/PM me for help, unless mod related
                                    SG-4860 24.11 | Lab VMs 2.8, 24.11

                                    1 Reply Last reply Reply Quote 0
                                    • GertjanG
                                      Gertjan @johnpoz
                                      last edited by Gertjan

                                      @johnpoz said in state counters, firewall rules resetting?:

                                      What version are you on - your cron package looks different than mine

                                      fec4138b-85db-43c8-9e0b-e6d26a11fdfb-image.png

                                      On
                                      23.01-RELEASE (amd64)
                                      built on Fri Feb 10 20:06:33 UTC 2023
                                      FreeBSD 14.0-CURRENT

                                      Original pfSense theme.

                                      edit :

                                      This
                                      0f7f3b18-c2da-451d-be41-1b1fae6f3850-image.png

                                      is from the main pfBlockerng page.

                                      No "help me" PM's please. Use the forum, the community will thank you.
                                      Edit : and where are the logs ??

                                      johnpozJ 1 Reply Last reply Reply Quote 0
                                      • johnpozJ
                                        johnpoz LAYER 8 Global Moderator @Gertjan
                                        last edited by

                                        @gertjan ah - not sure why your pfblocker is set to 15 minutes, while mine is set to 15 for the hour..

                                        I think that was what was throwing me - you had 15 in the minute in your cron, but mine is on the hour..

                                        An intelligent man is sometimes forced to be drunk to spend time with his fools
                                        If you get confused: Listen to the Music Play
                                        Please don't Chat/PM me for help, unless mod related
                                        SG-4860 24.11 | Lab VMs 2.8, 24.11

                                        1 Reply Last reply Reply Quote 0
                                        • T
                                          tman222 @tman222
                                          last edited by

                                          @tman222 said in state counters, firewall rules resetting?:

                                          @bigsy said in state counters, firewall rules resetting?:

                                          @johnpoz Do you have the patch for redmine #14016 applied?

                                          I had a problem on 23.01 with pfBlocker IP counters resetting overnight until I applied this. I didn't notice the firewall counters. Something in the default cron jobs must have been resetting it?

                                          Thanks @bigsy for calling out this patch. I have been running into the same issue (pfBlockerNG IP counters resetting overnight) and then noticed similar to @johnpoz that my traffic counters didn't make sense. Applied the patch and will monitor to see if that has hopefully fixed it.

                                          Relevant thread:
                                          https://forum.netgate.com/topic/178107/23-01-periodic-scripts-have-been-re-enabled-and-are-broken/5

                                          After a couple of days of monitoring, it looks like the patch did the trick. No more counter resets on pfBlockerNG and traffic totals also look more reasonable.

                                          1 Reply Last reply Reply Quote 2
                                          • GertjanG
                                            Gertjan @Gertjan
                                            last edited by Gertjan

                                            @gertjan

                                            Partial reset : LAN :

                                            418dd979-67f2-4ce9-ad40-db4105d7312a-image.png

                                            edit : or a total reset of all counters, and IPv6 is 75 % of all outbound traffic 😊

                                            No "help me" PM's please. Use the forum, the community will thank you.
                                            Edit : and where are the logs ??

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