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

    A few basic questions about features from a NOOB -

    Scheduled Pinned Locked Moved General pfSense Questions
    62 Posts 12 Posters 17.0k 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.
    • johnpozJ
      johnpoz LAYER 8 Global Moderator
      last edited by

      Well another thing is when are the states being created from your schedule there is 1 minute while its off.  so at 23:59:01 its off til 23:59:59, then turns back on at 00:00

      Just pointing out a possible flaw..  You would need to validate that the states are gone..  Why your email says they are none, but when you check is odd yes.

      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
      • ?
        Guest
        last edited by

        Same game today:

        21:00 firewall block rule
        21:00 eMail report for "pfctl -ss | grep 10.XXX.YYY.ZZZ" COMPLETELY EMPTY
        21:01 Cron job "01  21  *  *  *  root  pfctl -F state"

        so far so good, but

        21:14 I check states for the blocked IP via Diagnostics -> States and find: 32 states alive AS WELL AS by press "SEND NOW" for the eMail Report job for 21:00, same result dozends of states alive…

        I erased the Cron job as well as the eMail report jobs yesterday and made them new. Makes no difference, as you see. Don't know what to do next...

        1 Reply Last reply Reply Quote 0
        • ?
          Guest
          last edited by

          Question:

          Found this in my logs:

          php: rc.start_packages: The command '/usr/local/etc/rc.d/cron.sh stop' returned exit code '1', the output was ''

          Might this result in impaired Cron functionality?

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

            That's not necessarily a problem. Cron is stopped and restarted along with all packages, usually in response to an IP change on one of your interfaces though could be a config change etc. As long as it starts again correctly it shouldn't be causing an issue though you could end up with multiple instances if it wasn't stopped correctly for example.

            Steve

            1 Reply Last reply Reply Quote 0
            • ?
              Guest
              last edited by

              Status -> Services shows Cron as up and running

              Diagnostics -> Sockets shows only one instance for Cron

              Re-installed Cron package, but I still don't see proper functioning, as apparently the states are not killed (pfctl -F state) and the output from eMail reports (performed via Cron jobs) doesn't provide accurate information on the states present.

              No idea why…

              1 Reply Last reply Reply Quote 0
              • ?
                Guest
                last edited by

                ..got an idea why. Question:

                In wich directory are the commands executed in the Diagnosics -> Execute Command window of the GUI?

                Is it /usr/bin/ ?

                That could make my Cron job for killing states work, if I find the right directory to execute the Cron job in…

                1 Reply Last reply Reply Quote 0
                • BBcan177B
                  BBcan177 Moderator
                  last edited by

                  To display the location of your current working directory, enter the command

                  pwd

                  The output should look similar to:

                  /home/user

                  "Experience is something you don't get until just after you need it."

                  Website: http://pfBlockerNG.com
                  Twitter: @BBcan177  #pfBlockerNG
                  Reddit: https://www.reddit.com/r/pfBlockerNG/new/

                  1 Reply Last reply Reply Quote 0
                  • ?
                    Guest
                    last edited by

                    Hey, many thanx!

                    Apparently it's

                    /usr/local/www

                    … I'll try that this evening... :-D

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

                      Make sure you use the absolute path to all the commands in your cron job. That way it doesn't matter where it's executed from.
                      Edit: Or, importantly, that the process executing the cron job may not have the same default paths as a shell prompt.

                      Steve

                      1 Reply Last reply Reply Quote 0
                      • ?
                        Guest
                        last edited by

                        Definitely! But at first you have to know the correct absolute path!  ;)

                        1 Reply Last reply Reply Quote 0
                        • BBcan177B
                          BBcan177 Moderator
                          last edited by

                          Stephen is correct always use absolute paths in the scripts.

                          To find the location of a file, you can run the following command.

                          find / -name pfctl

                          "Experience is something you don't get until just after you need it."

                          Website: http://pfBlockerNG.com
                          Twitter: @BBcan177  #pfBlockerNG
                          Reddit: https://www.reddit.com/r/pfBlockerNG/new/

                          1 Reply Last reply Reply Quote 0
                          • ?
                            Guest
                            last edited by

                            OK, then it should be /sbin/pfctl … Try this today

                            What I really don't understand is the problem with the eMail Reports. When I press "Send Now" at the setup page for the respective job everything is fine and the eMail contains the information on the states for the requested IP. But when the Cron runs the respective php script the eMail contains no states at all... tried the /sbin/ path for the eMail Report command, too, let's see if it works... :-D

                            1 Reply Last reply Reply Quote 0
                            • BBcan177B
                              BBcan177 Moderator
                              last edited by

                              Can you post the commandline?

                              "Experience is something you don't get until just after you need it."

                              Website: http://pfBlockerNG.com
                              Twitter: @BBcan177  #pfBlockerNG
                              Reddit: https://www.reddit.com/r/pfBlockerNG/new/

                              1 Reply Last reply Reply Quote 0
                              • ?
                                Guest
                                last edited by

                                @chemlud:

                                ….
                                21:00 eMail report for "pfctl -ss | grep 10.XXX.YYY.ZZZ" COMPLETELY EMPTY
                                ...

                                ;)

                                Edit: Crazy, I tried the command (without /sbin/) on another box for a different IP (without a block rule at the firewall tab) and there the Cron-sent eMail Report is correct, including the states info for the requested IP. Dunno what's wrong here…

                                1 Reply Last reply Reply Quote 0
                                • BBcan177B
                                  BBcan177 Moderator
                                  last edited by

                                  I set that command to run and it emailed thru without issue. I did include " " around the IP address thou.

                                  /sbin/pfctl -ss | grep "10.XXX.YYY.ZZZ"

                                  "Experience is something you don't get until just after you need it."

                                  Website: http://pfBlockerNG.com
                                  Twitter: @BBcan177  #pfBlockerNG
                                  Reddit: https://www.reddit.com/r/pfBlockerNG/new/

                                  1 Reply Last reply Reply Quote 0
                                  • ?
                                    Guest
                                    last edited by

                                    See my edit above, worked for me without the "" for the IP, but not on the box I need the command to work.  Unfortunately the eMail Report page of the GUI allows no minutes to be entered, so only every full hour the job can be tested…

                                    To be continued... :-)

                                    Edith:

                                    Cron job with

                                    /sbin/pfctl -k 10.XXX.YYY.ZZZ

                                    1 minute after the block rule WORKED! PAAARTY!  8)

                                    And the eMail Report for
                                    pfctl -ss | grep 10.XXX.YYY.ZZZ

                                    gave no output, while

                                    /sbin/pfctl -ss | grep 10.XXX.YYY.ZZZ

                                    correctly reported the states!

                                    Problems solved, Block rule works

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

                                      Persistence pays off!  ;)

                                      Steve

                                      1 Reply Last reply Reply Quote 0
                                      • ?
                                        Guest
                                        last edited by

                                        Yeaaaah, but sometimes you simply need the right path, to look for the solution…  ;D ;)

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

                                          hello,

                                          Let me thank you for using your "pfctl -k ip & cron" solution to be able to use schedule on pfsense 2.1.5 ( because upgrade to 2.2 failed for me… some packages I use in 2.1.5 did not worked any more on 2.2 ) and now I need help if possible:

                                          question is: how to clear only connections that go ( or come ) to specific destination port, I tried to find on internet some help but no luck.

                                          The problem is that children are playing minecraft all day long if possible and I want to clear only the connection with port 25565 used to go to minecraft servers and not all connection established at the expiration time, in case something important is going on background and of course as you know at scheduling expiration rule is not kill established connection on that port.

                                          Anybody who can help ?

                                          thank you

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