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

Suricata auto update for custom rules?

IDS/IPS
3
5
4.9k
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
    jackyes89
    last edited by Mar 28, 2015, 10:41 AM Mar 28, 2015, 10:34 AM

    Hi all
    I have installed suricata,
    now i want to use the SSL blacklist for suricata from abuse.ch ( https://sslbl.abuse.ch/blacklist/sslblacklist.rules )
    I can put this with a copy/paste in the wan/rules->custom.rules to make it working…but there is a way to make updates automatic like ET or VRT?
    can i make a cronjob to download that .rules in /usr/pbi/suricata-amd64/etc/suricata/suricata_41488_re1/rules/custom.rules? then how can i tell to suricato to automaticaly reload the rules? (or it will reload it when there is ET or VRT update?)

    Thanks in advance

    1 Reply Last reply Reply Quote 0
    • F
      fsansfil
      last edited by Mar 28, 2015, 3:43 PM

      They are covered in ET Trojan Rules. Have a look.

      F.

      1 Reply Last reply Reply Quote 0
      • B
        bmeeks
        last edited by Mar 28, 2015, 4:26 PM Mar 28, 2015, 4:13 PM

        @jackyes89:

        Hi all

        …can i make a cronjob to download that .rules in /usr/pbi/suricata-amd64/etc/suricata/suricata_41488_re1/rules/custom.rules? then how can i tell to suricato to automaticaly reload the rules? (or it will reload it when there is ET or VRT update?)

        Thanks in advance

        Yes, you could use a cron task to download that file and save it as the custom.rules file you referenced.  You can then tell Suricata to reload the rules in your cron task.

        Suricata will do what's called a Live Rule Reload if you send it the signal USR2 like this:

        [/
        
        /bin/pkill -USR2 suricata
        
        [/code]
        
        This will cause all Suricata processes to re-read the rules files configured in their respective [i]suricata.yaml[/i] file.
        
        There is one big caveat here, though.  Suricata will overwrite your [i]custom.rules[/i] file the next time it is restarted or if the ET or VRT rules update.  This is because Suricata builds that [i]custom.rules[/i] file from contents stored in the config.xml file.  Here is a slightly better way:
        
        1.  Save your downloaded rules to a file with a different name but in the same path as the [i]custom.rules[/i] file.
        
        2.  Hand-edit the file [b]/usr/local/pkg/suricata/suricata_yaml_template.inc[/b].  Find this section of the file and edit it like this:
        
        [b]As-Found[/b]
        [code]
        
        default-rule-path: {$suricatacfgdir}/rules
        rule-files:
         - {$rules_files}
        
        [/code]
        
        [b]After-Edit[/b]
        [code]
        
        default-rule-path: {$suricatacfgdir}/rules
        rule-files:
         - {$rules_files}
         - myrules.rules
        
        [/code]
        
        You can substitute the actual name for your SSL rules files where I used "myrules.rules".  This edits the template Suricata uses to write the suricata.yaml file, so every time it rebuilds the suricata.yaml for an interface it will include your custom file.  If you run Suricata on multiple interfaces, then you will need to put an empty file with the same name in your other Suricata directories.  If you don't, when their YAML config file is created from the template, they will try to read the "myrules.rules" file, won't be able to find it in their directory, and will error out.
        
        Bill
        
        
        1 Reply Last reply Reply Quote 0
        • J
          jackyes89
          last edited by Mar 28, 2015, 6:29 PM

          Thanks!!! ;D

          1 Reply Last reply Reply Quote 0
          • B
            bmeeks
            last edited by Mar 28, 2015, 10:39 PM

            Oh…and one other small point.  Each time you update the Suricata package (or it gets reinstalled as part of a pfSense update), you will need to repeat the hand-edit of that /usr/local/pkg/suricata/suricata_yaml_template.inc file because it will be overwritten when Suricata is reinstalled.

            Bill

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