mirror of
https://github.com/falcosecurity/falco.git
synced 2025-10-23 12:59:45 +00:00
Add support bundle (#517)
* Expose required_engine_version when loading rules When loading a rules file, have alternate methods that return the required_engine_version. The existing methods remain unchanged and just call the new methods with a dummy placeholder. * Add --support argument to print support bundle Add an argument --support that can be used as a single way to collect necessary support information, including the falco version, config, commandline, and all rules files. There might be a big of extra structure to the rules files, as they actually support an array of "variants", but we're thinking ahead to cases where there might be a comprehensive library of rules files and choices, so we're adding the extra structure.
This commit is contained in:
@@ -223,7 +223,8 @@ int falco_rules::engine_version(lua_State *ls)
|
||||
void falco_rules::load_rules(const string &rules_content,
|
||||
bool verbose, bool all_events,
|
||||
string &extra, bool replace_container_info,
|
||||
falco_common::priority_type min_priority)
|
||||
falco_common::priority_type min_priority,
|
||||
uint64_t &required_engine_version)
|
||||
{
|
||||
lua_getglobal(m_ls, m_lua_load_rules.c_str());
|
||||
if(lua_isfunction(m_ls, -1))
|
||||
@@ -398,12 +399,15 @@ void falco_rules::load_rules(const string &rules_content,
|
||||
lua_pushstring(m_ls, extra.c_str());
|
||||
lua_pushboolean(m_ls, (replace_container_info ? 1 : 0));
|
||||
lua_pushnumber(m_ls, min_priority);
|
||||
if(lua_pcall(m_ls, 9, 0, 0) != 0)
|
||||
if(lua_pcall(m_ls, 9, 1, 0) != 0)
|
||||
{
|
||||
const char* lerr = lua_tostring(m_ls, -1);
|
||||
string err = "Error loading rules: " + string(lerr);
|
||||
throw falco_exception(err);
|
||||
}
|
||||
|
||||
required_engine_version = lua_tonumber(m_ls, -1);
|
||||
lua_pop(m_ls, 1);
|
||||
} else {
|
||||
throw falco_exception("No function " + m_lua_load_rules + " found in lua rule module");
|
||||
}
|
||||
|
Reference in New Issue
Block a user