]> git.ipfire.org Git - thirdparty/suricata-update.git/commitdiff
when testing suricata, use provided suricata-conf
authorJason Ish <ish@unx.ca>
Tue, 12 Dec 2017 20:38:11 +0000 (14:38 -0600)
committerJason Ish <ish@unx.ca>
Tue, 12 Dec 2017 20:38:11 +0000 (14:38 -0600)
Previously no suricata.yaml was specified for the test,
so the default was picked up.

suricata/update/engine.py
suricata/update/main.py

index 82c0474a01f28b7e6155c5043475c218621f5a07..538804541a3fe2dc04d6334084f908a006d9f8b8 100644 (file)
@@ -121,13 +121,15 @@ def get_version(path=None):
         return parse_version(output)
     return None
 
-def test_configuration(path, rule_filename=None):
+def test_configuration(suricata_path, suricata_conf=None, rule_filename=None):
     """Test the Suricata configuration with -T."""
     test_command = [
-        path,
+        suricata_path,
         "-T",
         "-l", "/tmp",
     ]
+    if suricata_conf:
+        test_command += ["-c", suricata_conf]
     if rule_filename:
         test_command += ["-S", rule_filename]
 
@@ -139,6 +141,7 @@ def test_configuration(path, rule_filename=None):
         "ASAN_OPTIONS": "detect_leaks=0",
     }
 
+    logger.debug("Running %s; env=%s", " ".join(test_command), str(env))
     rc = subprocess.Popen(test_command, env=env).wait()
     if rc == 0:
         return True
index 0070d7724d7c966a7d6d8a1be476de63f91374a8..bddd152080f6ed401dfb9ba4bf8531c7c8f64516 100644 (file)
@@ -804,14 +804,16 @@ def test_suricata(suricata_path):
             return False
     else:
         logger.info("Testing with suricata -T.")
+        suricata_conf = config.get("suricata-conf")
         if not config.get("no-merge"):
             if not suricata.update.engine.test_configuration(
-                    suricata_path, os.path.join(
+                    suricata_path, suricata_conf,
+                    os.path.join(
                         config.get_output_dir(), DEFAULT_OUTPUT_RULE_FILENAME)):
                 return False
         else:
             if not suricata.update.engine.test_configuration(
-                    suricata_path):
+                    suricata_path, suricata_conf):
                 return False
 
     return True