]> git.ipfire.org Git - thirdparty/suricata-update.git/commitdiff
update.yaml: sources is now just a URL list
authorJason Ish <ish@unx.ca>
Wed, 29 Nov 2017 22:38:24 +0000 (16:38 -0600)
committerJason Ish <ish@unx.ca>
Fri, 1 Dec 2017 17:31:38 +0000 (11:31 -0600)
suricata/update/configs/update.yaml
suricata/update/main.py

index 144801295d9aa7b72be19c89e4f2e21b33fe08ed..ad6e5a7478bf3bc11ea248e213f09f5b49126f08 100644 (file)
@@ -35,16 +35,12 @@ ignore:
 # May be overrided by the --reload-command command line option.
 #reload-command: sudo systemctl reload suricata
 
-# Remote rule sources.
+# Remote rule sources. Simply a list of URLs.
 sources:
-  # Emerging Threats Open
-  - source: etopen
-  # Emerging Threats Pro
-  - source: etpro
-    code: xxxxx
-  # A URL
-  - source: url
-    url: https://sslbl.abuse.ch/blacklist/sslblacklist.rules
+  # Emerging Threats Open with the Suricata version dynamically replaced.
+  - https://rules.emergingthreats.net/open/suricata-%(__version__)s/emerging.rules.tar.gz
+  # The SSL blacklist, which is just a standalone rule file.
+  - https://sslbl.abuse.ch/blacklist/sslblacklist.rules
 
 # A list of local rule sources. Each entry can be a rule file, a
 # directory or a wild card specification.
index 2905f6645bf13f0ff13fc1b878414f7adc7a9883..a324aa5bf40e4423d6accad1deda1f4d94f94063 100644 (file)
@@ -961,31 +961,16 @@ def load_sources(config, suricata_version):
             urls.append(url)
 
     if config.get("sources"):
-        for source in config.get("sources"):
-            source_name = None
-            if "source" in source :
-                source_name = source["source"]
-            else:
-                logger.error("Source is missing the \"source\" field.")
-                continue
-
-            if source_name == "url":
-                urls.append(source["url"])
-            elif source_name == "etopen":
-                urls.append(resolve_etopen_url(suricata_version))
-            else:
-                logger.error(
-                    "Unknown source: %s; "
-                    "try running suricata-update update-sources",
-                    source["source"])
-
-    # If no URLs, default to ET/Open.
-    if not urls:
-        logger.info("No sources configured, will use Emerging Threats Open")
-        urls.append(resolve_etopen_url(suricata_version))
+        for url in config.get("sources"):
+            url = url % internal_params
+            logger.debug("Adding source %s.", url)
+            urls.append(url)
 
-    # If --etopen is on the command line, make sure its added.
-    if config.get("etopen"):
+    # If --etopen is on the command line, make sure its added. Or if
+    # there are no URLs, default to ET/Open.
+    if config.get("etopen") or not urls:
+        if not urls:
+            logger.info("No sources configured, will use Emerging Threats Open")
         urls.append(resolve_etopen_url(suricata_version))
 
     # Converting the URLs to a set removed dupes.