Its always built-in. However, can be disabled at runtime.
git -c advice.detachedHead=false checkout FETCH_HEAD
- run: ./autogen.sh
- - run: ./configure --enable-warnings --disable-lua
+ - run: ./configure --enable-warnings
- run: make -j ${{ env.CPUS }}
- run: python3 ./suricata-verify/run.py -q --debug-failed
- run: make install-full
git checkout $rev
echo "Building rev ${rev}" | tee -a build_log.txt
./autogen.sh >> build_log.txt 2>&1
- CC="sccache gcc" ./configure --enable-warnings --enable-unittests --disable-lua >> build_log.txt 2>&1
+ CC="sccache gcc" ./configure --enable-warnings --enable-unittests >> build_log.txt 2>&1
if ! make -j2 >> build_log.txt 2>&1; then
echo "::error ::Failed to build rev ${rev}"
tail -n 50 build_log.txt
shell: bash {0}
- run: git clone https://github.com/OISF/libhtp -b 0.5.x
- run: ./autogen.sh
- - run: ./configure --enable-warnings --enable-unittests --disable-lua
+ - run: ./configure --enable-warnings --enable-unittests
- name: Check formatting
run: |
./scripts/clang-format.sh check-branch --diffstat --show-commits >> check_formatting_log.txt 2>&1
fi
fi
- # Lua support, always enabled
- # TODO: Update the code to not require this.
- AC_DEFINE([HAVE_LUA], [1], [lua support available])
- AM_CONDITIONAL([HAVE_LUA], [true])
-
# libmaxminddb
AC_ARG_ENABLE(geoip,
AS_HELP_STRING([--enable-geoip],[Enable GeoIP2 support]),
hiredis support: ${enable_hiredis}
hiredis async with libevent: ${enable_hiredis_async}
PCRE jit: ${pcre2_jit_available}
- LUA support: ${enable_lua}
GeoIP2 support: ${enable_geoip}
JA3 support: ${enable_ja3}
JA4 support: ${enable_ja4}
debug = true
[features]
-lua = []
strict = []
debug = []
debug-validate = []
NIGHTLY_ARGS = -Z build-std
endif
-if HAVE_LUA
-RUST_FEATURES += lua $(LUA_INT8)
-endif
-
if HAVE_JA3
RUST_FEATURES += ja3
endif
pub mod dns;
pub mod log;
pub mod parser;
-
-#[cfg(feature = "lua")]
pub mod lua;
pub mod ja4;
-#[cfg(feature = "lua")]
pub mod lua;
pub mod dns;
pub mod nfs3;
pub mod nfs4;
pub mod log;
-
-//#[cfg(feature = "lua")]
-//pub mod lua;
pub mod auth;
pub mod files;
pub mod funcs;
-
-//#[cfg(feature = "lua")]
-//pub mod lua;
#include "app-layer-dnp3.h"
#include "app-layer-dnp3-objects.h"
-#ifdef HAVE_LUA
-
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
}
}
-#endif /* HAVE_LUA */
-
"""
output_json_dnp3_objects_template = """/* Copyright (C) 2015 Open Information Security Foundation
g_dns_query_buffer_id = DetectBufferTypeGetByName("dns_query");
-#ifdef HAVE_LUA
/* register these generic engines from here for now */
DetectAppLayerInspectEngineRegister(
"dns_request", ALPROTO_DNS, SIG_FLAG_TOSERVER, 1, DetectEngineInspectGenericList, NULL);
DetectBufferTypeSetDescriptionByName("dns_request",
"dns requests");
- DetectBufferTypeSetDescriptionByName("dns_response",
- "dns responses");
-#endif
+ DetectBufferTypeSetDescriptionByName("dns_response", "dns responses");
}
#include "util-unittest-helper.h"
#include "util-profiling.h"
-#ifdef HAVE_LUA
#include "util-lua.h"
-#endif
#ifdef UNITTESTS
thread_local uint32_t ut_inspection_recursion_counter = 0;
goto match;
}
goto no_match_discontinue;
-#ifdef HAVE_LUA
}
else if (smd->type == DETECT_LUA) {
SCLogDebug("lua starting");
}
SCLogDebug("lua match");
goto match;
-#endif /* HAVE_LUA */
} else if (smd->type == DETECT_BASE64_DECODE) {
if (DetectBase64DecodeDoMatch(det_ctx, s, smd, buffer, buffer_len)) {
if (s->sm_arrays[DETECT_SM_LIST_BASE64_DATA] != NULL) {
#include "app-layer-parser.h"
-#ifdef HAVE_LUA
-
#include "util-lua.h"
#include "util-lua-common.h"
#include "util-lua-http.h"
LuaRegisterDNP3Functions(lua_state);
return 0;
}
-
-#endif /* HAVE_LUA */
#ifndef SURICATA_DETECT_LUA_EXT_H
#define SURICATA_DETECT_LUA_EXT_H
-#ifdef HAVE_LUA
int LuaRegisterExtensions(lua_State *);
void LuaExtensionsMatchSetup(lua_State *lua_state, DetectLuaData *, DetectEngineThreadCtx *det_ctx,
Flow *f, Packet *p, const Signature *s, uint8_t flags);
-#endif /* HAVE_LUA */
#endif
#include "util-var-name.h"
-#ifndef HAVE_LUA
-
-static int DetectLuaSetupNoSupport (DetectEngineCtx *a, Signature *b, const char *c)
-{
- SCLogError("no Lua support built in, needed for lua keyword");
- return -1;
-}
-
-/**
- * \brief Registration function for keyword: lua
- */
-void DetectLuaRegister(void)
-{
- sigmatch_table[DETECT_LUA].name = "lua";
- sigmatch_table[DETECT_LUA].desc = "support for lua scripting";
- sigmatch_table[DETECT_LUA].url = "/rules/rule-lua-scripting.html";
- sigmatch_table[DETECT_LUA].Setup = DetectLuaSetupNoSupport;
- sigmatch_table[DETECT_LUA].Free = NULL;
- sigmatch_table[DETECT_LUA].flags = SIGMATCH_NOT_BUILT;
-
- SCLogDebug("registering lua rule option");
- return;
-}
-
-#else /* HAVE_LUA */
-
#include "util-lua.h"
#include "util-lua-sandbox.h"
UtRegisterTest("LuaMatchTest06a", LuaMatchTest06a);
}
#endif
-#endif /* HAVE_LUA */
#ifndef SURICATA_DETECT_LUA_H
#define SURICATA_DETECT_LUA_H
-#ifdef HAVE_LUA
-
#include "util-lua.h"
#include "util-lua-sandbox.h"
int allow_restricted_functions;
} DetectLuaData;
-#endif /* HAVE_LUA */
-
/* prototypes */
void DetectLuaRegister (void);
int DetectLuaMatchBuffer(DetectEngineThreadCtx *det_ctx,
}
}
}
-#ifdef HAVE_LUA
DetectLuaPostSetup(s);
-#endif
if ((s->init_data->init_flags & SIG_FLAG_INIT_JA) && s->alproto != ALPROTO_UNKNOWN &&
s->alproto != ALPROTO_TLS && s->alproto != ALPROTO_QUIC) {
#include "suricata-common.h"
#include "output-lua.h"
-#ifdef HAVE_LUA
#include "util-print.h"
#include "util-unittest.h"
#include "util-debug.h"
/* register as separate module */
OutputRegisterModule(MODULE_NAME, "lua", OutputLuaLogInit);
}
-
-#else /* HAVE_LUA */
-
-void LuaLogRegister (void) {
- /* no-op */
-}
-
-#endif /* HAVE_LUA */
} else if (strncmp(output->val, "unified2-", sizeof("unified2-") - 1) == 0) {
SCLogWarning("Unified2 is no longer supported.");
continue;
- } else if (strcmp(output->val, "lua") == 0) {
-#ifndef HAVE_LUA
- SCLogWarning("lua support not compiled in. Reconfigure/"
- "recompile with lua(jit) and its development "
- "files installed to add lua support.");
- continue;
-#endif
} else if (strcmp(output->val, "dns-log") == 0) {
SCLogWarning("dns-log is not longer available as of Suricata 5.0");
continue;
strlcat(features, "HAVE_NSS ", sizeof(features));
/* HTTP2_DECOMPRESSION is not an optional feature in this major version */
strlcat(features, "HTTP2_DECOMPRESSION ", sizeof(features));
-#ifdef HAVE_LUA
+ /* Lua is now vendored in and always available. */
strlcat(features, "HAVE_LUA ", sizeof(features));
-#endif
#ifdef HAVE_JA3
strlcat(features, "HAVE_JA3 ", sizeof(features));
#endif
#include "util-time.h"
#include "util-conf.h"
-#ifdef HAVE_LUA
-
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
flow_alproto = flow->alproto;
return (alproto == flow_alproto);
-
}
-
-#endif /* HAVE_LUA */
#ifndef SURICATA_UTIL_LUA_COMMON_H
#define SURICATA_UTIL_LUA_COMMON_H
-#ifdef HAVE_LUA
-
int LuaCallbackError(lua_State *luastate, const char *msg);
const char *LuaGetStringArgument(lua_State *luastate, int argc);
int LuaStateNeedProto(lua_State *luastate, AppProto alproto);
-#endif /* HAVE_LUA */
-
#endif /* SURICATA_UTIL_LUA_COMMON_H */
#include "app-layer-dnp3.h"
#include "app-layer-dnp3-objects.h"
-#ifdef HAVE_LUA
-
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
break;
}
}
-
-#endif /* HAVE_LUA */
#include "app-layer-dnp3.h"
#include "app-layer-dnp3-objects.h"
-#ifdef HAVE_LUA
-
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
return 0;
}
-
-#endif /* HAVE_LUA */
#ifndef SURICATA_UTIL_LUA_DNP3_H
#define SURICATA_UTIL_LUA_DNP3_H
-#ifdef HAVE_LUA
-
int LuaRegisterDNP3Functions(lua_State *);
-#endif /* HAVE_LUA */
-
#endif /* !SURICATA_UTIL_LUA_DNP3_H */
#include "util-time.h"
#include "rust.h"
-#ifdef HAVE_LUA
-
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
lua_setglobal(luastate, "DnsGetRecursionDesired");
return 0;
}
-
-#endif /* HAVE_LUA */
#ifndef SURICATA_UTIL_LUA_DNS_H
#define SURICATA_UTIL_LUA_DNS_H
-#ifdef HAVE_LUA
-
int LuaRegisterDnsFunctions(lua_State *luastate);
-#endif /* HAVE_LUA */
-
#endif /* __UTIL_LUA_HTTP_H__ */
#include "util-logopenfile.h"
#include "util-time.h"
-#ifdef HAVE_LUA
-
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
return 0;
}
-
-#endif /* HAVE_LUA */
#ifndef SURICATA_UTIL_LUA_HASSH_H
#define SURICATA_UTIL_LUA_HASSH_H
-#ifdef HAVE_LUA
-
int LuaRegisterHasshFunctions(lua_State *luastate);
-#endif /* HAVE_LUA */
-
#endif /* SURICATA_UTIL_LUA_HASSH_H */
#include "util-logopenfile.h"
#include "util-time.h"
-#ifdef HAVE_LUA
-
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
lua_setglobal(luastate, "HttpGetResponseBody");
return 0;
}
-
-#endif /* HAVE_LUA */
#ifndef SURICATA_UTIL_LUA_HTTP_H
#define SURICATA_UTIL_LUA_HTTP_H
-#ifdef HAVE_LUA
-
int LuaRegisterHttpFunctions(lua_State *luastate);
-#endif /* HAVE_LUA */
-
#endif /* SURICATA_UTIL_LUA_HTTP_H */
#include "util-logopenfile.h"
#include "util-time.h"
-#ifdef HAVE_LUA
-
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
return 0;
}
-
-#endif /* HAVE_LUA */
#ifndef SURICATA_UTIL_LUA_JA3_H
#define SURICATA_UTIL_LUA_JA3_H
-#ifdef HAVE_LUA
-
int LuaRegisterJa3Functions(lua_State *luastate);
-#endif /* HAVE_LUA */
-
#endif /* SURICATA_UTIL_LUA_JA3_H */
#include "suricata-common.h"
-#ifdef HAVE_LUA
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
#include "lua.h"
-
#include "lauxlib.h"
#include "lualib.h"
+#include "util-debug.h"
+#include "util-validate.h"
#include "util-lua-sandbox.h"
-#if !defined(SANDBOX_ALLOC_CTX)
#define SANDBOX_CTX "SANDBOX_CTX"
-#endif
typedef struct BlockedFunction {
const char *module;
if (nsize == 0) {
if (ptr != NULL) {
// ASSERT: alloc_bytes > osize
+ DEBUG_VALIDATE_BUG_ON(ctx->alloc_bytes < osize);
ctx->alloc_bytes -= osize;
}
SCFree(ptr);
luaL_newlib(L, sblib);
return 1;
}
-
-#endif
#include "app-layer-smtp.h"
-#ifdef HAVE_LUA
-
#include <lua.h>
#include <lualib.h>
return 0;
}
-
-#endif /* HAVE_LUA */
#ifndef SURICATA_UTIL_LUA_SMTP_H
#define SURICATA_UTIL_LUA_SMTP_H
-#ifdef HAVE_LUA
-
int LuaRegisterSmtpFunctions(lua_State *luastate);
-#endif /* HAVE_LUA */
-
#endif /* SURICATA_UTIL_LUA_SMTP_H */
#include "util-time.h"
#include "rust.h"
-#ifdef HAVE_LUA
-
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
return 0;
}
-
-#endif /* HAVE_LUA */
#ifndef SURICATA_UTIL_LUA_SSH_H
#define SURICATA_UTIL_LUA_SSH_H
-#ifdef HAVE_LUA
-
int LuaRegisterSshFunctions(lua_State *luastate);
-#endif /* HAVE_LUA */
-
#endif /* SURICATA_UTIL_LUA_SSH_H */
#include "util-logopenfile.h"
#include "util-time.h"
-#ifdef HAVE_LUA
-
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
return 0;
}
-
-#endif /* HAVE_LUA */
#ifndef SURICATA_UTIL_LUA_TLS_H
#define SURICATA_UTIL_LUA_TLS_H
-#ifdef HAVE_LUA
-
int LuaRegisterTlsFunctions(lua_State *luastate);
-#endif /* HAVE_LUA */
-
#endif /* SURICATA_UTIL_LUA_TLS_H */
#include "util-logopenfile.h"
#include "util-time.h"
-#ifdef HAVE_LUA
-
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
lua_pushinteger(luastate, n);
return 1;
}
-
-#endif /* HAVE_LUA */
#ifndef SURICATA_UTIL_LUA_H
#define SURICATA_UTIL_LUA_H
-#ifndef HAVE_LUA
-
-/* If we don't have Lua, create a typedef for lua_State so the
- * exported Lua functions don't fail the build. */
-typedef void lua_State;
-
-#else
-
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
int LuaPushInteger(lua_State *luastate, lua_Integer n);
-#endif /* HAVE_LUA */
-
#endif /* SURICATA_UTIL_LUA_H */