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

    Dynamic modification of the firewall rules

    Firewalling
    3
    4
    2.2k
    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
      john99
      last edited by

      Hello,

      is it possible to have pfsense firewall rules dynamically modificated
      (e.g. for real-time-blacklists, greylisting and upon "request" of SNORT?)

      Thank's a for your feedback!

      John

      1 Reply Last reply Reply Quote 0
      • W
        Waps
        last edited by

        I am searching for a way to modify by script pfsense rules dynamicaly so they can be loaded without restarting the server.

        I know pf has the capability to modify rules without reloading or lossing states.

        I am hosting clients mail server and I want to give internet access only to those who have been authenticated.

        My mail hosting is scripted and 100% automated so manualy opening the web management interface is out of the question. Inputing the rules directly into pf is doable but I know every modification I do, pfsense will overwrite. Modifying pfsense xmlconfig and reloading it is also out of the question because this make the server reboot.

        Are there any API? I saw "pfSense php shell" in the console menu. It looks cool but is lacking in feature right now.

        What i'm thinking on doing is having a cron job(can be add easily in pfsense xml config) run every min or so on the pfsense box. Have it query my automated mail hosting servers, retreive the ip of the servers I want to give access and modify the right rules directly in pf. This will effectively bypass pfsense so I'd like smething more elegant and manageable.

        any thought?
        Thanks
        -Pat

        1 Reply Last reply Reply Quote 0
        • C
          cmb
          last edited by

          @Waps:

          Modifying pfsense xmlconfig and reloading it is also out of the question because this make the server reboot.

          It doesn't have to. You could modify the config file manually then run the PHP that applies ruleset changes. By default that doesn't dump your state table.

          1 Reply Last reply Reply Quote 0
          • W
            Waps
            last edited by

            Thanks a lot! That did the trick!
            -Pat

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