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

    Pfctl

    Scheduled Pinned Locked Moved Firewalling
    4 Posts 2 Posters 2.2k 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.
    • J Offline
      jeremie3
      last edited by

      Hello,

      I use pfctl to dynamically add rules.

      Is there a risk that this doesn't add all rules ?

      (pfctl -sr; echo "pass XXX...") | pfctl -f -
      

      Might it be better to do :

      (cat /tmp/rules.debug; echo "pass XXX…") | pfctl -f -

      ??

      1 Reply Last reply Reply Quote 0
      • jimpJ Offline
        jimp Rebel Alliance Developer Netgate
        last edited by

        The danger is at any time the pfSense ruleset could be reloaded and wipe out all your stuff.

        Best thing might be to hack an anchor in filter.inc and then inject your rules into the anchor rather than into the main ruleset.

        Or setup a normal rule that uses an alias to reference things rather than IPs and then use pfctl to manipulate the contents of the table.

        Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

        Need help fast? Netgate Global Support!

        Do not Chat/PM for help!

        1 Reply Last reply Reply Quote 0
        • J Offline
          jeremie3
          last edited by

          I have to put my rules in /etc/inc/filter.inc ?

          Currently, I use an anchor to load rules.

          pfctl -a userrules/mySubAnchor -f myFicOfRules
          

          and it works fine and there is no danger that

          at any time the pfSense ruleset could be reloaded and wipe out all your stuff

          except rules don't appear in pfSense Web GUI.

          Rules will appear in Web GUI if I alter filter.inc ?

          PS : Sorry for my english and thank you for responding

          1 Reply Last reply Reply Quote 0
          • jimpJ Offline
            jimp Rebel Alliance Developer Netgate
            last edited by

            No that will not make them show in the GUI.

            Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

            Need help fast? Netgate Global Support!

            Do not Chat/PM for help!

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