Skip to content

Commit

Permalink
feat(falco): Provide a parameter for loading lua files from an altern…
Browse files Browse the repository at this point in the history
…ate path

This will be used by the static build to load lua files from
alternate directories that are not tied to the compile flags

Signed-off-by: Radu Andries <[email protected]>
  • Loading branch information
Radu Andries committed Sep 29, 2020
1 parent 271e23c commit ac84e3e
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions userspace/falco/falco.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ static void usage()
" -h, --help Print this page\n"
" -c Configuration file (default " FALCO_SOURCE_CONF_FILE ", " FALCO_INSTALL_CONF_FILE ")\n"
" -A Monitor all events, including those with EF_DROP_SIMPLE_CONS flag.\n"
" --alternate-lua-dir <path> Specify an alternate path for loading falco lua files\n"
" -b, --print-base64 Print data buffers in base64.\n"
" This is useful for encoding binary data that needs to be used over media designed to.\n"
" --cri <path> Path to CRI socket for container metadata.\n"
Expand Down Expand Up @@ -479,7 +480,8 @@ int falco_init(int argc, char **argv)

static struct option long_options[] =
{
{"cri", required_argument, 0},
{"alternate-lua-dir", required_argument, 0},
{"cri", required_argument, 0},
{"daemon", no_argument, 0, 'd'},
{"disable-cri-async", no_argument, 0, 0},
{"disable-source", required_argument, 0},
Expand Down Expand Up @@ -509,6 +511,7 @@ int falco_init(int argc, char **argv)
set<string> disabled_rule_substrings;
string substring;
string all_rules = "";
string alternate_lua_dir = FALCO_ENGINE_SOURCE_LUA_DIR;
set<string> disabled_rule_tags;
set<string> enabled_rule_tags;

Expand Down Expand Up @@ -686,6 +689,13 @@ int falco_init(int argc, char **argv)
disable_sources.insert(optarg);
}
}
else if (string(long_options[long_index].name)== "alternate-lua-dir")
{
if(optarg != NULL)
{
alternate_lua_dir = optarg;
}
}
break;

default:
Expand Down Expand Up @@ -721,7 +731,7 @@ int falco_init(int argc, char **argv)
return EXIT_SUCCESS;
}

engine = new falco_engine();
engine = new falco_engine(true, alternate_lua_dir);
engine->set_inspector(inspector);
engine->set_extra(output_format, replace_container_info);

Expand Down

0 comments on commit ac84e3e

Please sign in to comment.