mirror of
https://github.com/falcosecurity/falco.git
synced 2025-07-21 09:59:40 +00:00
Change rules file command-line setting
Now is optional, and uses -u rather than passed as a positional arg.
This commit is contained in:
parent
ef93844234
commit
86e2e17c33
@ -205,6 +205,7 @@ int digwatch_init(int argc, char **argv)
|
|||||||
string output_name = "stdout";
|
string output_name = "stdout";
|
||||||
string scap_filename;
|
string scap_filename;
|
||||||
string conf_filename;
|
string conf_filename;
|
||||||
|
string rules_filename;
|
||||||
string lua_dir = DIGWATCH_LUA_DIR;
|
string lua_dir = DIGWATCH_LUA_DIR;
|
||||||
lua_State* ls = NULL;
|
lua_State* ls = NULL;
|
||||||
|
|
||||||
@ -246,6 +247,9 @@ int digwatch_init(int argc, char **argv)
|
|||||||
case 'r':
|
case 'r':
|
||||||
scap_filename = optarg;
|
scap_filename = optarg;
|
||||||
break;
|
break;
|
||||||
|
case 'u':
|
||||||
|
rules_filename = optarg;
|
||||||
|
break;
|
||||||
case '?':
|
case '?':
|
||||||
result = EXIT_FAILURE;
|
result = EXIT_FAILURE;
|
||||||
goto exit;
|
goto exit;
|
||||||
@ -257,27 +261,6 @@ int digwatch_init(int argc, char **argv)
|
|||||||
|
|
||||||
inspector->set_buffer_format(event_buffer_format);
|
inspector->set_buffer_format(event_buffer_format);
|
||||||
|
|
||||||
string rules_file;
|
|
||||||
|
|
||||||
if(optind < argc)
|
|
||||||
{
|
|
||||||
for(int32_t j = optind ; j < argc; j++)
|
|
||||||
{
|
|
||||||
rules_file += argv[j];
|
|
||||||
if(j < argc - 1)
|
|
||||||
{
|
|
||||||
rules_file += " ";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if(rules_file.size() == 0) {
|
|
||||||
usage();
|
|
||||||
result = EXIT_FAILURE;
|
|
||||||
goto exit;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
ifstream* conf_stream;
|
ifstream* conf_stream;
|
||||||
if (conf_filename.size())
|
if (conf_filename.size())
|
||||||
@ -323,6 +306,12 @@ int digwatch_init(int argc, char **argv)
|
|||||||
config.init();
|
config.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (rules_filename.size())
|
||||||
|
{
|
||||||
|
config.m_rules_filename = rules_filename;
|
||||||
|
}
|
||||||
|
cout << "Using rules file " + config.m_rules_filename + "\n";
|
||||||
|
|
||||||
if(signal(SIGINT, signal_callback) == SIG_ERR)
|
if(signal(SIGINT, signal_callback) == SIG_ERR)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "An error occurred while setting SIGINT signal handler.\n");
|
fprintf(stderr, "An error occurred while setting SIGINT signal handler.\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user