]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
output/lua: better lua output setup error handling 3272/head
authorRichard Sailer <richard_siegfried@systemli.org>
Thu, 22 Feb 2018 00:53:16 +0000 (01:53 +0100)
committerVictor Julien <victor@inliniac.net>
Wed, 7 Mar 2018 08:23:04 +0000 (09:23 +0100)
If suricata was started with --init-errors-fatal and an error occured
during setup of lua output (like if lua scripts configured in the conf file
don't exist or are not readable) suricata continued, which did not reflect
"init errors fatal" very well.

This fix makes the suricata initialization abort and send an error message
in such cases.

For details see:
https://redmine.openinfosecfoundation.org/issues/1503

src/output-lua.c

index 9ed0068799fbb47582c67c35277246e25a313edb..8b5581c6c129d64b1c306938ab0049e4d1f51bc1 100644 (file)
@@ -863,6 +863,18 @@ static OutputInitResult OutputLuaLogInit(ConfNode *conf)
 error:
     if (output_ctx->DeInit)
         output_ctx->DeInit(output_ctx);
+
+    int failure_fatal = 0;
+    if (ConfGetBool("engine.init-failure-fatal", &failure_fatal) != 1) {
+        SCLogDebug("ConfGetBool could not load the value.");
+    }
+    if (failure_fatal) {
+        SCLogError(SC_ERR_LUA_ERROR,
+                   "Error during setup of lua output. Details should be "
+                   "described in previous error messages. Shutting down...");
+        exit(EXIT_FAILURE);
+    }
+
     return result;
 }