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

Create firewall rules by script

Scheduled Pinned Locked Moved Firewalling
5 Posts 4 Posters 795 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.
  • R
    Roberto Bianchi
    last edited by Nov 7, 2019, 1:31 PM

    Hi to all,
    I saw previous topic but I would like to know if with new version I can add rules from external application.
    I woluld like to create a firewall rules that my SIEM known like an attack.

    Can I do that?
    Thanks
    Roberto

    1 Reply Last reply Reply Quote 0
    • N
      NogBadTheBad
      last edited by Nov 7, 2019, 1:34 PM

      Wouldn't you be better installing something like Snort or Suricata and sign up to a paid subscription?

      Andy

      1 x Netgate SG-4860 - 3 x Linksys LGS308P - 1 x Aruba InstantOn AP22

      1 Reply Last reply Reply Quote 0
      • R
        Roberto Bianchi
        last edited by Nov 7, 2019, 1:36 PM

        Hi,
        i have an IDS/IPS system but I wuold like to do this by SIEM and PFsense if it possible.

        Thanks

        K 1 Reply Last reply Nov 8, 2019, 6:04 AM Reply Quote 0
        • K
          Konstanti @Roberto Bianchi
          last edited by Konstanti Nov 8, 2019, 6:06 AM Nov 8, 2019, 6:04 AM

          @Roberto-Bianchi
          Hello
          To dynamically add / remove rules to the firewall you need to use anchors

          https://www.openbsd.org/faq/pf/anchors.html

          PFSense has several anchors for this purpose
          For example, the anchor "userrules"

          # User-defined rules follow
          
          anchor "userrules/*"
          

          According to this principle, a bunch of Fail2ban+Packet Filter works

          root@fr:/usr/local/etc/fail2ban # pfctl -a f2b/SSH -sr
          block drop log quick proto tcp from <f2b-SSH> to any port = ssh
          root@fr:/usr/local/etc/fail2ban # pfctl -a f2b/SSH -t f2b-SSH -Ts
             85.225.16.184
          root@fr:/usr/local/etc/fail2ban # 
          
          
          1 Reply Last reply Reply Quote 0
          • J
            jimp Rebel Alliance Developer Netgate
            last edited by Nov 8, 2019, 1:24 PM

            There is no API for this (yet), though there is the easyrule script which may not help directly, but you could copy its code to potentially setup something.

            Having an IDS inject rules is a fine idea in general, though. We have demonstrated this working in TNSR using its API combined with ERSPAN to feed packets to the IDS: https://github.com/Netgate/TNSR_IDS/

            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
            1 out of 5
            • First post
              1/5
              Last post
            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
              This community forum collects and processes your personal information.
              consent.not_received