Skip to content

Commit dabfe0e

Browse files
FedeDPpoiana
authored andcommitted
cleanup(userspace/falco): drop deprecated -t,-T,-D options.
Signed-off-by: Federico Di Pierro <[email protected]>
1 parent 36d6951 commit dabfe0e

File tree

3 files changed

+0
-73
lines changed

3 files changed

+0
-73
lines changed

userspace/falco/app/actions/load_rules_files.cpp

-33
Original file line numberDiff line numberDiff line change
@@ -131,39 +131,6 @@ falco::app::run_result falco::app::actions::load_rules_files(falco::app::state&
131131
return run_result::fatal(err);
132132
}
133133

134-
if((!s.options.disabled_rule_substrings.empty() || !s.options.disabled_rule_tags.empty() || !s.options.enabled_rule_tags.empty()) &&
135-
!s.config->m_rules_selection.empty())
136-
{
137-
return run_result::fatal("Specifying -D, -t, -T command line options together with \"rules:\" configuration or -o \"rules...\" is not supported.");
138-
}
139-
140-
for (const auto& substring : s.options.disabled_rule_substrings)
141-
{
142-
falco_logger::log(falco_logger::level::INFO, "Disabling rules matching substring: " + substring + "\n");
143-
s.engine->enable_rule(substring, false);
144-
}
145-
146-
if(!s.options.disabled_rule_tags.empty())
147-
{
148-
for(const auto &tag : s.options.disabled_rule_tags)
149-
{
150-
falco_logger::log(falco_logger::level::INFO, "Disabling rules with tag: " + tag + "\n");
151-
}
152-
s.engine->enable_rule_by_tag(s.options.disabled_rule_tags, false);
153-
}
154-
155-
if(!s.options.enabled_rule_tags.empty())
156-
{
157-
// Since we only want to enable specific
158-
// rules, first disable all rules.
159-
s.engine->enable_rule(all_rules, false);
160-
for(const auto &tag : s.options.enabled_rule_tags)
161-
{
162-
falco_logger::log(falco_logger::level::INFO, "Enabling rules with tag: " + tag + "\n");
163-
}
164-
s.engine->enable_rule_by_tag(s.options.enabled_rule_tags, true);
165-
}
166-
167134
for(const auto& sel : s.config->m_rules_selection)
168135
{
169136
bool enable = sel.m_op == falco_configuration::rule_selection_operation::enable;

userspace/falco/app/options.cpp

-37
Original file line numberDiff line numberDiff line change
@@ -95,40 +95,6 @@ bool options::parse(int argc, char **argv, std::string &errstr)
9595
}
9696
}
9797

98-
// Convert the vectors of enabled/disabled tags into sets to match falco engine API
99-
if(m_cmdline_parsed.count("T") > 0)
100-
{
101-
falco_logger::log(falco_logger::level::WARNING, "The -T option is deprecated and will be removed in Falco 0.39.0. Use -o rules[].disable.tag=<tag> instead.");
102-
for(auto &tag : m_cmdline_parsed["T"].as<std::vector<std::string>>())
103-
{
104-
disabled_rule_tags.insert(tag);
105-
}
106-
}
107-
108-
if(m_cmdline_parsed.count("t") > 0)
109-
{
110-
falco_logger::log(falco_logger::level::WARNING, "The -t option is deprecated and will be removed in Falco 0.39.0. Use -o rules[].disable.rule=* -o rules[].enable.tag=<tag> instead.");
111-
for(auto &tag : m_cmdline_parsed["t"].as<std::vector<std::string>>())
112-
{
113-
enabled_rule_tags.insert(tag);
114-
}
115-
}
116-
117-
if(disabled_rule_substrings.size() > 0)
118-
{
119-
falco_logger::log(falco_logger::level::WARNING, "The -D option is deprecated and will be removed in Falco 0.39.0. Use -o rules[].disable.rule=<wildcard-pattern> instead.");
120-
}
121-
122-
// Some combinations of arguments are not allowed.
123-
124-
// You can't both disable and enable rules
125-
if((disabled_rule_substrings.size() + disabled_rule_tags.size() > 0) &&
126-
!enabled_rule_tags.empty())
127-
{
128-
errstr = std::string("You can not specify both disabled (-D/-T) and enabled (-t) rules");
129-
return false;
130-
}
131-
13298
list_fields = m_cmdline_parsed.count("list") > 0;
13399

134100
return true;
@@ -156,7 +122,6 @@ void options::define(cxxopts::Options& opts)
156122
#endif
157123
("disable-source", "Turn off a specific <event_source>. By default, all loaded sources get enabled. Available sources are 'syscall' plus all sources defined by loaded plugins supporting the event sourcing capability. This option can be passed multiple times, but turning off all event sources simultaneously is not permitted. This option can not be mixed with --enable-source. This option has no effect when reproducing events from a capture file.", cxxopts::value(disable_sources), "<event_source>")
158124
("dry-run", "Run Falco without processing events. It can help check that the configuration and rules do not have any errors.", cxxopts::value(dry_run)->default_value("false"))
159-
("D", "DEPRECATED: use -o rules[].disable.rule=<wildcard-pattern> instead. Turn off any rules with names having the substring <substring>. This option can be passed multiple times. It cannot be mixed with -t.", cxxopts::value(disabled_rule_substrings), "<substring>")
160125
("enable-source", "Enable a specific <event_source>. By default, all loaded sources get enabled. Available sources are 'syscall' plus all sources defined by loaded plugins supporting the event sourcing capability. This option can be passed multiple times. When using this option, only the event sources specified by it will be enabled. This option can not be mixed with --disable-source. This option has no effect when reproducing events from a capture file.", cxxopts::value(enable_sources), "<event_source>")
161126
#ifdef HAS_GVISOR
162127
("gvisor-generate-config", "Generate a configuration file that can be used for gVisor and exit. See --gvisor-config for more details.", cxxopts::value<std::string>(gvisor_generate_config_with_socket)->implicit_value("/run/falco/gvisor.sock"), "<socket_path>")
@@ -177,8 +142,6 @@ void options::define(cxxopts::Options& opts)
177142
("r", "Rules file or directory to be loaded. This option can be passed multiple times. Falco defaults to the values in the configuration file when this option is not specified.", cxxopts::value<std::vector<std::string>>(), "<rules_file>")
178143
("S,snaplen", "Collect only the first <len> bytes of each I/O buffer for 'syscall' events. By default, the first 80 bytes are collected by the driver and sent to the user space for processing. Use this option with caution since it can have a strong performance impact.", cxxopts::value(snaplen)->default_value("0"), "<len>")
179144
("support", "Print support information, including version, rules files used, loaded configuration, etc., and exit. The output is in JSON format.", cxxopts::value(print_support)->default_value("false"))
180-
("T", "DEPRECATED: use -o rules[].disable.tag=<tag> instead. Turn off any rules with a tag=<tag>. This option can be passed multiple times. This option can not be mixed with -t.", cxxopts::value<std::vector<std::string>>(), "<tag>")
181-
("t", "DEPRECATED: use -o rules[].disable.rule=* -o rules[].enable.tag=<tag> instead. Only enable those rules with a tag=<tag>. This option can be passed multiple times. This option can not be mixed with -T/-D.", cxxopts::value<std::vector<std::string>>(), "<tag>")
182145
("U,unbuffered", "Turn off output buffering for configured outputs. This causes every single line emitted by Falco to be flushed, which generates higher CPU usage but is useful when piping those outputs into another process or a script.", cxxopts::value(unbuffered_outputs)->default_value("false"))
183146
("V,validate", "Read the contents of the specified <rules_file> file(s), validate the loaded rules, and exit. This option can be passed multiple times to validate multiple files.", cxxopts::value(validate_rules_filenames), "<rules_file>")
184147
("v", "Enable verbose output.", cxxopts::value(verbose)->default_value("false"))

userspace/falco/app/options.h

-3
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ class options {
4646
std::vector<std::string> cri_socket_paths;
4747
bool disable_cri_async = false;
4848
std::vector<std::string> disable_sources;
49-
std::vector<std::string> disabled_rule_substrings;
5049
std::vector<std::string> enable_sources;
5150
std::string gvisor_generate_config_with_socket;
5251
bool describe_all_rules = false;
@@ -67,8 +66,6 @@ class options {
6766
std::list<std::string> rules_filenames;
6867
uint64_t snaplen = 0;
6968
bool print_support = false;
70-
std::set<std::string> disabled_rule_tags;
71-
std::set<std::string> enabled_rule_tags;
7269
bool unbuffered_outputs = false;
7370
std::vector<std::string> validate_rules_filenames;
7471
bool verbose = false;

0 commit comments

Comments
 (0)