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

    Script not working after 2.2.x upgrade

    Scheduled Pinned Locked Moved General pfSense Questions
    4 Posts 3 Posters 773 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.
    • G Offline
      gazoo
      last edited by

      This is a script to reset states on a specific alias and it used to work under 2.1.x. When I went to 2.2.x it gives an error. Here it is:

      for i in pfctl -t ALIAS -Ts
      do
              echo "Killing states from/to $i"
              pfctl -k $i
      done

      Any ideas?

      1 Reply Last reply Reply Quote 0
      • D Offline
        divsys
        last edited by

        Probably not until you tell us what the error message actually says…...

        -jfp

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

          https://doc.pfsense.org/index.php/How_can_I_see_the_full_PF_ruleset
          So … pfctl -sa : I have these tables:

          TABLES:
          APx
          DVR
          DiskStation
          PowerEdge
          bogons
          bogonsv6
          snort2c
          sshlockout
          virusprot
          webConfiguratorlockout

          This works for me :

          pfctl -t APx -Ts
             192.168.2.2
             192.168.2.3
             192.168.2.4
             192.168.2.5
          
          

          because I have a table named 'APx'.

          I created a script file named test.sh:

          #!/bin/sh
          for i in `pfctl -t APx -Ts`
          do
                  echo "Killing $i"
                  pfctl -k $i
          done
          
          

          (+ chmod +x test.sh)
          and it worked :

          sh test.sh
          Killing 192.168.2.2
          killed 0 states from 1 sources and 0 destinations
          Killing 192.168.2.3
          killed 0 states from 1 sources and 0 destinations
          Killing 192.168.2.4
          killed 0 states from 1 sources and 0 destinations
          Killing 192.168.2.5
          killed 0 states from 1 sources and 0 destinations
          
          

          So, what is it that you didn't tell us ;)

          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 0
          • G Offline
            gazoo
            last edited by

            You're right, I did it again and it worked this time. weird.
            I think it might have been because I left off the #!/bin/sh, don't know.

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