]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
datasets: flag to disable "write" actions
authorJason Ish <jason.ish@oisf.net>
Tue, 6 Jun 2023 22:04:56 +0000 (16:04 -0600)
committerVictor Julien <vjulien@oisf.net>
Wed, 14 Jun 2023 05:01:30 +0000 (07:01 +0200)
Add a new configuration flag, "datasets.rules.allow-write" to control
if rules can contain "save" or "state" rules which allow write access
to the file system.

Ticket: #6123

src/detect-dataset.c
suricata.yaml.in

index 3659812affa7af69460e0122e3d6ae640f856341..ca3d5d9711a9a0ee386916cd9f2ca05f16748c68 100644 (file)
@@ -302,6 +302,15 @@ static int SetupSavePath(const DetectEngineCtx *de_ctx,
 {
     SCLogDebug("save %s", save);
 
+    int allow_save = 1;
+    if (ConfGetBool("datasets.rules.allow-write", &allow_save)) {
+        if (!allow_save) {
+            SCLogError(SC_ERR_INVALID_SIGNATURE,
+                    "Rules containing save/state datasets have been disabled");
+            return -1;
+        }
+    }
+
     int allow_absolute = 0;
     (void)ConfGetBool("datasets.rules.allow-absolute-filenames", &allow_absolute);
     if (allow_absolute) {
index e842f42e817dc4e4c5bf8322d43c0e76ca845610..7145b1282ec0bafef135283d8daffe5bf7aca1f6 100644 (file)
@@ -1004,6 +1004,11 @@ asn1-max-frames: 256
 #    # ".." components to reference parent directories in rules that specify
 #    # their filenames.
 #    #allow-absolute-filenames: false
+#
+#    # Allow datasets in rules write access for "save" and
+#    # "state". This is enabled by default, however write access is
+#    # limited to the data directory.
+#    #allow-write: true
 
 ##############################################################################
 ##