<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Falco – Falco Rules</title><link>https://v0-43--falcosecurity.netlify.app/docs/concepts/rules/</link><description>Recent content in Falco Rules on Falco</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="https://v0-43--falcosecurity.netlify.app/docs/concepts/rules/feed.xml" rel="self" type="application/rss+xml"/><item><title>Docs: Basic Elements of Falco Rules</title><link>https://v0-43--falcosecurity.netlify.app/docs/concepts/rules/basic-elements/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-43--falcosecurity.netlify.app/docs/concepts/rules/basic-elements/</guid><description>
&lt;h2 id="rules"&gt;Rules&lt;/h2&gt;
&lt;p&gt;A rule is a YAML object, part of the rules file, whose definition contains at least the following fields:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;rule&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;shell_in_container&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;desc&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;notice shell activity within a container&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;&amp;gt;&lt;span style="color:#b44;font-style:italic"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#b44;font-style:italic"&gt; (evt.type in (execve, execveat)) and
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#b44;font-style:italic"&gt; container.id != host and
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#b44;font-style:italic"&gt; (proc.name = bash or
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#b44;font-style:italic"&gt; proc.name = ksh)&lt;/span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;output&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;&amp;gt;&lt;span style="color:#b44;font-style:italic"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#b44;font-style:italic"&gt; shell in a container |
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#b44;font-style:italic"&gt; user=%user.name container_id=%container.id container_name=%container.name
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#b44;font-style:italic"&gt; shell=%proc.name parent=%proc.pname cmdline=%proc.cmdline&lt;/span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;priority&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;WARNING&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="conditions"&gt;Conditions&lt;/h3&gt;
&lt;p&gt;The key part of a rule is the &lt;em&gt;condition&lt;/em&gt; field. A condition is a Boolean predicate expressed using the &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/rules/conditions"&gt;condition syntax&lt;/a&gt;. It is possible to express conditions on &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/rules/supported-events"&gt;all supported events&lt;/a&gt; using their respective &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/rules/supported-fields"&gt;supported fields&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Here's an example of a condition that alerts whenever a bash shell is run inside a container:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;container.id != host and proc.name = bash
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The first clause checks that the event happened in a container (where &lt;code&gt;container.id&lt;/code&gt; is not equal to &lt;code&gt;&amp;quot;host&amp;quot;&lt;/code&gt; as the event occurs in a container). The second clause checks that the process name is &lt;code&gt;bash&lt;/code&gt;.&lt;/p&gt;
&lt;div class="alert alert-warning" role="alert"&gt;
Since this condition does not include a clause with a system call it will only check event metadata.&lt;br&gt;
Because of that, if a bash shell does start up in a container, Falco outputs events for every syscall that is performed by that shell.
&lt;/div&gt;
&lt;p&gt;If you want to be alerted only for each successful spawn of a shell in a container, add the appropriate event types to the condition:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;(evt.type in (execve, execveat)) and container.id != host and proc.name = bash
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Therefore, a complete rule using the above condition might be:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;rule&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;shell_in_container&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;desc&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;notice shell activity within a container&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;&amp;gt;&lt;span style="color:#b44;font-style:italic"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#b44;font-style:italic"&gt; (evt.type in (execve, execveat)) and
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#b44;font-style:italic"&gt; container.id != host and
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#b44;font-style:italic"&gt; proc.name = bash&lt;/span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;output&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;&amp;gt;&lt;span style="color:#b44;font-style:italic"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#b44;font-style:italic"&gt; shell in a container |
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#b44;font-style:italic"&gt; user=%user.name container_id=%container.id container_name=%container.name
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#b44;font-style:italic"&gt; shell=%proc.name parent=%proc.pname cmdline=%proc.cmdline&lt;/span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;priority&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;WARNING&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;div class="alert alert-primary" role="alert"&gt;
Conditions allow you to check for many aspects of each supported event.&lt;br&gt;
To learn more, see the &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/rules/conditions"&gt;condition language&lt;/a&gt;.
&lt;/div&gt;
&lt;h3 id="output"&gt;Output&lt;/h3&gt;
&lt;p&gt;A rule output is a string that can use the same &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/rules/supported-fields"&gt;fields&lt;/a&gt; that conditions can use prepended by &lt;code&gt;%&lt;/code&gt; to perform interpolation, akin to &lt;code&gt;printf&lt;/code&gt;. For example:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;Disallowed SSH Connection
(command=%proc.cmdline connection=%fd.name
user=%user.name user_loginuid=%user.loginuid container_id=%container.id
image=%container.image.repository)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;could output:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;Disallowed SSH Connection
(command=sshd connection=127.0.0.1:34705-&amp;gt;10.0.0.120:22
user=root user_loginuid=-1 container_id=host
image=&amp;lt;NA&amp;gt;)
&lt;/code&gt;&lt;/pre&gt;&lt;blockquote&gt;
&lt;p&gt;Outputs are usually written in a single line.&lt;br&gt;
Modifying this output we try to present it to you in a more human-readable way.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Note that it's not necessary that all fields are set in the specific event. As you can see in the example above if the connection happens outside a container the field &lt;code&gt;%container.image.repository&lt;/code&gt; would not be set and &lt;code&gt;&amp;lt;NA&amp;gt;&lt;/code&gt; is displayed instead.&lt;/p&gt;
&lt;p&gt;Outputs can also use the &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/rules/conditions/#transform-operators"&gt;transform operators&lt;/a&gt; that are used in conditions. For example:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;Disallowed SSH Connection
(command=%proc.cmdline connection=%fd.name
user=%toupper(user.name) user_loginuid=%user.loginuid container_id=%toupper(container.id)
image=%container.image.repository)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;could output:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;Disallowed SSH Connection
(command=sshd connection=127.0.0.1:34705-&amp;gt;10.0.0.120:22
user=ROOT user_loginuid=-1 container_id=HOST
image=&amp;lt;NA&amp;gt;)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To learn more about how Falco processes the output and related settings, see the &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/outputs/formatting/"&gt;output formatting&lt;/a&gt; page.&lt;/p&gt;
&lt;h3 id="priority"&gt;Priority&lt;/h3&gt;
&lt;div class="alert alert-warning" role="alert"&gt;
Don't let the &lt;strong&gt;&lt;code&gt;priority&lt;/code&gt;&lt;/strong&gt; field name mislead you.&lt;br&gt;
In a Falco Rule, it has nothing to do with overriding another rule or choosing the order in which rules will be triggered. The way to control the latter is achieved by changing the order the rules are defined and therefore loaded.
&lt;/div&gt;
&lt;p&gt;Every Falco rule has a priority which indicates how serious a violation of the rule is. This is similar to what we know as the &lt;strong&gt;severity&lt;/strong&gt; of a syslog message. The priority is included in the message/JSON output/etc.&lt;/p&gt;
&lt;p&gt;Here are the available priorities:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;EMERGENCY&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ALERT&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;CRITICAL&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ERROR&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;WARNING&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;NOTICE&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;INFORMATIONAL&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;DEBUG&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The general guidelines used to assign priorities to rules are the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;If a rule is related to writing state (i.e. filesystem, etc.), its priority is &lt;code&gt;ERROR&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;If a rule is related to an unauthorized read of state (i.e. reading sensitive files, etc.), its priority is &lt;code&gt;WARNING&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;If a rule is related to unexpected behavior (spawning an unexpected shell in a container, opening an unexpected network connection, etc.), its priority is &lt;code&gt;NOTICE&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;If a rule is related to behaving against good practices (unexpected privileged containers, containers with sensitive mounts, running interactive commands as root), its priority is &lt;code&gt;INFO&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="alert alert-warning" role="alert"&gt;
One exception is that the rule &amp;quot;Run shell untrusted&amp;quot;, which is fairly FP-prone, has a priority of &lt;code&gt;DEBUG&lt;/code&gt;.
&lt;/div&gt;
&lt;h3 id="advanced-rule-syntax"&gt;Advanced Rule Syntax&lt;/h3&gt;
&lt;p&gt;A Falco &lt;em&gt;rule&lt;/em&gt; can contain several of the following keys:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th style="text-align: left"&gt;Key&lt;/th&gt;
&lt;th style="text-align: left"&gt;Required&lt;/th&gt;
&lt;th style="text-align: left"&gt;Description&lt;/th&gt;
&lt;th style="text-align: left"&gt;Default&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;rule&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;yes&lt;/td&gt;
&lt;td style="text-align: left"&gt;A short, unique name for the rule.&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;condition&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;yes&lt;/td&gt;
&lt;td style="text-align: left"&gt;A filtering expression that is applied against events to check whether they match the rule.&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;desc&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;yes&lt;/td&gt;
&lt;td style="text-align: left"&gt;A longer description of what the rule detects.&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;output&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;yes&lt;/td&gt;
&lt;td style="text-align: left"&gt;Specifies the message that should be output if a matching event occurs. See &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/rules/basic-elements/#output"&gt;output&lt;/a&gt;.&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;priority&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;yes&lt;/td&gt;
&lt;td style="text-align: left"&gt;A case-insensitive representation of the severity of the event. Should be one of the following: &lt;code&gt;emergency&lt;/code&gt;, &lt;code&gt;alert&lt;/code&gt;, &lt;code&gt;critical&lt;/code&gt;, &lt;code&gt;error&lt;/code&gt;, &lt;code&gt;warning&lt;/code&gt;, &lt;code&gt;notice&lt;/code&gt;, &lt;code&gt;informational&lt;/code&gt;, &lt;code&gt;debug&lt;/code&gt;.&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;exceptions&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;no&lt;/td&gt;
&lt;td style="text-align: left"&gt;A set of &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/rules/exceptions/"&gt;exceptions&lt;/a&gt; that cause the rule to not generate an alert.&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;enabled&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;no&lt;/td&gt;
&lt;td style="text-align: left"&gt;If set to &lt;code&gt;false&lt;/code&gt;, a rule is neither loaded nor matched against any events.&lt;/td&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;true&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;tags&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;no&lt;/td&gt;
&lt;td style="text-align: left"&gt;A list of tags applied to the rule (more on this &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/rules/controlling-rules/#tags"&gt;here&lt;/a&gt;).&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;warn_evttypes&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;no&lt;/td&gt;
&lt;td style="text-align: left"&gt;If set to &lt;code&gt;false&lt;/code&gt;, Falco suppresses warnings related to a rule not having an event type (more on this &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/rules/style-guide/#condition-syntax"&gt;here&lt;/a&gt;).&lt;/td&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;true&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;skip-if-unknown-filter&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;no&lt;/td&gt;
&lt;td style="text-align: left"&gt;If set to &lt;code&gt;true&lt;/code&gt;, if a rule conditions contains a filtercheck, e.g. &lt;code&gt;fd.some_new_field&lt;/code&gt;, that is not known to this version of Falco, Falco silently accepts the rule but does not execute it; if set to &lt;code&gt;false&lt;/code&gt;, Falco reports an error and exits when finding an unknown filtercheck.&lt;/td&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;false&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;source&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;no&lt;/td&gt;
&lt;td style="text-align: left"&gt;The event source for which this rule should be evaluated. Typical values are &lt;code&gt;syscall&lt;/code&gt;, &lt;code&gt;k8s_audit&lt;/code&gt;, or the source advertised by a source &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/plugins/"&gt;plugin&lt;/a&gt;.&lt;/td&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;syscall&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id="macros"&gt;Macros&lt;/h2&gt;
&lt;p&gt;Macros provide a way to define common sub-portions of rules in a reusable way.&lt;/p&gt;
&lt;p&gt;By looking at the condition above it looks like both &lt;code&gt;evt.type in (execve, execveat)&lt;/code&gt; and &lt;code&gt;container.id != host&lt;/code&gt; would be used by many other rules, so to make our job easier we can easily define macros for both:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;macro&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;container&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;(container.id != host)&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;macro&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;spawned_process&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;(evt.type in (execve, execveat))&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;With these macros defined, we can then rewrite the above rule's condition as &lt;code&gt;spawned_process and container and proc.name = bash&lt;/code&gt;.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;rule&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;shell_in_container&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;desc&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;notice shell activity within a container&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;&amp;gt;&lt;span style="color:#b44;font-style:italic"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#b44;font-style:italic"&gt; spawned_process and
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#b44;font-style:italic"&gt; container and
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#b44;font-style:italic"&gt; proc.name = bash&lt;/span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;output&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;&amp;gt;&lt;span style="color:#b44;font-style:italic"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#b44;font-style:italic"&gt; shell in a container |
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#b44;font-style:italic"&gt; user=%user.name container_id=%container.id container_name=%container.name
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#b44;font-style:italic"&gt; shell=%proc.name parent=%proc.pname cmdline=%proc.cmdline&lt;/span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;priority&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;WARNING&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;For more examples of rules and macros, take a look the documentation on &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/reference/rules/default-macros/"&gt;default macros&lt;/a&gt; and the &lt;code&gt;rules/falco_rules.yaml&lt;/code&gt; file. In fact, both the macros above are part of the default list!&lt;/p&gt;
&lt;div class="alert alert-primary" role="alert"&gt;
Macros &lt;em&gt;can&lt;/em&gt; contain other macros that had been &lt;strong&gt;previously&lt;/strong&gt; defined.
&lt;/div&gt;
&lt;h2 id="lists"&gt;Lists&lt;/h2&gt;
&lt;p&gt;&lt;em&gt;Lists&lt;/em&gt; are named collections of items that you can include in rules, macros, or even other lists.&lt;/p&gt;
&lt;div class="alert alert-warning" role="alert"&gt;
Please note that lists &lt;em&gt;cannot&lt;/em&gt; be parsed as filtering expressions.
&lt;/div&gt;
&lt;p&gt;Each list node has the following keys:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th style="text-align: left"&gt;Key&lt;/th&gt;
&lt;th style="text-align: left"&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;list&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;The unique name for the list (as a slug)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;items&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;The list of values&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Here are some example lists as well as a macro that uses them:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;list&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;shell_binaries&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;items&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;[bash, csh, ksh, sh, tcsh, zsh, dash]&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;list&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;userexec_binaries&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;items&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;[sudo, su]&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;list&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;known_binaries&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;items&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;[shell_binaries, userexec_binaries]&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;macro&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;safe_procs&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;proc.name in (known_binaries)&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;div class="alert alert-primary" role="alert"&gt;
Lists &lt;em&gt;can&lt;/em&gt; contain other lists that had been &lt;strong&gt;previously&lt;/strong&gt; defined.
&lt;/div&gt;
&lt;p&gt;Referring to a list inserts the list items in the macro, rule, or list. Therefore, our rule could become more general replacing &lt;code&gt;proc.name = bash&lt;/code&gt; with &lt;code&gt;proc.name in (shell_binaries)&lt;/code&gt;, or even better, using the already included macro &lt;code&gt;shell_procs&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;list&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;shell_binaries&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;items&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;[bash, csh, ksh, sh, tcsh, zsh, dash]&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;macro&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;shell_procs&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;proc.name in (shell_binaries)&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;rule&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;shell_in_container&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;desc&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;notice shell activity within a container&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;&amp;gt;&lt;span style="color:#b44;font-style:italic"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#b44;font-style:italic"&gt; spawned_process and
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#b44;font-style:italic"&gt; container and
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#b44;font-style:italic"&gt; shell_procs&lt;/span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;output&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;&amp;gt;&lt;span style="color:#b44;font-style:italic"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#b44;font-style:italic"&gt; shell in a container |
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#b44;font-style:italic"&gt; user=%user.name container_id=%container.id container_name=%container.name
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#b44;font-style:italic"&gt; shell=%proc.name parent=%proc.pname cmdline=%proc.cmdline&lt;/span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;priority&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;WARNING&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="visibility"&gt;Visibility&lt;/h2&gt;
&lt;p&gt;As mentioned above, &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/concepts/rules/basic-elements/#lists"&gt;lists&lt;/a&gt; can reference other lists, and &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/concepts/rules/basic-elements/#macros"&gt;macros&lt;/a&gt; can reference other macros. The only requirement is that to reference an object of the same kind (a list including another list, or a macro including another macro) they must have been defined previously.&lt;/p&gt;
&lt;p&gt;However, if a &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/concepts/rules/basic-elements/#macros"&gt;macro&lt;/a&gt; included a &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/concepts/rules/basic-elements/#lists"&gt;list&lt;/a&gt;, this list might have been defined earlier or be defined at a later stage in the rules files. The same happens with a &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/concepts/rules/basic-elements/#rules"&gt;rule&lt;/a&gt; referencing a &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/concepts/rules/basic-elements/#macros"&gt;macro&lt;/a&gt;. This one doesn't need to be previously defined.&lt;/p&gt;
&lt;p&gt;In other words, visibility is defined in cascade and is quite important:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A list can only reference lists defined before it.&lt;/li&gt;
&lt;li&gt;A macro can only reference macros defined before it.&lt;/li&gt;
&lt;li&gt;A macro can reference any list.&lt;/li&gt;
&lt;li&gt;A rule can reference any macro.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The same load-order principle applies across multiple rules files. See &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/concepts/rules/overriding/#overview"&gt;Overriding Rules&lt;/a&gt; for details on how the order of rules files affects appending and overriding existing lists, macros, and rules.&lt;/p&gt;</description></item><item><title>Docs: Default and Local Rules Files</title><link>https://v0-43--falcosecurity.netlify.app/docs/concepts/rules/default-custom/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-43--falcosecurity.netlify.app/docs/concepts/rules/default-custom/</guid><description>
&lt;p&gt;Falco comes with a default rules file that is loaded if no specific configuration is provided. However, that can be completely customized in several ways, depending on how Falco is installed. There are several ways to specify the location of your custom rules, download them, and keep them up to date.&lt;/p&gt;
&lt;h2 id="the-configuration-file"&gt;The configuration file&lt;/h2&gt;
&lt;p&gt;The default configuration file, &lt;a href="https://github.com/falcosecurity/falco/blob/master/falco.yaml"&gt;&lt;code&gt;/etc/falco/falco.yaml&lt;/code&gt;&lt;/a&gt; makes Falco load rules from the &lt;code&gt;/etc/falco/falco_rules.yaml&lt;/code&gt; file, followed by any custom rules located in the &lt;code&gt;/etc/falco/falco_rules.local.yaml&lt;/code&gt; file, followed by any custom rules located in the &lt;code&gt;/etc/falco/rules.d&lt;/code&gt; directory. This configuration is governed by the &lt;code&gt;rules_files&lt;/code&gt; key:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;rules_files:
- /etc/falco/falco_rules.yaml
- /etc/falco/falco_rules.local.yaml
- /etc/falco/rules.d
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Changing these configuration entries will affect the location and loading order of the rules files.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;You can find the details of the available default rules in this &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/reference/rules/default-rules/"&gt;page&lt;/a&gt; or in the Falco rules auto-generated &lt;a href="https://falcosecurity.github.io/rules/"&gt;&lt;strong&gt;documentation&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;If you are running Falco directly from the command line, you can use the &lt;code&gt;-r&lt;/code&gt; switch to load as many rules files as needed. Is it possible to provide &lt;code&gt;-r&lt;/code&gt; with the path of a single file or directory (in this latter case, all the rules files in the directory will be loaded). The switch can be specified multiple times; if is specified at least once, the &lt;code&gt;rules_files&lt;/code&gt; key in the configuration file is ignored.
e.g.:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# falco -r /path/to/my/rules1.yaml -r /path/to/my/rules2.yaml
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id="falcoctl"&gt;Falcoctl&lt;/h2&gt;
&lt;p&gt;The &lt;a href="https://github.com/falcosecurity/falcoctl"&gt;falcoctl&lt;/a&gt; tool provides functionality to download and update rules files distributed as OCI artifacts. The &lt;code&gt;install&lt;/code&gt; command of the &lt;a href="https://github.com/falcosecurity/falcoctl"&gt;falcoctl&lt;/a&gt; tool will download rules files to a configurable directory (by default, that is &lt;code&gt;/etc/falco&lt;/code&gt;). For instance, to install a specific version of the default rules file in &lt;code&gt;/etc/falco&lt;/code&gt; you can run the following commands:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# falcoctl index add falcosecurity https://falcosecurity.github.io/falcoctl/index.yaml
# falcoctl artifact install falco-rules:3.2.0
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Falcoctl is available as a standalone tool, included in Falco packages and container images, automatically installed as a systemd unit or deployed as an init container via the Helm chart.&lt;/p&gt;
&lt;h2 id="rules-installed-via-the-helm-chart"&gt;Rules installed via the Helm chart&lt;/h2&gt;
&lt;p&gt;If you install the &lt;a href="https://github.com/falcosecurity/charts"&gt;Helm chart&lt;/a&gt;, at least version 3.0.0 with:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;helm install falco
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Falco, by default, will &lt;strong&gt;load the latest rules file&lt;/strong&gt; that is compatible with your Falco version and &lt;strong&gt;keep it up to date automatically&lt;/strong&gt; via falcoctl. These are published &lt;a href="https://github.com/falcosecurity/rules/pkgs/container/rules%2Ffalco-rules"&gt;on GitHub Packages&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id="use-the-rules-embedded-in-the-falco-image"&gt;Use the rules embedded in the Falco image&lt;/h3&gt;
&lt;p&gt;The Falco image ships with a snapshot of the latest version of the official Falco rules. If you wish to use that without downloading anything at runtime, you can install Falco with:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;helm install falco \
--set falcoctl.artifact.install.enabled=false \
--set falcoctl.artifact.follow.enabled=false
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id="add-custom-rules-with-a-configmap"&gt;Add custom rules with a configmap&lt;/h3&gt;
&lt;p&gt;You can always use the &lt;code&gt;customRules&lt;/code&gt; value to add your own custom rules in a configmap. For instance, if we create a file as &lt;a href="https://github.com/falcosecurity/charts/tree/master/charts/falco#loading-custom-rules"&gt;described in the documentation&lt;/a&gt;, and then add it to our install command above as follows:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;helm install falco \
--set falcoctl.artifact.install.enabled=false \
--set falcoctl.artifact.follow.enabled=false \
-f custom_rules.yaml
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;or if you have already installed falco, you can use the &lt;code&gt;helm upgrade -i&lt;/code&gt;&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;helm upgrade -i falco \
--set falcoctl.artifact.install.enabled=false \
--set falcoctl.artifact.follow.enabled=false \
-f custom_rules.yaml
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;it will be loaded and configured in our Falco instance and you can verify changes by checking the falco daemonset container logs with the command below:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;kubectl logs -n falco daemonsets/falco
&lt;/code&gt;&lt;/pre&gt;&lt;blockquote&gt;
&lt;p&gt;Notice: the new rule files described in &lt;code&gt;customRules&lt;/code&gt; will be placed in the &lt;code&gt;/etc/falco/rules.d&lt;/code&gt; directory, and will be loaded following the order specified in the configuration file: in the default configuration, this means that will be loaded after &lt;code&gt;/etc/falco/falco.yaml&lt;/code&gt; and &lt;code&gt;/etc/falco/falco_rules.local.yaml&lt;/code&gt; rules files.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id="only-use-rules-supplied-via-configmap"&gt;Only use rules supplied via configmap&lt;/h2&gt;
&lt;p&gt;If you only want to use the rules that you add via configmap, discarding all automated updates and default rules shipped in the image, you have to remove the &lt;code&gt;falco_rules.yaml&lt;/code&gt; and &lt;code&gt;falco_rules.local.yaml&lt;/code&gt; entries from the Falco configuration. Assuming you have your custom rules in &lt;code&gt;custom_rules.yaml&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;helm install falco -f ./custom_rules.yaml \
--set &amp;#34;falco.rules_files={/etc/falco/rules.d}&amp;#34; \
--set falcoctl.artifact.install.enabled=false \
--set falcoctl.artifact.follow.enabled=false
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>Docs: Condition Syntax</title><link>https://v0-43--falcosecurity.netlify.app/docs/concepts/rules/conditions/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-43--falcosecurity.netlify.app/docs/concepts/rules/conditions/</guid><description>
&lt;p&gt;A Falco rule’s condition defines the filter that determines which events are &lt;a class='glossary-tooltip' title='Identify a suspicious event or behavior.' data-toggle='tooltip' data-placement='top' href='https://v0-43--falcosecurity.netlify.app/docs/reference/glossary/?all=true#term-detection' target='_blank' aria-label='detected'&gt;detected&lt;/a&gt; by the rule. This condition is a boolean expression that evaluates to &lt;em&gt;true&lt;/em&gt; or &lt;em&gt;false&lt;/em&gt; for each event. If it evaluates to &lt;em&gt;true&lt;/em&gt;, the rule triggers and generates an &lt;a class='glossary-tooltip' title='Downstream actions executed after a rule is triggered.' data-toggle='tooltip' data-placement='top' href='https://v0-43--falcosecurity.netlify.app/docs/outputs/' target='_blank' aria-label='alert'&gt;alert&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;A condition can be viewed as a sequence of comparisons, each joined by &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/concepts/rules/conditions/#logical-operators"&gt;logical operators&lt;/a&gt;. Parentheses can be used to define precedence. Each comparison uses a &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/concepts/rules/conditions/#comparison-operators"&gt;comparison operator&lt;/a&gt; between a field (on the left side), extracted from the input event, and a static or computed value (on the right side). You can also apply &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/concepts/rules/conditions/#transformers"&gt;transformers&lt;/a&gt; to the field to modify its extracted values before comparison.&lt;/p&gt;
&lt;p&gt;The set of &lt;a class='glossary-tooltip' title='Filters available as rules condition or output.' data-toggle='tooltip' data-placement='top' href='https://v0-43--falcosecurity.netlify.app/docs/reference/rules/rule-fields' target='_blank' aria-label='fields'&gt;fields&lt;/a&gt; available depends on the data source. For simplicity, this page focuses on &lt;a class='glossary-tooltip' title='Syscalls stands for system calls, a way to request a service from the running kernel.' data-toggle='tooltip' data-placement='top' href='https://man7.org/linux/man-pages/man2/syscalls.2.html' target='_blank' aria-label='syscalls'&gt;syscalls&lt;/a&gt;, as they are among the most common.&lt;/p&gt;
&lt;p&gt;For example, the following condition triggers for each execution of &lt;code&gt;cat&lt;/code&gt; or &lt;code&gt;grep&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;evt.type = execve and (proc.name = cat or proc.name = grep)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id="operators"&gt;Operators&lt;/h2&gt;
&lt;p&gt;You can use the below operators in Falco rule conditions.&lt;/p&gt;
&lt;h3 id="logical-operators"&gt;Logical operators&lt;/h3&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th style="text-align: left"&gt;Operators&lt;/th&gt;
&lt;th style="text-align: left"&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;and&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;Logical AND operator to connect two or more comparisons (ie. &lt;code&gt;evt.type = open and fd.typechar='f'&lt;/code&gt;).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;or&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;Logical OR operator to connect two or more comparisons (ie. &lt;code&gt;proc.name = bash or proc.name = zsh&lt;/code&gt;).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;not&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;Logical NOT operator to negate a comparison (ie. &lt;code&gt;not proc.name = bash&lt;/code&gt;).&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3 id="comparison-operators"&gt;Comparison operators&lt;/h3&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th style="text-align: left"&gt;Operators&lt;/th&gt;
&lt;th style="text-align: left"&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;=&lt;/code&gt;, &lt;code&gt;!=&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;Equality and inequality operators.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;&amp;lt;=&lt;/code&gt;, &lt;code&gt;&amp;lt;&lt;/code&gt;, &lt;code&gt;&amp;gt;=&lt;/code&gt;, &lt;code&gt;&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;Comparison operators for numeric values.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;contains&lt;/code&gt;, &lt;code&gt;bcontains&lt;/code&gt;, &lt;code&gt;icontains&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;Strings are evaluated to be true if a string contains another. For flags, &lt;code&gt;contains&lt;/code&gt; evaluates to true if the specified flag is set. For example: &lt;code&gt;proc.cmdline contains &amp;quot;-jar&amp;quot;&lt;/code&gt;, &lt;code&gt;evt.arg.flags contains O_TRUNC&lt;/code&gt;. The &lt;code&gt;icontains&lt;/code&gt; variant works similarly but is case-insensitive. The &lt;code&gt;bcontains&lt;/code&gt; variant allows byte matching against a raw string of bytes, taking a hexadecimal string as input. For example: &lt;code&gt;evt.buffer bcontains CAFEBABE&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;endswith&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;Checks if a string ends with a given suffix.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;exists&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;Checks whether a field is set. Example: &lt;code&gt;k8s.pod.name exists&lt;/code&gt;.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;glob&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;Evaluates standard glob patterns. Example: &lt;code&gt;fd.name glob &amp;quot;/home/*/.ssh/*&amp;quot;&lt;/code&gt;.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;in&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;Evaluates whether the first set is completely contained in the second set. Example: &lt;code&gt;(b,c,d) in (a,b,c)&lt;/code&gt; is &lt;code&gt;FALSE&lt;/code&gt; because &lt;code&gt;d&lt;/code&gt; is not found in &lt;code&gt;(a,b,c)&lt;/code&gt;.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;intersects&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;Evaluates whether the first set has at least one element in common with the second set. Example: &lt;code&gt;(b,c,d) intersects (a,b,c)&lt;/code&gt; is &lt;code&gt;TRUE&lt;/code&gt; because both sets contain &lt;code&gt;b&lt;/code&gt; and &lt;code&gt;c&lt;/code&gt;.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;pmatch&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;Compares a file path against a set of file or directory prefixes. Example: &lt;code&gt;fd.name pmatch (/tmp/hello)&lt;/code&gt; evaluates to true for &lt;code&gt;/tmp/hello&lt;/code&gt;, &lt;code&gt;/tmp/hello/world&lt;/code&gt; but not &lt;code&gt;/tmp/hello_world&lt;/code&gt;. More details in the &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/concepts/rules/conditions/#pmatch-operator"&gt;below section&lt;/a&gt;.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;regex&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;Checks whether a string field matches a regular expression. The regex engine is &lt;a href="https://github.com/google/re2/wiki/Syntax"&gt;Google RE2&lt;/a&gt; configured in POSIX mode, which restricts patterns to POSIX extended (egrep) syntax (backreferences are not supported). Note that &lt;code&gt;regex&lt;/code&gt; can be considerably slower than simpler string operations. The &lt;code&gt;regex&lt;/code&gt; operator performs a full match only, not a partial match (i.e., anchored to both the beginning and the end). Example: &lt;code&gt;fd.name regex '[a-z]*/proc/[0-9]+/cmdline'&lt;/code&gt;.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;startswith&lt;/code&gt;, &lt;code&gt;bstartswith&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;Checks if a string starts with a given prefix. The &lt;code&gt;bstartswith&lt;/code&gt; variant allows byte matching against a raw string of bytes, taking a hexadecimal string as input. For example: &lt;code&gt;evt.buffer bstartswith 012AB3CC&lt;/code&gt;.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h4 id="pmatch-operator"&gt;&lt;code&gt;pmatch&lt;/code&gt; operator&lt;/h4&gt;
&lt;p&gt;&lt;code&gt;pmatch&lt;/code&gt; checks if any given path prefix matches a filesystem path in Falco fields like &lt;code&gt;fd.name&lt;/code&gt;, &lt;code&gt;evt.rawarg.path&lt;/code&gt;, or &lt;code&gt;fs.path.name&lt;/code&gt;. For example:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;fd.name pmatch (/var/run, /var/spool, /etc, /boot)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If &lt;code&gt;fd.name&lt;/code&gt; is &lt;code&gt;/var/spool/maillog&lt;/code&gt;, this expression is true; if it is &lt;code&gt;/opt/data/file.txt&lt;/code&gt;, it is false. Internally, &lt;code&gt;pmatch&lt;/code&gt; builds a tree-like structure from the right-hand side paths and traverses it with the left-hand side path components, returning true at the first matching leaf.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;pmatch&lt;/code&gt; can also include glob wildcards:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;fd.name pmatch (/var/*/*.txt, /etc, /boot)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This still performs a prefix match. Unlike &lt;code&gt;glob&lt;/code&gt;, which must fully match the path, &lt;code&gt;pmatch&lt;/code&gt; succeeds if the path starts with one of the specified prefixes. Hence, &lt;code&gt;fd.name pmatch (/var/*)&lt;/code&gt; matches &lt;code&gt;/var/run/file.txt&lt;/code&gt;, while &lt;code&gt;fd.name glob /var/*&lt;/code&gt; does not. Wildcards do not cross directory separators (see &lt;a href="https://man7.org/linux/man-pages/man7/glob.7.html"&gt;glob.7&lt;/a&gt;).&lt;/p&gt;
&lt;h2 id="transformers"&gt;Transformers&lt;/h2&gt;
&lt;p&gt;Falco supports basic transformations on fields within rule conditions. For instance, if you want to check for a case-insensitive process name, you can use:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;tolower(proc.name) = bash
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The following transform operators are supported:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th style="text-align: left"&gt;Transformer&lt;/th&gt;
&lt;th style="text-align: left"&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;tolower(&amp;lt;field&amp;gt;)&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;Converts the input field to lowercase.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;toupper(&amp;lt;field&amp;gt;)&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;Converts the input field to uppercase.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;b64(&amp;lt;field&amp;gt;)&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;Decodes the input field from &lt;a href="https://en.wikipedia.org/wiki/Base64"&gt;Base64&lt;/a&gt;.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;basename(&amp;lt;field&amp;gt;)&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;Extracts the filename without its directory path from the input field. Unlike the Unix &lt;code&gt;basename&lt;/code&gt; program, &lt;code&gt;basename()&lt;/code&gt; in Falco returns &lt;code&gt;&amp;quot;&amp;quot;&lt;/code&gt; if no filename is present. For example, &lt;code&gt;basename(proc.exepath)&lt;/code&gt; is &lt;code&gt;&amp;quot;cat&amp;quot;&lt;/code&gt; for &lt;code&gt;/usr/bin/cat&lt;/code&gt; but &lt;code&gt;&amp;quot;&amp;quot;&lt;/code&gt; for &lt;code&gt;/usr/bin/&lt;/code&gt;.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;len(&amp;lt;field&amp;gt;)&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;Returns the length of the field: for LIST fields, the number of elements; for CHARBUF fields, the number of characters; and for BYTEBUF fields, the number of bytes.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3 id="field-evaluation-for-right-hand-side-of-comparisons"&gt;Field evaluation (for right-hand side of comparisons)&lt;/h3&gt;
&lt;p&gt;Falco also lets you compare field values with other field values by using the &lt;code&gt;val()&lt;/code&gt; special transformer on the right-hand side of a comparison. For instance, to detect processes that have the same name as their parent:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;proc.name = val(proc.pname)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Similarly, using transformations on both sides is supported:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;tolower(proc.name) = tolower(proc.pname)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id="syscall-event-types-direction-and-args"&gt;Syscall event types, direction, and args&lt;/h2&gt;
&lt;div class="card card-sm pageinfo pageinfo-warning my-4"&gt;
&lt;div class="card-body"&gt;
&lt;div class="card-text"&gt;
&lt;p&gt;The &lt;code&gt;evt.dir&lt;/code&gt; field, as well as the concept of &amp;quot;direction&amp;quot;, have been deprecated in Falco &lt;code&gt;0.42.0&lt;/code&gt; and will be removed
in a future release. Until field removal and since Falco &lt;code&gt;0.42.0&lt;/code&gt;, specifying &lt;code&gt;evt.dir='&amp;gt;'&lt;/code&gt; will match nothing, while
specifying &lt;code&gt;evt.dir='&amp;lt;'&lt;/code&gt; will match everything, with a warning informing the user about the deprecation. Users are
encouraged to get rid of any reference to &lt;code&gt;evt.dir&lt;/code&gt;, as its presence will result in an error at rules loading time after
its removal.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Every syscall event includes the &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/reference/rules/supported-fields/#field-class-evt"&gt;&lt;code&gt;evt&lt;/code&gt; field class&lt;/a&gt;. Each condition you write for these events typically begins with an &lt;code&gt;evt.type&lt;/code&gt; expression or macro. This is practical because security rules often focus on one syscall type at a time. For instance, you might consider &lt;code&gt;open&lt;/code&gt; or &lt;code&gt;openat&lt;/code&gt; to detect suspicious activity when files are opened, or &lt;code&gt;execve&lt;/code&gt; to inspect newly spawned processes. You do not have to guess the syscall name—simply refer to the complete &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/reference/rules/supported-fields/"&gt;list of supported system call events&lt;/a&gt; for an overview of what you can use.&lt;/p&gt;
&lt;p&gt;Each syscall has an entry event and an exit event, tracked by the &lt;code&gt;evt.dir&lt;/code&gt; field, also referred to as the &amp;quot;direction&amp;quot; of the system call. A value of &lt;code&gt;&amp;gt;&lt;/code&gt; indicates entry (when the syscall is invoked), while &lt;code&gt;&amp;lt;&lt;/code&gt; marks exit (when the call has returned). By looking at the supported system call list, you will see that events have both entry and exit forms. For example:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;&amp;gt; setuid(UID uid)
&amp;lt; setuid(ERRNO res)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;In many cases, it is most useful to filter on exit events, because you want to know the outcome of the syscall once it has completed. For example, consider the file-opening events:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;&amp;gt; open()
&amp;lt; open(FD fd, FSPATH name, FLAGS32 flags, UINT32 mode, UINT32 dev)
&amp;gt; openat()
&amp;lt; openat(FD fd, FD dirfd, FSRELPATH name, FLAGS32 flags, UINT32 mode, UINT32 dev)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Each event has a list of arguments that you can access through &lt;code&gt;evt.arg.&amp;lt;argname&amp;gt;&lt;/code&gt;. For instance, if you want to detect a process opening a file to overwrite it, check if the list of flags contains &lt;code&gt;O_TRUNC&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;evt.type in (open, openat) and evt.dir = &amp;lt; and evt.arg.flags contains O_TRUNC
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Note that arguments do not necessarily match the raw parameters used in the Linux kernel; Falco may parse them in ways that make rule-writing more straightforward. By using the &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/rules/supported-fields/#field-class-evt"&gt;&lt;code&gt;evt&lt;/code&gt; fields&lt;/a&gt;, you can inspect many other aspects common across different events.&lt;/p&gt;
&lt;h2 id="syscall-event-context-and-metadata"&gt;Syscall event context and metadata&lt;/h2&gt;
&lt;p&gt;While the &lt;code&gt;evt&lt;/code&gt; fields allow you to write expressive conditions, arguments and common fields alone are often insufficient for complete security rules. You might also need to consider the process context in which the event occurred, whether or not it happened inside a container, or how it correlates with Kubernetes metadata. To enable this, Falco enriches many events with &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/rules/supported-fields"&gt;additional field classes&lt;/a&gt;. Not all field classes are available for all events, and the list grows over time. Each field class’s documentation clarifies when those fields are expected to be present, but some are so common that rules often rely on them.&lt;/p&gt;
&lt;p&gt;The &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/rules/supported-fields/#field-class-process"&gt;&lt;code&gt;proc&lt;/code&gt; field class&lt;/a&gt; gives you context about the process and thread generating a specific syscall. This information is frequently very important. For example, you can use &lt;code&gt;proc.name&lt;/code&gt; and &lt;code&gt;proc.pid&lt;/code&gt;, or even traverse the process hierarchy with &lt;code&gt;proc.aname[&amp;lt;n&amp;gt;]&lt;/code&gt; and &lt;code&gt;proc.apid[&amp;lt;n&amp;gt;]&lt;/code&gt;. You can also see which user performed the action with the &lt;code&gt;user&lt;/code&gt; field class.&lt;/p&gt;
&lt;p&gt;An example rule that detects whenever &lt;code&gt;bash&lt;/code&gt; is executed inside a container could look like this:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;evt.type = execve and container.id != host and proc.name = bash
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Notice that you do not need to check the &lt;code&gt;execve&lt;/code&gt; arguments. Once &lt;code&gt;execve&lt;/code&gt; has returned, Falco updates the process context, so all &lt;code&gt;proc.*&lt;/code&gt; fields refer to the new process that was just spawned, including command line, executable path, arguments, and so on.&lt;/p&gt;</description></item><item><title>Docs: Overriding Rules</title><link>https://v0-43--falcosecurity.netlify.app/docs/concepts/rules/overriding/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-43--falcosecurity.netlify.app/docs/concepts/rules/overriding/</guid><description>
&lt;h2 id="overview"&gt;Overview&lt;/h2&gt;
&lt;p&gt;There may be cases where you need to adjust the behavior of the Falco-supplied &lt;a class='glossary-tooltip' title='Lists are collections of items that can be included in rules, macros, or other lists.' data-toggle='tooltip' data-placement='top' href='https://v0-43--falcosecurity.netlify.app/docs/rules/basic-elements/#lists' target='_blank' aria-label='list'&gt;list&lt;/a&gt;, &lt;a class='glossary-tooltip' title='Macros are rule condition snippets that can be re-used inside rules and even other macros.' data-toggle='tooltip' data-placement='top' href='https://v0-43--falcosecurity.netlify.app/docs/rules/basic-elements/#macros' target='_blank' aria-label='macro'&gt;macro&lt;/a&gt;, and &lt;a class='glossary-tooltip' title='Rules are conditions under which an alert should be generated.' data-toggle='tooltip' data-placement='top' href='https://v0-43--falcosecurity.netlify.app/docs/rules/basic-elements/#rules' target='_blank' aria-label='rule'&gt;rule&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;You can override (modify) rules in Falco two different ways:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Define multiple rules files. The additional rules files can be used to add new lists, macros and rules or to override existing ones.&lt;/li&gt;
&lt;li&gt;You can override lists, macros, and rules in the same file so long as the override happens after the initial definition.&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="alert alert-warning" role="alert"&gt;
&lt;p&gt;Note that when overriding existing lists, macro, or rule the order of the rule configuration files matters. For example if you append to an existing default rule, you must ensure your custom rules file (e.g. &lt;code&gt;/etc/falco/rules.d/custom-rules.yaml&lt;/code&gt;) is loaded &lt;strong&gt;after&lt;/strong&gt; the default rules file (&lt;code&gt;/etc/falco/falco_rules.yaml&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;The load order can be configured from the command line using multiple &lt;code&gt;-r&lt;/code&gt; parameters in the right order, directly inside the Falco configuration file (&lt;code&gt;falco.yaml&lt;/code&gt;) via the &lt;code&gt;rules_files&lt;/code&gt; section or through the official Helm chart, using the &lt;code&gt;falco.rules_files&lt;/code&gt; value.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;To facilitate modifying existing lists, macros and rules Falco provides an &lt;code&gt;override&lt;/code&gt; section that can be added to your custom rules file. Within the &lt;code&gt;override&lt;/code&gt; section you can specify whether you want to &lt;code&gt;append&lt;/code&gt; or &lt;code&gt;replace&lt;/code&gt; information for the given rule, list or macro.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;append&lt;/code&gt; allows you to add additional values to a list, macro, or rule key&lt;/p&gt;
&lt;p&gt;&lt;code&gt;replace&lt;/code&gt; allows you to replace the value of a list, macro or macro key&lt;/p&gt;
&lt;div class="alert alert-warning" role="alert"&gt;
&lt;code&gt;append&lt;/code&gt; and &lt;code&gt;replace&lt;/code&gt; cannot be used together. Trying to apply both will result in an error.
&lt;/div&gt;
&lt;p&gt;The keys that can be overridden vary by rules component and action being taken:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Lists (&lt;code&gt;append&lt;/code&gt; or &lt;code&gt;replace&lt;/code&gt;): &lt;code&gt;items&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Macros (&lt;code&gt;append&lt;/code&gt; or &lt;code&gt;replace&lt;/code&gt;): &lt;code&gt;condition&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Rules (&lt;code&gt;append&lt;/code&gt;): &lt;code&gt;condition&lt;/code&gt;, &lt;code&gt;output&lt;/code&gt;, &lt;code&gt;desc&lt;/code&gt;, &lt;code&gt;tags&lt;/code&gt;, &lt;code&gt;exceptions&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Rules (&lt;code&gt;replace&lt;/code&gt;): &lt;code&gt;condition&lt;/code&gt;, &lt;code&gt;output&lt;/code&gt; &lt;code&gt;desc&lt;/code&gt;, &lt;code&gt;priority&lt;/code&gt;, &lt;code&gt;tags&lt;/code&gt;, &lt;code&gt;exceptions&lt;/code&gt;, &lt;code&gt;enabled&lt;/code&gt;, &lt;code&gt;warn_evttypes&lt;/code&gt;, &lt;code&gt;skip-if-unknown-filter&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="examples-of-using-the-override-section"&gt;Examples of using the &lt;code&gt;override&lt;/code&gt; section&lt;/h2&gt;
&lt;p&gt;The following examples illustrate how you can use the override section to modify existing lists, macros, and rules.&lt;/p&gt;
&lt;p&gt;In all the examples below, it's assumed one is running Falco via &lt;code&gt;falco -r /etc/falco/falco_rules.yaml -r /etc/falco/falco_rules.local.yaml&lt;/code&gt;, or has the default entries for &lt;code&gt;rules_files&lt;/code&gt; in falco.yaml, which has &lt;code&gt;/etc/falco/falco.yaml&lt;/code&gt; first and &lt;code&gt;/etc/falco/falco_rules.local.yaml&lt;/code&gt; second.&lt;/p&gt;
&lt;h3 id="append-an-item-to-a-list"&gt;Append an item to a list&lt;/h3&gt;
&lt;h5 id="etc-falco-falco-rules-yaml"&gt;&lt;code&gt;/etc/falco/falco_rules.yaml&lt;/code&gt;&lt;/h5&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;list&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;my_programs&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;items&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;[ls, cat, pwd]&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;rule&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;my_programs_opened_file&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;desc&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;Track whenever a set of programs opens a file&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;proc.name in (my_programs) and (evt.type=open or evt.type=openat)&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;output&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;A tracked program opened a file | user=%user.name command=%proc.cmdline file=%fd.name&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;priority&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;INFO&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h5 id="etc-falco-falco-rules-local-yaml"&gt;&lt;code&gt;/etc/falco/falco_rules.local.yaml&lt;/code&gt;&lt;/h5&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;list&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;my_programs&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;items&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;[cp]&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;override&lt;/span&gt;:&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;items&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;append&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The rule &lt;code&gt;my_programs_opened_file&lt;/code&gt; would trigger whenever any of &lt;code&gt;ls&lt;/code&gt;, &lt;code&gt;cat&lt;/code&gt;, &lt;code&gt;pwd&lt;/code&gt;, or &lt;code&gt;cp&lt;/code&gt; opened a file.&lt;/p&gt;
&lt;h3 id="replace-items-in-a-list"&gt;Replace items in a list&lt;/h3&gt;
&lt;h5 id="etc-falco-falco-rules-yaml-1"&gt;&lt;code&gt;/etc/falco/falco_rules.yaml&lt;/code&gt;&lt;/h5&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;list&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;my_programs&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;items&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;[ls, cat, pwd]&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;rule&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;my_programs_opened_file&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;desc&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;Track whenever a set of programs opens a file&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;proc.name in (my_programs) and (evt.type=open or evt.type=openat)&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;output&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;A tracked program opened a file | user=%user.name command=%proc.cmdline file=%fd.name&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;priority&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;INFO&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h5 id="etc-falco-falco-rules-local-yaml-1"&gt;&lt;code&gt;/etc/falco/falco_rules.local.yaml&lt;/code&gt;&lt;/h5&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;list&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;my_programs&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;items&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;[vi, vim, nano] &lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;override&lt;/span&gt;:&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;items&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;replace&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The rule &lt;code&gt;my_programs_opened_file&lt;/code&gt; would trigger whenever any of &lt;code&gt;vi&lt;/code&gt;, &lt;code&gt;vim&lt;/code&gt;, or &lt;code&gt;nano&lt;/code&gt; opened a file.&lt;/p&gt;
&lt;h3 id="append-an-item-to-a-macro"&gt;Append an item to a macro&lt;/h3&gt;
&lt;h5 id="etc-falco-falco-rules-yaml-2"&gt;&lt;code&gt;/etc/falco/falco_rules.yaml&lt;/code&gt;&lt;/h5&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;macro&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;access_file&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;evt.type=open&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;rule&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;program_accesses_file&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;desc&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;Track whenever a set of programs opens a file&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;(access_file) and proc.name in (cat, ls)&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;output&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;A tracked program opened a file | user=%user.name command=%proc.cmdline file=%fd.name&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;priority&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;INFO&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h5 id="etc-falco-falco-rules-local-yaml-2"&gt;&lt;code&gt;/etc/falco/falco_rules.local.yaml&lt;/code&gt;&lt;/h5&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;macro&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;access_file&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;or evt.type=openat&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;override&lt;/span&gt;:&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;append&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The rule &lt;code&gt;program_accesses_file&lt;/code&gt; would trigger when &lt;code&gt;ls&lt;/code&gt;/&lt;code&gt;cat&lt;/code&gt; either used &lt;code&gt;open&lt;/code&gt;/&lt;code&gt;openat&lt;/code&gt; on a file.&lt;/p&gt;
&lt;h3 id="append-and-replace-items-in-a-rule"&gt;Append and replace items in a rule&lt;/h3&gt;
&lt;h5 id="etc-falco-falco-rules-yaml-3"&gt;&lt;code&gt;/etc/falco/falco_rules.yaml&lt;/code&gt;&lt;/h5&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;rule&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;program_accesses_file&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;desc&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;Yrack whenever a set of programs opens a file&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;evt.type=open and proc.name in (cat, ls) &lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;output&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;A tracked program opened a file | user=%user.name command=%proc.cmdline file=%fd.name&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;priority&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;INFO&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h5 id="etc-falco-falco-rules-local-yaml-3"&gt;&lt;code&gt;/etc/falco/falco_rules.local.yaml&lt;/code&gt;&lt;/h5&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;rule&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;program_accesses_file&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;and not user.name=root&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;output&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;A file (user=%user.name command=%proc.cmdline file=%fd.name) was opened by a monitored program&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;override&lt;/span&gt;:&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;append&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;output&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;replace&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The rule &lt;code&gt;program_accesses_file&lt;/code&gt; would trigger when &lt;code&gt;ls&lt;/code&gt;/&lt;code&gt;cat&lt;/code&gt; either used &lt;code&gt;open&lt;/code&gt; on a file, but not if the user was root.&lt;/p&gt;
&lt;p&gt;The new output message would be &lt;code&gt;A file (user=%user.name command=%proc.cmdline file=%fd.name) was opened by a monitored program&lt;/code&gt;&lt;/p&gt;
&lt;h3 id="enabling-a-disabled-rule"&gt;Enabling a disabled rule&lt;/h3&gt;
&lt;p&gt;Using &lt;code&gt;enabled: true&lt;/code&gt; is deprecated, and should be avoided. Falco 0.37.0 and later will display a warning if &lt;code&gt;enabled: true&lt;/code&gt; is used.&lt;/p&gt;
&lt;h5 id="etc-falco-falco-rules-yaml-4"&gt;&lt;code&gt;/etc/falco/falco_rules.yaml&lt;/code&gt;&lt;/h5&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;rule&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;test_rule&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;desc&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;test rule description&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;evt.type = close&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;output&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;user=%user.name command=%proc.cmdline file=%fd.name&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;priority&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;INFO&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;enabled&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#a2f;font-weight:bold"&gt;false&lt;/span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h5 id="etc-falco-falco-rules-local-yaml-incorrect-usage-example"&gt;&lt;code&gt;/etc/falco/falco_rules.local.yaml&lt;/code&gt; (incorrect usage example)&lt;/h5&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;rule&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;test_rule&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;enabled&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#a2f;font-weight:bold"&gt;true&lt;/span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Use the new &lt;code&gt;override&lt;/code&gt; section to enable the rule instead.&lt;/p&gt;
&lt;h5 id="etc-falco-falco-rules-yaml-5"&gt;&lt;code&gt;/etc/falco/falco_rules.yaml&lt;/code&gt;&lt;/h5&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;rule&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;test_rule&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;desc&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;test rule description&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;evt.type = close&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;output&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;user=%user.name command=%proc.cmdline file=%fd.name&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;priority&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;INFO&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;enabled&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#a2f;font-weight:bold"&gt;false&lt;/span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h5 id="etc-falco-falco-rules-local-yaml-correct-usage-example"&gt;&lt;code&gt;/etc/falco/falco_rules.local.yaml&lt;/code&gt; (correct usage example)&lt;/h5&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;rule&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;test_rule&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;enabled&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#a2f;font-weight:bold"&gt;true&lt;/span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;override&lt;/span&gt;:&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;enabled&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;replace&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="precedence-of-logical-operators-when-appending"&gt;Precedence of logical operators when appending&lt;/h2&gt;
&lt;p&gt;Remember that when appending rules and macros, the content of the referring rule or macro is simply added to the condition of the referred one.
This can result in unintended results if the original rule/macro has potentially ambiguous logical operators.&lt;/p&gt;
&lt;p&gt;Here's an example:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;rule&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;my_rule&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;desc&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;...&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;evt.type=open and proc.name=apache&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;output&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;...&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;rule&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;my_rule&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;append&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#a2f;font-weight:bold"&gt;true&lt;/span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;or proc.name=nginx&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Should &lt;code&gt;proc.name=nginx&lt;/code&gt; be interpreted as relative to the &lt;code&gt;and proc.name=apache&lt;/code&gt;, that is to allow either apache/nginx to open files, or relative to the &lt;code&gt;evt.type=open&lt;/code&gt;, that is to allow apache to open files or to allow nginx to do anything?&lt;/p&gt;
&lt;p&gt;In cases like this, be sure to scope the logical operators of the original condition with parentheses when possible, or avoid appending conditions when not possible.&lt;/p&gt;
&lt;h2 id="appending-to-existing-rules-using-append-key-deprecated"&gt;Appending to existing rules using &lt;code&gt;append&lt;/code&gt; key (deprecated)&lt;/h2&gt;
&lt;div class="card card-sm pageinfo pageinfo-warning my-4"&gt;
&lt;div class="card-body"&gt;
&lt;div class="card-text"&gt;
&lt;p&gt;The &lt;code&gt;append&lt;/code&gt; key has been deprecated and will be removed in Falco 1.0.0. Use the &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/rules/overriding/#overview"&gt;&lt;code&gt;override&lt;/code&gt; section&lt;/a&gt; instead.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;If you use multiple Falco &lt;a class='glossary-tooltip' title='A Falco rules file is a YAML file containing three types of elements: rules, macros, and lists.' data-toggle='tooltip' data-placement='top' href='https://v0-43--falcosecurity.netlify.app/docs/rules' target='_blank' aria-label='rules files'&gt;rules files&lt;/a&gt;, you might want to append new items to an existing lists, macros or rules. To do that, define an item with the same name as an existing item and add an &lt;code&gt;append: true&lt;/code&gt; attribute to the YAML object.&lt;/p&gt;
&lt;div class="alert alert-warning" role="alert"&gt;
When appending to lists, items are automatically added to the &lt;strong&gt;end&lt;/strong&gt; of the &lt;em&gt;list&lt;/em&gt;.&lt;br&gt;
When appending to rules or macros, the additional content is appended to the &lt;a class='glossary-tooltip' title='Criteria to trigger an alert.' data-toggle='tooltip' data-placement='top' href='https://v0-43--falcosecurity.netlify.app/docs/rules/basic-elements/#conditions' target='_blank' aria-label='condition'&gt;condition&lt;/a&gt; field of the referred object.
&lt;/div&gt;
&lt;p&gt;Note that when appending to lists, rules or macros, the order of the rule configuration files matters! For example if you append to an existing default rule (e.g. &lt;code&gt;Terminal shell in container&lt;/code&gt;), you must ensure your custom configuration file (e.g. &lt;code&gt;/etc/falco/rules.d/custom-rules.yaml&lt;/code&gt;) is loaded &lt;strong&gt;after&lt;/strong&gt; the default configuration file (&lt;code&gt;/etc/falco/falco_rules.yaml&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;This can be configured with multiple &lt;code&gt;-r&lt;/code&gt; parameters in the right order, directly inside the Falco configuration file (&lt;code&gt;falco.yaml&lt;/code&gt;) via &lt;code&gt;rules_files&lt;/code&gt; or if you use the official Helm chart, via the &lt;code&gt;falco.rules_files&lt;/code&gt; value.&lt;/p&gt;
&lt;h2 id="redefining-existing-rules-using-append-key-deprecated"&gt;Redefining existing rules using &lt;code&gt;append&lt;/code&gt; key (deprecated)&lt;/h2&gt;
&lt;div class="card card-sm pageinfo pageinfo-warning my-4"&gt;
&lt;div class="card-body"&gt;
&lt;div class="card-text"&gt;
&lt;p&gt;The &lt;code&gt;append&lt;/code&gt; key has been deprecated and will be removed in Falco 1.0.0. Use the &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/rules/overriding/#overview"&gt;&lt;code&gt;override&lt;/code&gt; section&lt;/a&gt; instead.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;If &lt;code&gt;append&lt;/code&gt; is set to &lt;code&gt;false&lt;/code&gt; (default value), the whole object will be redefined. This can be used to empty a list, &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/reference/rules/macros-override/"&gt;apply user-specific settings to a macro&lt;/a&gt; or even change a rule completely.&lt;/p&gt;
&lt;p&gt;Take into account that when redefining a rule, it will entirely replace the previous rule, so if the new object defines fewer fields than required, Falco could return an error.&lt;/p&gt;
&lt;p&gt;The only exceptions to this are the &lt;code&gt;enabled&lt;/code&gt; field, that when defined as a single accompanying field, it simply enables or disables a previously-defined rule. And obviously, the &lt;code&gt;append&lt;/code&gt; field, that when set to &lt;code&gt;true&lt;/code&gt; for either macros or rules, it just appends the condition/exceptions field.&lt;/p&gt;
&lt;h2 id="examples-of-appending-using-append-key-deprecated"&gt;Examples of appending using &lt;code&gt;append&lt;/code&gt; key (deprecated)&lt;/h2&gt;
&lt;div class="card card-sm pageinfo pageinfo-warning my-4"&gt;
&lt;div class="card-body"&gt;
&lt;div class="card-text"&gt;
&lt;p&gt;The &lt;code&gt;append&lt;/code&gt; key has been deprecated and will be removed in Falco 1.0.0. Use the &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/rules/overriding/#overview"&gt;&lt;code&gt;override&lt;/code&gt; section&lt;/a&gt; instead.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;In all the examples below, it's assumed one is running Falco via &lt;code&gt;falco -r /etc/falco/falco_rules.yaml -r /etc/falco/falco_rules.local.yaml&lt;/code&gt;, or has the default entries for &lt;code&gt;rules_files&lt;/code&gt; in falco.yaml, which has &lt;code&gt;/etc/falco/falco.yaml&lt;/code&gt; first and &lt;code&gt;/etc/falco/falco_rules.local.yaml&lt;/code&gt; second.&lt;/p&gt;
&lt;h3 id="appending-to-lists"&gt;Appending to Lists&lt;/h3&gt;
&lt;p&gt;Here's an example of appending to lists:&lt;/p&gt;
&lt;h5 id="etc-falco-falco-rules-yaml-6"&gt;&lt;code&gt;/etc/falco/falco_rules.yaml&lt;/code&gt;&lt;/h5&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;list&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;my_programs&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;items&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;[ls, cat, pwd]&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;rule&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;my_programs_opened_file&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;desc&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;Track whenever a set of programs opens a file&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;proc.name in (my_programs) and (evt.type=open or evt.type=openat)&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;output&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;A tracked program opened a file | user=%user.name command=%proc.cmdline file=%fd.name&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;priority&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;INFO&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h5 id="etc-falco-falco-rules-local-yaml-4"&gt;&lt;code&gt;/etc/falco/falco_rules.local.yaml&lt;/code&gt;&lt;/h5&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;list&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;my_programs&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;append&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#a2f;font-weight:bold"&gt;true&lt;/span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;items&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;[cp]&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The rule &lt;code&gt;my_programs_opened_file&lt;/code&gt; would trigger whenever any of &lt;code&gt;ls&lt;/code&gt;, &lt;code&gt;cat&lt;/code&gt;, &lt;code&gt;pwd&lt;/code&gt;, or &lt;code&gt;cp&lt;/code&gt; opened a file.&lt;/p&gt;
&lt;h3 id="appending-to-macros"&gt;Appending to Macros&lt;/h3&gt;
&lt;p&gt;Here's an example of appending to macros:&lt;/p&gt;
&lt;h5 id="etc-falco-falco-rules-yaml-7"&gt;&lt;code&gt;/etc/falco/falco_rules.yaml&lt;/code&gt;&lt;/h5&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;macro&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;access_file&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;evt.type=open&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;rule&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;program_accesses_file&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;desc&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;Track whenever a set of programs opens a file&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;proc.name in (cat, ls) and (access_file)&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;output&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;A tracked program opened a file | user=%user.name command=%proc.cmdline file=%fd.name&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;priority&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;INFO&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h5 id="etc-falco-falco-rules-local-yaml-5"&gt;&lt;code&gt;/etc/falco/falco_rules.local.yaml&lt;/code&gt;&lt;/h5&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;macro&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;access_file&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;append&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#a2f;font-weight:bold"&gt;true&lt;/span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;or evt.type=openat&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The rule &lt;code&gt;program_accesses_file&lt;/code&gt; would trigger when &lt;code&gt;ls&lt;/code&gt;/&lt;code&gt;cat&lt;/code&gt; either used &lt;code&gt;open&lt;/code&gt;/&lt;code&gt;openat&lt;/code&gt; on a file.&lt;/p&gt;
&lt;h3 id="appending-to-rules"&gt;Appending to Rules&lt;/h3&gt;
&lt;p&gt;Here's an example of appending to rules:&lt;/p&gt;
&lt;h5 id="etc-falco-falco-rules-yaml-8"&gt;&lt;code&gt;/etc/falco/falco_rules.yaml&lt;/code&gt;&lt;/h5&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;rule&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;program_accesses_file&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;desc&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;track whenever a set of programs opens a file&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;proc.name in (cat, ls) and evt.type=open&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;output&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;A tracked program opened a file | user=%user.name command=%proc.cmdline file=%fd.name&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;priority&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;INFO&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h5 id="etc-falco-falco-rules-local-yaml-6"&gt;&lt;code&gt;/etc/falco/falco_rules.local.yaml&lt;/code&gt;&lt;/h5&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;rule&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;program_accesses_file&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;append&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#a2f;font-weight:bold"&gt;true&lt;/span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;and not user.name=root&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The rule &lt;code&gt;program_accesses_file&lt;/code&gt; would trigger when &lt;code&gt;ls&lt;/code&gt;/&lt;code&gt;cat&lt;/code&gt; either used &lt;code&gt;open&lt;/code&gt; on a file, but not if the user was root.&lt;/p&gt;
&lt;div class="alert alert-primary" role="alert"&gt;
&lt;h4 class="alert-heading"&gt;Append Exceptions to Rules&lt;/h4&gt;
It is also possible to append exceptions to rules.&lt;br&gt;
&lt;a href="https://v0-43--falcosecurity.netlify.app/docs/rules/exceptions/#appending-exception-values"&gt;Here&lt;/a&gt; you can find further information.
&lt;/div&gt;</description></item><item><title>Docs: Rule Exceptions</title><link>https://v0-43--falcosecurity.netlify.app/docs/concepts/rules/exceptions/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-43--falcosecurity.netlify.app/docs/concepts/rules/exceptions/</guid><description>
&lt;h2 id="introduction"&gt;Introduction&lt;/h2&gt;
&lt;p&gt;Almost all Falco Rules have cases where the behavior &lt;a class='glossary-tooltip' title='Identify a suspicious event or behavior.' data-toggle='tooltip' data-placement='top' href='https://v0-43--falcosecurity.netlify.app/docs/reference/glossary/?all=true#term-detection' target='_blank' aria-label='detected'&gt;detected&lt;/a&gt; by the &lt;a class='glossary-tooltip' title='Rules are conditions under which an alert should be generated.' data-toggle='tooltip' data-placement='top' href='https://v0-43--falcosecurity.netlify.app/docs/rules/basic-elements/#rules' target='_blank' aria-label='rule'&gt;rule&lt;/a&gt; should be allowed. For example, the rule &lt;code&gt;Write below binary dir&lt;/code&gt; has exceptions for specific programs that are known to write below these directories as a part of software installation/management:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;rule&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;Write below binary dir&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;desc&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;an attempt to write to any file below a set of binary directories&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;&amp;gt;&lt;span style="color:#b44;font-style:italic"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#b44;font-style:italic"&gt; open_write
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#b44;font-style:italic"&gt; and bin_dir
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#b44;font-style:italic"&gt; and not package_mgmt_procs
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#b44;font-style:italic"&gt; and not exe_running_docker_save
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#b44;font-style:italic"&gt; and not python_running_get_pip
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#b44;font-style:italic"&gt; and not python_running_ms_oms
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#b44;font-style:italic"&gt; and not user_known_write_below_binary_dir_activities&lt;/span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#00f;font-weight:bold"&gt;...&lt;/span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Previously, these exceptions were expressed as concatenations to the original rule's condition. For example, looking at the &lt;a class='glossary-tooltip' title='Macros are rule condition snippets that can be re-used inside rules and even other macros.' data-toggle='tooltip' data-placement='top' href='https://v0-43--falcosecurity.netlify.app/docs/rules/basic-elements/#macros' target='_blank' aria-label='macro'&gt;macro&lt;/a&gt; package_mgmt_procs:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;macro&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;package_mgmt_procs&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;proc.name in (package_mgmt_binaries)&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The result is appending &lt;code&gt;and not proc.name in (package_mgmt_binaries)&lt;/code&gt; to the condition of the rule.&lt;/p&gt;
&lt;p&gt;A more extreme case of this is the &lt;code&gt;write_below_etc&lt;/code&gt; macro used by &lt;code&gt;Write below etc&lt;/code&gt; rule. It had tens of exceptions:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt; ...
and not sed_temporary_file
and not exe_running_docker_save
and not ansible_running_python
and not python_running_denyhosts
and not fluentd_writing_conf_files
and not user_known_write_etc_conditions
and not run_by_centrify
and not run_by_adclient
and not qualys_writing_conf_files
and not git_writing_nssdb
...
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The exceptions all generally follow the same structure: naming a program and a directory prefix below &lt;code&gt;/etc&lt;/code&gt; where that program is allowed to write files.&lt;/p&gt;
&lt;h2 id="rule-exceptions"&gt;Rule Exceptions&lt;/h2&gt;
&lt;p&gt;Starting in &lt;code&gt;0.28.0&lt;/code&gt;, Falco supports an optional &lt;code&gt;exceptions&lt;/code&gt; property to rules. The &lt;code&gt;exceptions&lt;/code&gt; key is a &lt;a class='glossary-tooltip' title='Lists are collections of items that can be included in rules, macros, or other lists.' data-toggle='tooltip' data-placement='top' href='https://v0-43--falcosecurity.netlify.app/docs/rules/basic-elements/#lists' target='_blank' aria-label='list'&gt;list&lt;/a&gt; of identifier plus list of tuples of filtercheck fields. Here's an example:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;rule&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;Write below binary dir&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;desc&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;an attempt to write to any file below a set of binary directories&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;&amp;gt;&lt;span style="color:#b44;font-style:italic"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#b44;font-style:italic"&gt; open_write
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#b44;font-style:italic"&gt; and bin_dir
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#b44;font-style:italic"&gt; and not package_mgmt_procs
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#b44;font-style:italic"&gt; and not exe_running_docker_save
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#b44;font-style:italic"&gt; and not python_running_get_pip
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#b44;font-style:italic"&gt; and not python_running_ms_oms
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#b44;font-style:italic"&gt; and not user_known_write_below_binary_dir_activities&lt;/span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;exceptions&lt;/span&gt;:&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;name&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;proc_writer&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;fields&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;[proc.name, fd.directory]&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;comps&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;[=, =]&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;values&lt;/span&gt;:&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;- [my-custom-yum, /usr/bin]&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;- [my-custom-apt, /usr/local/bin]&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;name&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;cmdline_writer&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;fields&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;[proc.cmdline, fd.directory]&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;comps&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;[startswith, =]&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;name&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;container_writer&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;fields&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;[container.image.repository, fd.directory]&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;name&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;proc_filenames&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;fields&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;[proc.name, fd.name]&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;comps&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;[=, in]&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;values&lt;/span&gt;:&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;- [my-custom-dpkg, [/usr/bin, /bin]]&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;name&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;filenames&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;fields&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;fd.filename&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;comps&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;in&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This rule defines four kinds of exceptions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;proc_writer&lt;/code&gt;: uses a combination of &lt;code&gt;proc.name&lt;/code&gt; and &lt;code&gt;fd.directory&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;cmdline_writer&lt;/code&gt;: uses a combination of &lt;code&gt;proc.cmeline&lt;/code&gt; and &lt;code&gt;fd.directory&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;container_writer&lt;/code&gt;: uses a combination of &lt;code&gt;container.image.repository&lt;/code&gt; and &lt;code&gt;fd.directory&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;proc_filenames&lt;/code&gt;: uses a combination of process and list of filenames.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;filenames&lt;/code&gt;: uses a list of filenames&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The specific strings &lt;code&gt;proc_writer&lt;/code&gt;/&lt;code&gt;container_writer&lt;/code&gt;/&lt;code&gt;proc_filenames&lt;/code&gt;/&lt;code&gt;filenames&lt;/code&gt; are arbitrary strings and don't have a special meaning to the rules file parser. They're only used to provide a handy name, and to potentially link together values in a later rule override (more on that below).&lt;/p&gt;
&lt;p&gt;Notice that exceptions are defined as a part of the rule. This is important because the author of the rule defines what construes a valid exception to the rule. In this case, an exception can consist of a process and file directory (actor and target), but not a process name only (too broad).&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;fields&lt;/code&gt; property contains one or more fields that will extract a value from the events. The &lt;code&gt;comps&lt;/code&gt; property contains comparison operators that align 1-1 with the items in the fields property. The &lt;code&gt;values&lt;/code&gt; property contains tuples of values. Each item in the tuple should align 1-1 with the corresponding field and comparison operator. Together, each tuple of values is combined with the fields/comps to modify the condition to add an exclusion to the rule's condition.&lt;/p&gt;
&lt;p&gt;For example, for the exception &lt;code&gt;proc_writer&lt;/code&gt; above, the &lt;code&gt;fields&lt;/code&gt;/&lt;code&gt;comps&lt;/code&gt;/&lt;code&gt;values&lt;/code&gt; are the equivalent of adding the following to the rule's condition:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;... and not ((proc.name=my-custom-yum and fd.directory=/usr/bin) or (proc.name=my-custom-apt and fd.directory=/usr/local/bin))
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Note that when a comparison operator is &lt;code&gt;in&lt;/code&gt;, the corresponding values tuple item should be a list. &lt;code&gt;proc_filenames&lt;/code&gt; above uses that syntax, and is the equivalent of:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;... and not (proc.name=my-custom-dpkg and fd.name in (/usr/bin, /bin))
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id="exception-syntax-shortcuts"&gt;Exception Syntax Shortcuts&lt;/h3&gt;
&lt;p&gt;In general, the value for an exceptions &lt;code&gt;fields&lt;/code&gt; property should always be a list of fields. The &lt;code&gt;comps&lt;/code&gt; property must be an equal-length list of comparison operators, and the &lt;code&gt;values&lt;/code&gt; property must be a list of tuples, where each tuple has the same length as the &lt;code&gt;fields&lt;/code&gt;/&lt;code&gt;comps&lt;/code&gt; lists.&lt;/p&gt;
&lt;p&gt;However, there are a few shortcuts that can be used when defining an exception:&lt;/p&gt;
&lt;h4 id="values-are-optional"&gt;Values are Optional&lt;/h4&gt;
&lt;p&gt;A rule may define &lt;code&gt;fields&lt;/code&gt; and &lt;code&gt;comps&lt;/code&gt;, but not define &lt;code&gt;values&lt;/code&gt;. This allows a later rule override to add values to an exception (more on that below). The exception &lt;code&gt;cmdline_writer&lt;/code&gt; above has this format:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt; - name: cmdline_writer
fields: [proc.cmdline, fd.directory]
comps: [startswith, =]
&lt;/code&gt;&lt;/pre&gt;&lt;h4 id="fields-comps-can-be-a-single-value-not-a-list"&gt;Fields/Comps Can Be a Single Value, Not a List&lt;/h4&gt;
&lt;p&gt;An alternative way to define an exception is to have &lt;code&gt;fields&lt;/code&gt; containing a single field and &lt;code&gt;comps&lt;/code&gt; containing a single comparison operator (which must be one of &lt;code&gt;in&lt;/code&gt;, &lt;code&gt;pmatch&lt;/code&gt;, &lt;code&gt;intersects&lt;/code&gt;). In this format, &lt;code&gt;values&lt;/code&gt; is a list of values rather than list of tuples. The exception &lt;code&gt;filenames&lt;/code&gt; above has this format:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt; - name: filenames
fields: fd.filename
comps: in
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;In this case, the exception is the equivalent of:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;... and not (fd.filename in (...))
&lt;/code&gt;&lt;/pre&gt;&lt;h4 id="comps-is-optional"&gt;Comps is Optional&lt;/h4&gt;
&lt;p&gt;If &lt;code&gt;comps&lt;/code&gt; is not provided, a default value is filled in. When &lt;code&gt;fields&lt;/code&gt; is a list, &lt;code&gt;comps&lt;/code&gt; will be set to an equal-length list of &lt;code&gt;=&lt;/code&gt; operators. The exception &lt;code&gt;container_writer&lt;/code&gt; above has that format, and is equivalent to:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt; - name: container_writer
fields: [container.image.repository, fd.directory]
comps: [=, =]
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;When &lt;code&gt;fields&lt;/code&gt; is a single field, &lt;code&gt;comps&lt;/code&gt; is set to a single &lt;code&gt;in&lt;/code&gt; operator.&lt;/p&gt;
&lt;h3 id="appending-exception-values"&gt;Appending Exception Values&lt;/h3&gt;
&lt;p&gt;Exception values will most commonly be defined in rules overrides. Here's an example:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;list&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;apt_files&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;items&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;[/bin/ls, /bin/rm]&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;rule&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;Write below binary dir&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;exceptions&lt;/span&gt;:&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;name&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;proc_writer&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;values&lt;/span&gt;:&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;- [apk, /usr/lib/alpine]&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;- [npm, /usr/node/bin]&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;name&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;container_writer&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;values&lt;/span&gt;:&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;- [docker.io/alpine, /usr/libexec/alpine]&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;name&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;proc_filenames&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;values&lt;/span&gt;:&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;- [apt, [apt_files]]&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;- [rpm, [/bin/cp, /bin/pwd]]&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;name&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;filenames&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;values&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;[python, go]&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;override&lt;/span&gt;:&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;exceptions&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;append&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In this case, the values are appended to any values for the base rule, and then the &lt;code&gt;fields&lt;/code&gt;/&lt;code&gt;comps&lt;/code&gt;/&lt;code&gt;values&lt;/code&gt; are added to the rule's condition.&lt;/p&gt;
&lt;p&gt;Putting it all together, the effective rule condition for this rule is:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;... and not ((proc.name=my-custom-yum and fd.directory=/usr/bin) or # proc_writer
(proc.name=my-custom-apt and fd.directory=/usr/local/bin) or
(proc.name=apk and fd.directory=/usr/lib/alpine) or
(proc.name=npm and fd.directory=/usr/node/bin) or
(container.image.repository=docker.io/alpine and fd.name=/usr/libexec/alpine) or # container_writer
(proc.name=apt and fd.name in (apt_files)) or # proc_filenames
(proc.name=rpm and fd.name in (/bin/cp, /bin/pwd)) or
(fd.filename in (python, go)) # filenames
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id="replacing-exception-values"&gt;Replacing Exception Values&lt;/h3&gt;
&lt;p&gt;It's possible to replace the entire list(s) of values tuples for specific exception(s) by following the &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/reference/rules/overriding/"&gt;rules overriding syntax&lt;/a&gt; and specifying &lt;code&gt;exceptions: replace&lt;/code&gt;. Here's an example:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;list&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;apt_files&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;items&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;[/bin/ls, /bin/rm]&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;rule&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;Write below binary dir&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;exceptions&lt;/span&gt;:&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;name&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;proc_writer&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;values&lt;/span&gt;:&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;- [apk, /usr/lib/alpine]&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;- [npm, /usr/node/bin]&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;name&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;container_writer&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;values&lt;/span&gt;:&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;- [docker.io/alpine, /usr/libexec/alpine]&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;name&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;proc_filenames&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;values&lt;/span&gt;:&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;- [apt, [apt_files]]&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;- [rpm, [/bin/cp, /bin/pwd]]&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;name&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;filenames&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;values&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;[python, go]&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;override&lt;/span&gt;:&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;exceptions&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;replace&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Here, the values lists for the &lt;code&gt;proc_writer&lt;/code&gt;, &lt;code&gt;container_writer&lt;/code&gt;, &lt;code&gt;proc_filenames&lt;/code&gt; and &lt;code&gt;filenames&lt;/code&gt; exceptions will be replaced (or initialized) with the corresponding values lists, Putting it all together, the effective rule condition for this rule will be:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;... and not ((proc.name=apk and fd.directory=/usr/lib/alpine) or # proc_writer
(proc.name=npm and fd.directory=/usr/node/bin) or
(container.image.repository=docker.io/alpine and fd.name=/usr/libexec/alpine) or # container_writer
(proc.name=apt and fd.name in (apt_files)) or # proc_filenames
(proc.name=rpm and fd.name in (/bin/cp, /bin/pwd)) or
(fd.filename in (python, go)) # filenames
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id="guidelines-for-adding-exceptions-to-rules"&gt;Guidelines For Adding Exceptions To Rules&lt;/h2&gt;
&lt;p&gt;The default rules files have been revamped to use exceptions whenever possible, and are a good reference for best practices when defining exceptions for rules. Here are some other guidelines to follow:&lt;/p&gt;
&lt;h3 id="be-specific"&gt;Be Specific&lt;/h3&gt;
&lt;p&gt;When defining an exception, try to think about the &lt;em&gt;actor&lt;/em&gt;, &lt;em&gt;action&lt;/em&gt;, and &lt;em&gt;target&lt;/em&gt;, and whenever possible use all three items for an exception. For example, instead of simply using &lt;code&gt;proc.name&lt;/code&gt; or &lt;code&gt;container.image.repository&lt;/code&gt; for a file-based exception, also include the file being acted on via &lt;code&gt;fd.name&lt;/code&gt;, &lt;code&gt;fd.directory&lt;/code&gt;, etc. Similarly, if a rule is container-specific, don't only include the image &lt;code&gt;container.image.repository&lt;/code&gt;, also include the process name &lt;code&gt;proc.name&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id="use-set-operators"&gt;Use Set Operators&lt;/h3&gt;
&lt;p&gt;If an exception involves a set of process names, file paths, etc., combine the process names into a list and use the &lt;code&gt;in&lt;/code&gt;/&lt;code&gt;pmatch&lt;/code&gt; operator to handle the values in a single exception. Here's an example:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;name&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;proc_file&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;fields&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;[proc.name, fd.name]&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;comps&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;[in, in]&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;values&lt;/span&gt;:&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;- [[qualys-cloud-ag], [/etc/qualys/cloud-agent/qagent-log.conf]]&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;- [[update-haproxy-,haproxy_reload.], [/etc/openvpn/client.map]]&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;- [[start-fluentd], [/etc/fluent/fluent.conf, /etc/td-agent/td-agent.conf]]&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This exception matches process name and path, but allows for multiple process names writing to any of a set of files.&lt;/p&gt;
&lt;h2 id="more-information"&gt;More Information&lt;/h2&gt;
&lt;p&gt;The original &lt;a href="https://github.com/falcosecurity/falco/blob/master/proposals/20200828-structured-exception-handling.md"&gt;proposal&lt;/a&gt; describes the benefits of exceptions in more detail.&lt;/p&gt;</description></item><item><title>Docs: Controlling Rules</title><link>https://v0-43--falcosecurity.netlify.app/docs/concepts/rules/controlling-rules/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-43--falcosecurity.netlify.app/docs/concepts/rules/controlling-rules/</guid><description>
&lt;h2 id="disable-default-rules"&gt;Disable Default Rules&lt;/h2&gt;
&lt;p&gt;Even though Falco provides a quite powerful default ruleset, you sometimes need to disable some of these default &lt;a class='glossary-tooltip' title='Rules are conditions under which an alert should be generated.' data-toggle='tooltip' data-placement='top' href='https://v0-43--falcosecurity.netlify.app/docs/rules/basic-elements/#rules' target='_blank' aria-label='rules'&gt;rules&lt;/a&gt; since they do not work properly in your environment. Luckily Falco offers you multiple possibilities to do so.&lt;/p&gt;
&lt;h3 id="via-falco-configuration-or-parameters"&gt;Via Falco Configuration or Parameters&lt;/h3&gt;
&lt;p&gt;Since Falco 0.38.0, you can control which rules are loaded by adding relevant entries to the &lt;code&gt;rules&lt;/code&gt; section of the &lt;code&gt;falco.yaml&lt;/code&gt; configuration file or by passing appropriate command line parameters. In the &lt;code&gt;rules&lt;/code&gt; section you can add any number of &lt;code&gt;enable&lt;/code&gt; or &lt;code&gt;disable&lt;/code&gt; entries:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;enable&lt;/span&gt;:&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;rule&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;&amp;lt;wildcard pattern&amp;gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;disable&lt;/span&gt;:&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;rule&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;&amp;lt;wildcard pattern&amp;gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;enable&lt;/span&gt;:&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;tag&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;&amp;lt;tag&amp;gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;disable&lt;/span&gt;:&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;tag&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;&amp;lt;tag&amp;gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;All the entries are treated as commands and evaluated in order, thus controlling the &lt;code&gt;enabled&lt;/code&gt; status of the loaded rules. For instance, in order to only enable the rules called &lt;code&gt;Netcat Remote Code Execution in Container&lt;/code&gt; and &lt;code&gt;Delete or rename shell history&lt;/code&gt; you can supply the following configuration:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;rules&lt;/span&gt;:&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;disable&lt;/span&gt;:&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;rule&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#b44"&gt;&amp;#34;*&amp;#34;&lt;/span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;enable&lt;/span&gt;:&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;rule&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;Netcat Remote Code Execution in Container&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;enable&lt;/span&gt;:&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;rule&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;Delete or rename shell history&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The above instructs Falco to first disable all rules (regardless of their &lt;code&gt;enabled&lt;/code&gt; status in the files or any override), then enable the Netcat rule and finally enable the deletion rule.&lt;/p&gt;
&lt;p&gt;Alternatively, this configuration can be supplied on the Falco command line by using the &lt;code&gt;-o&lt;/code&gt; option.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-sh" data-lang="sh"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;falco -o &lt;span style="color:#b44"&gt;&amp;#34;rules[].enable.tag=network&amp;#34;&lt;/span&gt; -o &lt;span style="color:#b44"&gt;&amp;#34;rules[].enable.rule=Directory traversal monitored file&amp;#34;&lt;/span&gt; -o &lt;span style="color:#b44"&gt;&amp;#34;rules[].enable.rule=k8s_*&amp;#34;&lt;/span&gt; -o &lt;span style="color:#b44"&gt;&amp;#34;rules[].disable.rule=k8s_noisy_rule&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In the above example, all the rules tagged &lt;code&gt;network&lt;/code&gt; are enabled, the &lt;code&gt;Directory traversal monitored file&lt;/code&gt; will also be enabled alongside any rule matching the pattern &lt;code&gt;k8s_*&lt;/code&gt;, and then the rule &lt;code&gt;k8s_noisy_rule&lt;/code&gt; will be disabled; all of this happens regardless of any &lt;code&gt;enabled&lt;/code&gt; status specified in the rules files. If both yaml configuration and &lt;code&gt;-o&lt;/code&gt; options are specified, the CLI options are applied last.&lt;/p&gt;
&lt;p&gt;These parameters can also be specified as Helm chart value (&lt;code&gt;extraArgs&lt;/code&gt;) if you are deploying Falco via the official Helm chart.&lt;/p&gt;
&lt;h3 id="macros"&gt;Via existing Macros&lt;/h3&gt;
&lt;p&gt;Most of the default rules offer some kind of &lt;code&gt;user_*&lt;/code&gt; &lt;a class='glossary-tooltip' title='Macros are rule condition snippets that can be re-used inside rules and even other macros.' data-toggle='tooltip' data-placement='top' href='https://v0-43--falcosecurity.netlify.app/docs/rules/basic-elements/#macros' target='_blank' aria-label='macros'&gt;macros&lt;/a&gt; which are already part of the rule conditions. These &lt;code&gt;user_*&lt;/code&gt; macros are usually set to &lt;code&gt;(never_true)&lt;/code&gt; or &lt;code&gt;(always_true)&lt;/code&gt; which basically enables or disables the regarding rule. Now if you want to disable a default rule (e.g. &lt;code&gt;Read sensitive file trusted after startup&lt;/code&gt;), you just have to override the rule's &lt;code&gt;user_*&lt;/code&gt; macro (&lt;code&gt;user_known_read_sensitive_files_activities&lt;/code&gt; in this case) inside your custom Falco configuration.&lt;/p&gt;
&lt;p&gt;Example for your custom Falco configuration (note the &lt;code&gt;(always_true)&lt;/code&gt; condition):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;macro&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;user_known_read_sensitive_files_activities&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;(always_true)&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Please note again that the order of the specified configuration file matters! The last defined macro with the same name wins.&lt;/p&gt;
&lt;h3 id="via-custom-rule-definition"&gt;Via Custom Rule Definition&lt;/h3&gt;
&lt;div class="card card-sm pageinfo pageinfo-warning my-4"&gt;
&lt;div class="card-body"&gt;
&lt;div class="card-text"&gt;
&lt;p&gt;The &lt;code&gt;enabled&lt;/code&gt; attribute used as an override is deprecated and it will be removed in Falco &lt;code&gt;1.0.0&lt;/code&gt;. Use the &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/rules/overriding/#enabling-a-disabled-rule"&gt;&lt;code&gt;override.enabled&lt;/code&gt; attribute&lt;/a&gt; instead.
Please note that the &lt;code&gt;enabled&lt;/code&gt; key is only deprecated when used as an override! So a rule like this is perfectly legit:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;rule&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;legit_rule&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;desc&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;legit rule description&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;evt.type=open&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;output&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;user=%user.name command=%proc.cmdline file=%fd.name&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;priority&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;INFO&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;enabled&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#a2f;font-weight:bold"&gt;false&lt;/span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Last but not the least, you can just disable a rule that is enabled by default using the &lt;code&gt;enabled: false&lt;/code&gt; rule property.
This is especially useful for rules which do not provide a &lt;code&gt;user_*&lt;/code&gt; macro in the default condition.&lt;/p&gt;
&lt;p&gt;Ensure that the custom configuration file loads after the default configuration file. You can configure the right order using multiple &lt;code&gt;-r&lt;/code&gt; parameters or directly inside the falco configuration file &lt;code&gt;falco.yaml&lt;/code&gt; through &lt;code&gt;rules_files&lt;/code&gt;. If you are using the official Helm chart, then configure the order with the &lt;code&gt;falco.rules_files&lt;/code&gt; value.&lt;/p&gt;
&lt;p&gt;For example to disable the &lt;code&gt;User mgmt binaries&lt;/code&gt; default rule in &lt;code&gt;/etc/falco/falco_rules.yaml&lt;/code&gt; define a custom rule in &lt;code&gt;/etc/falco/rules.d/custom-rules.yaml&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;rule&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;User mgmt binaries&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;enabled&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#a2f;font-weight:bold"&gt;false&lt;/span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;At the same time, disabled rules can be re-enabled by using the &lt;code&gt;enabled: true&lt;/code&gt; rule property. For instance, the &lt;code&gt;Change thread namespace&lt;/code&gt; rule in &lt;code&gt;/etc/falco/falco_rules.yaml&lt;/code&gt; that is disabled by default, can be manually enabled with:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;rule&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;Change thread namespace&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;enabled&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#a2f;font-weight:bold"&gt;true&lt;/span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="tags"&gt;Rule Tags&lt;/h2&gt;
&lt;p&gt;As of 0.6.0, rules have an optional set of &lt;a class='glossary-tooltip' title='Labels that can be attached to the rules, allow to select the subset of rules to enable.' data-toggle='tooltip' data-placement='top' href='https://v0-43--falcosecurity.netlify.app/docs/rules/controlling-rules/#tags' target='_blank' aria-label='tags'&gt;tags&lt;/a&gt; that are used to categorize the ruleset into groups of related rules. Here's an example:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;rule&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;File Open by Privileged Container&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;desc&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;Any open by a privileged container. Exceptions are made for known trusted images.&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;(open_read or open_write) and container and container.privileged=true and not trusted_containers&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;output&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;File opened for read/write by privileged container | user=%user.name command=%proc.cmdline file=%fd.name&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;priority&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;WARNING&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;tags&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;[container, cis]&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In this case, the rule &amp;quot;File Open by Privileged Container&amp;quot; has been given the tags &amp;quot;container&amp;quot; and &amp;quot;cis&amp;quot;. If the tags key is not present for a given rule or the list is empty, a rule has no tags.&lt;/p&gt;
&lt;p&gt;Here's how you can use tags:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;You can use the &lt;code&gt;-T &amp;lt;tag&amp;gt;&lt;/code&gt; argument to disable rules having a given tag. &lt;code&gt;-T&lt;/code&gt; can be specified multiple times. For example, to skip all rules with the &amp;quot;filesystem&amp;quot; and &amp;quot;cis&amp;quot; tags you would run falco with &lt;code&gt;falco -T filesystem -T cis ...&lt;/code&gt;. &lt;code&gt;-T&lt;/code&gt; can not be specified with &lt;code&gt;-t&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;You can use the &lt;code&gt;-t &amp;lt;tag&amp;gt;&lt;/code&gt; argument to &lt;em&gt;only&lt;/em&gt; run those rules having a given tag. &lt;code&gt;-t&lt;/code&gt; can be specified multiple times. For example, to only run those rules with the &amp;quot;filesystem&amp;quot; and &amp;quot;cis&amp;quot; tags, you would run falco with &lt;code&gt;falco -t filesystem -t cis ...&lt;/code&gt;. &lt;code&gt;-t&lt;/code&gt; can not be specified with &lt;code&gt;-T&lt;/code&gt; or &lt;code&gt;-D &amp;lt;pattern&amp;gt;&lt;/code&gt; (disable rules by rule name regex).&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="tags-for-current-falco-ruleset"&gt;Tags for Current Falco Ruleset&lt;/h3&gt;
&lt;p&gt;We've also gone through the default ruleset and tagged all the rules with an initial set of tags. Here are the tags we've used:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th style="text-align: left"&gt;Tag&lt;/th&gt;
&lt;th style="text-align: left"&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;filesystem&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;The rule relates to reading/writing files&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;software_mgmt&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;The rule relates to any software/package management tool like rpm, dpkg, etc.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;process&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;The rule relates to starting a new process or changing the state of a current process&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;database&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;The rule relates to databases&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;host&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;The rule &lt;em&gt;only&lt;/em&gt; works outside of containers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;shell&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;The rule specifically relates to starting shells&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;container&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;The rule &lt;em&gt;only&lt;/em&gt; works inside containers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;cis&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;The rule is related to the CIS Docker benchmark&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;users&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;The rule relates to management of users or changing the identity of a running process&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;network&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;The rule relates to network activity&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Rules can have multiple tags if they relate to multiple of the above. Every rule in the falco ruleset currently has at least one tag.&lt;/p&gt;
&lt;div class="alert alert-primary" role="alert"&gt;
&lt;h4 class="alert-heading"&gt;Ignored system calls&lt;/h4&gt;
&lt;p&gt;For performance reasons, some system calls are currently discarded before Falco processes them.&lt;br&gt;
You can see the complete list by running falco with &lt;code&gt;-i&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;If you'd like to run Falco against all events, including system calls in the above list,&lt;br&gt;
you can run Falco with the &lt;code&gt;-A&lt;/code&gt; flag.&lt;/p&gt;
&lt;p&gt;For more information, see &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/rules/supported-events"&gt;supported events&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;</description></item><item><title>Docs: Custom Ruleset</title><link>https://v0-43--falcosecurity.netlify.app/docs/concepts/rules/custom-ruleset/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-43--falcosecurity.netlify.app/docs/concepts/rules/custom-ruleset/</guid><description>
&lt;p&gt;To write a custom rule for Falco from scratch, it is essential to understand the conditions that need to be met for Falco to trigger an alert. However, this task is complex as it requires considering the potential false positives and negatives arising from the rule.&lt;/p&gt;
&lt;h2 id="rules-placement"&gt;Rules Placement&lt;/h2&gt;
&lt;p&gt;When adding a new rule to Falco, the first step is determining its placement. For instance, when loading syscall rules, Falco groups them per system call (&lt;code&gt;evt.type&lt;/code&gt;) for faster matching and processes them later in sequential order, ensuring that two rules are not triggered simultaneously for the same &lt;code&gt;evt.type&lt;/code&gt; field value. Consequently, more general rules should be positioned at the end of the rule set, while more specific rules should be placed at the beginning. This arrangement prevents general rules from capturing events that more specific rules should handle.&lt;/p&gt;
&lt;p&gt;It's worth noting that Falco loads a set of predefined rules by default, followed by any custom rules located in the &lt;code&gt;/etc/falco/rules.d&lt;/code&gt; directory. This configuration is specified in the &lt;a href="https://github.com/falcosecurity/falco/blob/master/falco.yaml"&gt;&lt;code&gt;/etc/falco/falco.yaml&lt;/code&gt;&lt;/a&gt; file, under the &lt;code&gt;rules_files&lt;/code&gt; key, as follows:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;rules_files:
- /etc/falco/falco_rules.yaml
- /etc/falco/falco_rules.local.yaml
- /etc/falco/rules.d
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;It can nevertheless be adjusted to prioritize the rules in the &lt;code&gt;rules.d&lt;/code&gt; directory, include different rule files or even add new directories. The customization options are flexible.&lt;/p&gt;
&lt;p&gt;Considering this, it's important to remember that the default rules file includes reusable lists and macros that may help to create new rules. Therefore, you should carefully decide whether you want to delay the processing of those files or turn off a general rule that captures events intended for your custom rule. Alternatively, you can customize an existing rule within the &lt;code&gt;rules.d&lt;/code&gt; directory by either rewriting the entire rule or using the &amp;quot;append&amp;quot; key to modify it.&lt;/p&gt;
&lt;p&gt;If you are deploying Falco on a Kubernetes cluster, you will likely use &lt;a href="https://helm.sh"&gt;Helm&lt;/a&gt; for the installation. In this scenario, instead of placing custom rules files directly in the &lt;code&gt;/etc/falco/rules.d&lt;/code&gt; directory, you can add them to the &lt;code&gt;values.yaml&lt;/code&gt; file provided to the &lt;code&gt;helm&lt;/code&gt; command.&lt;/p&gt;
&lt;p&gt;Locate the line &lt;code&gt;customRules: {}&lt;/code&gt; in the &lt;a href="https://github.com/falcosecurity/charts/blob/master/charts/falco/values.yaml"&gt;&lt;code&gt;values.yaml&lt;/code&gt;&lt;/a&gt; file and replace it with a configuration similar to the following:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;customRules:
custom-rules.yaml: |-
- rule: Example rule
desc: ...
...
- rule: Example rule 2
...
more-custom-rules.yaml: |-
- rule: ...
...
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;That will instruct Helm to create as many rules files as you define here accessible inside the Falco Pods, under the directory &lt;code&gt;/etc/falco/rules.d&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Finally, remember that keeping any previous ruleset and extending it, although sometimes recommended, is not enforced. It's acceptable to create a new ruleset by reorganizing the upstream rules, reordering and rewriting them, mixing in custom rules, splitting them into different sets and files, etc. Default Falco rules should be considered more of a guidance than a requirement to adopt.&lt;/p&gt;
&lt;p&gt;To learn more about tweaking the Falco configuration to install new rules, see the documentation about &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/rules/default-custom"&gt;default and local rules&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="rules-structure"&gt;Rules Structure&lt;/h2&gt;
&lt;p&gt;Rules in Falco are defined using YAML syntax. Each rule is represented as an object in a YAML list, denoted by using a hyphen (&lt;code&gt;-&lt;/code&gt;) before the first key in the rule. When creating a new rule, several essential keys should be included:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;- rule:
desc:
condition:
output:
priority:
tags:
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;rule&lt;/code&gt; key will indicate this is a rule to consider when processing the full set of rules. Without this key, Falco will ignore that entry. It has to be unique to create a new rule. Otherwise, it will overwrite any previously defined rule with the same value.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;desc&lt;/code&gt; key provides a detailed description of the rule's purpose, behavior, or the events it aims to detect. It helps with understanding the rule's intent and assists in documentation. Missing this key in the rule will make Falco show the error message:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;LOAD_ERR_YAML_VALIDATE (Error validating internal structure of YAML file): Item has no mapping for key &amp;#39;desc&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;priority&lt;/code&gt; key represents the severity of the alert triggered by Falco and corresponds with the well-known Syslog severities: emergency, alert, critical, error, warning, notice, informational, and debug. Missing this key in the rule will make Falco show the error message:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;LOAD_ERR_YAML_VALIDATE (Error validating internal structure of YAML file): Item has no mapping for key &amp;#39;priority&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;condition&lt;/code&gt; key defines the conditions that must be satisfied for the rule to trigger an alert. It consists of one or more expressions or statements that evaluate to true when the desired event occurs. Missing this key in the rule will make Falco show the error message:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;LOAD_ERR_YAML_VALIDATE (Error validating internal structure of YAML file): Item has no mapping for key &amp;#39;condition&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;output&lt;/code&gt; key determines the output format of the alert generated by the rule. It specifies how the alert should be formatted and what information should be included. Missing this key in the rule will make Falco show the error message:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;LOAD_ERR_YAML_VALIDATE (Error validating internal structure of YAML file): Item has no mapping for key &amp;#39;output&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;tags&lt;/code&gt; key categorizes the ruleset into groups of related rules. Although not mandatory when starting to write a rule, its use is highly recommended at a later stage for management purposes. For further information, refer to the [Tags section of the Style Guide of Falco Rules][/docs/rules/style-guide/#tags)&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Refer to the &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/rules/basic-elements/#advanced-rule-syntax"&gt;Advanced Rule Syntax&lt;/a&gt; documentation to enhance your Falco rules further. The &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/rules/style-guide"&gt;Style Guide of Falco Rules&lt;/a&gt; is also highly recommended to ensure your rules are easier to maintain and share with the community. These resources will provide you with valuable information about additional keys that can be used to augment and customize your Falco rules. Exploring these advanced options will allow you to expand the capabilities and effectiveness of your rules.&lt;/p&gt;
&lt;h2 id="building-up-the-condition"&gt;Building up the Condition&lt;/h2&gt;
&lt;p&gt;A condition in Falco acts as a checklist of requirements an event must meet to trigger the rule. To comprehend this evaluation process, it is essential to have a grasp of &lt;a href="https://en.wikipedia.org/wiki/Boolean_algebra"&gt;Boolean algebra&lt;/a&gt;. Ultimately, the condition will either evaluate to true, triggering the associated alert and bypassing the remaining rules, or evaluate to false, causing the next rule to be evaluated.&lt;/p&gt;
&lt;p&gt;To achieve the desired effect, it is necessary to consider the Boolean operators: &lt;code&gt;and&lt;/code&gt;, &lt;code&gt;or&lt;/code&gt;, and &lt;code&gt;not&lt;/code&gt;. These operators enable the condition to evaluate one or more situations and produce the desired outcome.&lt;/p&gt;
&lt;p&gt;Each item on the checklist corresponds to a comparison involving the information in the syscall invocation and any relevant metadata that provides additional context. These comparisons employ operators such as &lt;code&gt;=&lt;/code&gt;, &lt;code&gt;!=&lt;/code&gt;, &lt;code&gt;in&lt;/code&gt;, &lt;code&gt;contains&lt;/code&gt;, and others. Refer to the &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/rules/conditions/#operators"&gt;section operators&lt;/a&gt; in the documentation for a more extensive list of available operators.&lt;/p&gt;
&lt;p&gt;Before proceeding, it's recommended to refer to the &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/rules/conditions/"&gt;condition syntax&lt;/a&gt; documentation, which provides detailed guidance on writing conditions. This resource will offer valuable information to ensure accurate and effective condition creation.&lt;/p&gt;
&lt;p&gt;When constructing comparisons within conditions, an extensive set of fields is available for use. To simplify the process, you can consult &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/reference/rules/supported-fields/"&gt;this list&lt;/a&gt;, a handy cheat sheet for writing new rules.&lt;/p&gt;
&lt;h2 id="leveraging-macros-and-lists"&gt;Leveraging Macros and Lists&lt;/h2&gt;
&lt;p&gt;Additionally, the benefits of using &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/rules/basic-elements/#macros"&gt;macros&lt;/a&gt; and &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/rules/basic-elements/#lists"&gt;lists&lt;/a&gt; when writing rules are worth noting: leveraging these features allows for more straightforward and more concise rule creation while promoting the reuse of conditions that have been thoroughly tested. This approach enhances maintainability and efficiency in rule development.&lt;/p&gt;
&lt;p&gt;Observe the following rule that detects when a &lt;code&gt;bash&lt;/code&gt; shell is spawned inside a container:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;- rule: Example Rule
condition: container.id != host and proc.name = bash and evt.type = execve and proc.pname exists and not proc.pname in (bash, docker)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;could be rewritten as:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;- rule: Example Rule
condition: container and proc.name = bash and spawned_process and proc.pname exists and not proc.pname in (bash, docker)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;where &lt;code&gt;container&lt;/code&gt; and &lt;code&gt;spawned_process&lt;/code&gt; are macros already included in the default falco ruleset.&lt;/p&gt;
&lt;p&gt;We can even go one step beyond adding a list of our own:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;- list: allowed_binaries
items: [bash, docker]
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Allowing us to rewrite the rule as:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;- rule: Example Rule
condition: container and proc.name = bash and spawned_process and proc.pname exists and not proc.pname in allowed_binaries
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id="evaluation-priorities"&gt;Evaluation Priorities&lt;/h2&gt;
&lt;p&gt;When using the boolean operator &lt;code&gt;or&lt;/code&gt;, it is crucial to include evaluation priorities by utilizing parentheses &lt;code&gt;(&lt;/code&gt; and &lt;code&gt;)&lt;/code&gt;. These parentheses can be nested, and it is recommended to incorporate them within macros as they become part of larger conditions. Neglecting to use parentheses appropriately may lead to unexpected results that differ from the intended outcome.&lt;/p&gt;
&lt;p&gt;Consider the following example to demonstrate the appropriate use of parentheses for setting evaluation priorities. Please note that the rule is quite extensive, indicated by the &lt;code&gt;&amp;gt;&lt;/code&gt; symbol in YAML syntax, which signifies that it spans across multiple lines:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;- rule: Example Rule
desc: An illustrative rule demonstrating evaluation priority with parentheses
condition: &amp;gt;
(syscall.type = execve and proc.name = &amp;#34;/bin/bash&amp;#34;) or
(syscall.type = open and (fd.name contains &amp;#34;/etc/passwd&amp;#34; or fd.name contains &amp;#34;/etc/shadow&amp;#34;))
output: Log the relevant event.
priority: debug
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;In this example, the condition is structured to prioritize specific evaluations through the use of parentheses. It ensures that the rule triggers an alert when either the &lt;code&gt;execve&lt;/code&gt; syscall type is matched and the process name is &lt;code&gt;/bin/bash&lt;/code&gt;, or when the &lt;code&gt;open&lt;/code&gt; syscall type is matched and the file descriptor name contains either &lt;code&gt;/etc/passwd&lt;/code&gt; or &lt;code&gt;/etc/shadow&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The proper placement of parentheses allows for accurate evaluation and ensures that the rule behaves as intended.&lt;/p&gt;
&lt;h2 id="false-positives-and-negatives"&gt;False Positives and Negatives&lt;/h2&gt;
&lt;p&gt;As previously explained, the &lt;code&gt;condition&lt;/code&gt; key includes all the necessary checks an event must satisfy to trigger a specific rule. If there are too few checks in the condition, the rule might become too general and trigger frequently, potentially resulting in many false positives. These broad conditions can be useful for initial testing to ensure the rule is being reached and triggered. If the rule is never triggered, it suggests that a previous rule may be capturing the event before it reaches the intended rule.&lt;/p&gt;
&lt;p&gt;An example of a rule that is too general is provided below:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;- rule: Too General Rule
desc: An example of a rule that is an overly broad
condition: &amp;gt;
proc.name != &amp;#34;systemd&amp;#34; and evt.type = execve
output: Log the relevant event.
priority: debug
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Another example would be a rule designed to monitor all activity generated by a specific process, like:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;- rule: Monitor only a process named malicious
desc: Another example of an overly broad rule
condition: proc.name = malicious
output: The process %proc.name has used the syscall %evt.type
priority: debug
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;While these examples are useful for initial testing and gathering samples from certain commands, it's important to note that they are too general to yield reliable alerts. Instead, these broad examples are more likely to generate many false positives.&lt;/p&gt;
&lt;p&gt;On the contrary, if a condition becomes overly specific or contradictory, it may fail to trigger when necessary, resulting in what is known as false negatives. To illustrate this point, consider the following example:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;- rule: Example of a too-specific rule
...
condition: evt.type = execve and proc.name = malicious and proc.pid = 1
output: The process %proc.name has used the syscall %evt.type
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The previous rule would seldom trigger because it relies on a specific PID (Process ID) for the process, which may only occur if executed within a container. While this example represents an extreme case, it highlights the consequences of being excessively specific when defining a condition. It emphasizes that overly specific conditions can lead to infrequent triggering or potentially not triggering in real-world scenarios.&lt;/p&gt;
&lt;h2 id="tuning-a-rule-by-adding-exceptions-to-it"&gt;Tuning a Rule by adding Exceptions to it&lt;/h2&gt;
&lt;p&gt;Adding exceptions to an existing Falco rule is a useful approach when you want to exclude specific scenarios from triggering that rule. Instead of using the &lt;code&gt;and not&lt;/code&gt; operators in the condition, which can make the condition more complex and harder to understand, Falco provides a recommended method for handling exceptions.&lt;/p&gt;
&lt;p&gt;To add exceptions to a rule, you can utilize the &lt;code&gt;exceptions&lt;/code&gt; key within the rule definition. Specifying one or more conditions under the &lt;code&gt;exceptions&lt;/code&gt; key allows you to define scenarios where the rule should not be triggered, even if the main condition is satisfied. This approach enhances the readability and maintainability of the rule by explicitly stating the exceptions separately.&lt;/p&gt;
&lt;p&gt;Considering the following simplified rule:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;- rule: Launch Privileged Container
desc: Detect the start of a privileged container.
condition: &amp;gt;
container_started and container
and container.privileged=true
output: Privileged container
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;One way of adding exceptions would be using the &lt;code&gt;and not&lt;/code&gt; combination explained above:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;- list: trusted_images
items: [docker.io/user/image1, quay.io/user/image2]
- rule: Launch Privileged Container
desc: Detect the start of a privileged container. Exceptions are made for known trusted images.
condition: &amp;gt;
container_started and container
and container.privileged=true
and not ( container.image.repository in (trusted_images) or
container.image.repository startswith registry.local/ )
output: Privileged container
priority: debug
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The same example using the &lt;code&gt;exceptions&lt;/code&gt; key:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;- rule: Launch Privileged Container
desc: Detect the start of a privileged container.
condition: &amp;gt;
container_started and container
and container.privileged=true
output: Privileged container
priority: debug
exceptions:
- name: trusted_images
fields: [container.image.repository]
comps: [in]
values:
- [(trusted_images)]
- name: local_images
fields: [container.image.repository]
comps: [startswith]
values:
- [registry.local/]
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;While this may seem exaggerated for the provided exceptions, it highlights the true strength of the exceptions key when dealing with a larger number of variables. To demonstrate this, let's explore another example:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;- rule: Launch Privileged Container
desc: Detect the start of a privileged container. Exceptions are made for known trusted images.
condition: &amp;gt;
container_started and container
and container.privileged=true
and not ((container.image.repository = registry.local/user/java-app and proc.name = /usr/bin/java ) or
(container.image.repository = docker.io/user/httpd and proc.name = /usr/bin/httpd ) or
(container.image.repository = quay.io/user/mysql and proc.name = /usr/bin/mysqld ))
output: Privileged container
priority: debug
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Using the &lt;code&gt;exceptions&lt;/code&gt; key it would now look like:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;- rule: Launch Privileged Container
desc: Detect the start of a privileged container.
condition: &amp;gt;
container_started and container
and container.privileged=true
output: Privileged container
priority: debug
exceptions:
- name: trusted_images
fields: [container.image.repository, proc.name]
comps: [=,=]
values:
- [ registry.local/user/java-app, /usr/bin/java ]
- [ docker.io/user/httpd, /usr/bin/httpd ]
- [ quay.io/user/mysql, /usr/bin/mysqld ]
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;In the last rule provided, you can observe the inclusion of three exceptions, each containing two conditions. When the rules parser processes these conditions, it expands them into a format the rules engine can comprehend and utilize for evaluation. The values of the &lt;code&gt;comps&lt;/code&gt; key may differ depending on the complexity of our conditions, and in some cases, multiple exception groups might be required to accommodate the rule's requirements.&lt;/p&gt;
&lt;p&gt;Although this example remains relatively straightforward, it effectively demonstrates the capability and versatility of the exceptions key in handling various conditions and exceptions. This feature empowers you to create more sophisticated and specific rules while maintaining clarity and simplicity in the rule definition.&lt;/p&gt;
&lt;h2 id="selecting-the-system-call-to-monitor"&gt;Selecting the System Call to monitor&lt;/h2&gt;
&lt;p&gt;The kernel provides many system calls that enable processes and libraries to interact with various system resources. These system calls cover a wide range of tasks, from starting new processes to opening files or network sockets, allowing us to gain insights into the actions attempted by processes.&lt;/p&gt;
&lt;p&gt;To illustrate this, let's consider a fictional example. When given appropriate permissions, the following code can elevate privileges for a user executing it.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#define _GNU_SOURCE
#include &amp;lt;unistd.h&amp;gt;
#include &amp;lt;stdlib.h&amp;gt;
#include &amp;lt;sys/wait.h&amp;gt;
int main(int argc, char* argv[])
{
setresuid(0, 0, 0);
int pid = fork();
if (pid == 0) {
system(&amp;#34;/bin/bash&amp;#34;);
} else {
wait(&amp;amp;pid);
}
return 0;
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To compile it, use your favorite Linux C compiler and set the SUID bit on the binary. We are doing a static compilation here to simplify our example here.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# cc -static -o /tmp/malicious malicious.c
# chmod u+s /tmp/malicious
# ls -l /tmp/malicious
-rwsr-xr-x 1 root root 16888 Jan 11:30 /tmp/malicious
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Executed as a regular user, it should grant them a root shell:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ /tmp/malicious
#
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To observe what this program does once executed, we'll use &lt;code&gt;strace&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ strace /tmp/malicious
execve(&amp;#34;/tmp/malicious&amp;#34;, [&amp;#34;/tmp/malicious&amp;#34;], 0x7ffeaaf27690 /* 24 vars */) = 0
access(&amp;#34;/etc/suid-debug&amp;#34;, F_OK) = -1 ENOENT (No such file or directory)
arch_prctl(0x3001 /* ARCH_??? */, 0x7ffd8b18f0c0) = -1 EINVAL (Invalid argument)
brk(NULL) = 0x1f09000
brk(0x1f0a1c0) = 0x1f0a1c0
arch_prctl(ARCH_SET_FS, 0x1f09880) = 0
uname({sysname=&amp;#34;Linux&amp;#34;, nodename=&amp;#34;vagrant&amp;#34;, ...}) = 0
readlink(&amp;#34;/proc/self/exe&amp;#34;, &amp;#34;/tmp/malicious&amp;#34;, 4096) = 14
brk(0x1f2b1c0) = 0x1f2b1c0
brk(0x1f2c000) = 0x1f2c000
mprotect(0x4bf000, 12288, PROT_READ) = 0
fcntl(0, F_GETFD) = 0
fcntl(1, F_GETFD) = 0
fcntl(2, F_GETFD) = 0
setresuid(0, 0, 0) = -1 EPERM (Operation not permitted)
clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x1f09b50) = 18104
wait4(-1,
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Pay attention to the &lt;code&gt;Operation not permitted&lt;/code&gt; message when trying to run the command:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;setresuid(0, 0, 0) = -1 EPERM (Operation not permitted)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The reason is that the command &lt;code&gt;strace&lt;/code&gt; doesn't have enough permissions to let &lt;code&gt;/tmp/malicious&lt;/code&gt; escalate privileges. But that doesn't mean we can't use that information to detect when a program tries it.&lt;/p&gt;
&lt;p&gt;Let's now build a rule to detect that behavior.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;- rule: Detect privilege escalation in /tmp
desc: Detect privilege escalationof binaries executed in /tmp
condition: &amp;gt;
evt.type = setresuid and proc.exepath startswith /tmp/
output: &amp;#34;The binary %proc.name has tried to escalate privileges: %evt.args&amp;#34;
priority: debug
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;When we execute our binary once more, the triggered rule should produce an output similar to the following:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;Debug The binary malicious has tried to escalate privileges: ruid=0(root) euid=0(root) suid=0(root)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This rule may appear overly simplistic, potentially leading to numerous false positives or negatives. However, it illustrates how gaining a comprehensive understanding of binaries, their behaviors, and the associated threats can significantly improve the quality of our rule writing. By delving deeper into these aspects, we can craft more effective and accurate rules to enhance the detection capabilities of Falco.&lt;/p&gt;</description></item><item><title>Docs: Escaping Special Characters</title><link>https://v0-43--falcosecurity.netlify.app/docs/concepts/rules/special-characters/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-43--falcosecurity.netlify.app/docs/concepts/rules/special-characters/</guid><description>
&lt;p&gt;In some cases, rules may need to contain special characters like &lt;code&gt;(&lt;/code&gt;, spaces, etc. For example, you may need to look for a &lt;code&gt;proc.name&lt;/code&gt; of &lt;code&gt;(systemd)&lt;/code&gt;, including the surrounding parentheses.&lt;/p&gt;
&lt;p&gt;You can use &lt;code&gt;&amp;quot;&lt;/code&gt; to capture these special characters. Here's an example:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;rule&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;Any Open Activity by Systemd&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;desc&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;Detects all open events by systemd.&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;evt.type=open and proc.name=&amp;#34;(systemd)&amp;#34; or proc.name=systemd&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;output&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;&amp;#34;File opened by systemd | user=%user.name command=%proc.cmdline file=%fd.name&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;priority&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;WARNING&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When including items in &lt;a class='glossary-tooltip' title='Lists are collections of items that can be included in rules, macros, or other lists.' data-toggle='tooltip' data-placement='top' href='https://v0-43--falcosecurity.netlify.app/docs/rules/basic-elements/#lists' target='_blank' aria-label='lists'&gt;lists&lt;/a&gt;, ensure that the double quotes are not interpreted from your YAML file by surrounding the quoted string with single quotes. Here's an example:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;list&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;systemd_procs&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;items&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;[systemd, &amp;#39;&amp;#34;(systemd)&amp;#34;&amp;#39;]&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;rule&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;Any Open Activity by Systemd&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;desc&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;Detects all open events by systemd.&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;evt.type=open and proc.name in (systemd_procs)&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;output&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#b44"&gt;&amp;#34;File opened by systemd | user=%user.name command=%proc.cmdline file=%fd.name&amp;#34;&lt;/span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;priority&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;WARNING&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description></item><item><title>Docs: Style Guide of Falco Rules</title><link>https://v0-43--falcosecurity.netlify.app/docs/concepts/rules/style-guide/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-43--falcosecurity.netlify.app/docs/concepts/rules/style-guide/</guid><description>
&lt;div class="alert alert-warning" role="alert"&gt;
This style guide only applies to Falco 0.36 and above.
&lt;/div&gt;
&lt;h2 id="style-guide"&gt;Style Guide&lt;/h2&gt;
&lt;p&gt;Before diving in, read the sections on Falco rules &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/rules/basic-elements/"&gt;Basics&lt;/a&gt; and &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/rules/conditions/"&gt;Condition Syntax&lt;/a&gt;. Also, check out existing &lt;a href="https://github.com/falcosecurity/rules/blob/main/rules/falco_rules.yaml"&gt;Falco Rules&lt;/a&gt; for best practices in writing rules.&lt;/p&gt;
&lt;p&gt;In addition, the resources under &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/reference/rules/"&gt;references/rules&lt;/a&gt; provide complementary information. We highly recommend regularly revisiting each guide to stay up-to-date with the latest advancements of Falco.&lt;/p&gt;
&lt;p&gt;A rule declaration is represented as a YAML object consisting of multiple keys. The suggested order for these keys is as follows:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;rule&lt;/span&gt;:&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;desc&lt;/span&gt;:&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;output&lt;/span&gt;:&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;priority&lt;/span&gt;:&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;tags&lt;/span&gt;:&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;... other keys if applicable in no particular order&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="naming"&gt;Naming&lt;/h3&gt;
&lt;p&gt;Choose a concise title that summarizes the essence of the rule's purpose. Rule's name must start with an upper-case letter. For &lt;code&gt;macro&lt;/code&gt; and &lt;code&gt;list&lt;/code&gt;, use lowercase_separated_by_underscores, for example, &lt;code&gt;kernel_module_load&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id="description"&gt;Description&lt;/h3&gt;
&lt;p&gt;Aligning with Falco's &lt;a href="https://github.com/falcosecurity/rules/blob/main/CONTRIBUTING.md#rules-maturity-framework"&gt;Rules Maturity Framework&lt;/a&gt;, it is encouraged to not just include a longer description of what the rule detects but also to give advice on how to tune this rule and reduce possible noise. If applicable, elaborate on how to correlate the rule with other rules or data sources for incident response. However, keep them concise. The description should end with a period.&lt;/p&gt;
&lt;h3 id="condition-syntax"&gt;Condition Syntax&lt;/h3&gt;
&lt;p&gt;These recommendations prioritize performance impact while maintaining a consistent style for better understanding and easier customization. This approach ensures more manageable maintenance of the rules in the long run.&lt;/p&gt;
&lt;p&gt;We explain the high-level principles using example rules or snippets.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Each upstream Falco rule must include an &lt;code&gt;evt.type&lt;/code&gt; filter; otherwise, you will get a warning.&lt;/li&gt;
&lt;/ul&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;Rule no_evttype: warning (no-evttype):
proc.name=foo
did not contain any evt.type restriction, meaning that it will run for all event types.
This has a significant performance penalty. Consider adding an evt.type restriction if possible.
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;Prioritize the &lt;code&gt;evt.type&lt;/code&gt; filter first; otherwise, you will get a warning. Falco buckets filters per &lt;code&gt;evt.type&lt;/code&gt; for efficient rules matching through applying the rule's Abstract Syntax Tree (AST) to relevant event types only. A nice side effect is better readability as well.&lt;/li&gt;
&lt;/ul&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;Rule evttype_not_equals: warning (trailing-evttype):
evt.type!=execve
does not have all evt.type restrictions at the beginning of the condition,
or uses a negative match (i.e. &amp;#34;not&amp;#34;/&amp;#34;!=&amp;#34;) for some evt.type restriction.
This has a performance penalty, as the rule can not be limited to specific event types.
Consider moving all evt.type restrictions to the beginning of the rule and/or
replacing negative matches with positive matches if possible.
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;To maintain performance, avoid mixing unrelated event types in one rule. Typically, only variants should be mixed together, for example: &lt;code&gt;evt.type in (open, openat, openat2)&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The best practice and requirement for upstream rules are to only define positive &lt;code&gt;evt.type&lt;/code&gt; expressions. Using &lt;code&gt;evt.type!=open&lt;/code&gt;, for example, would monitor each of the &lt;a href="https://falcosecurity.github.io/libs/report/"&gt;Supported Syscalls&lt;/a&gt;, resulting in a significant performance penalty. For more information, read the &lt;a href="https://v0-43--falcosecurity.netlify.app/blog/adaptive-syscalls-selection/"&gt;Adaptive Syscalls Selection in Falco&lt;/a&gt; blog post.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;After the &lt;code&gt;evt.type&lt;/code&gt; filter, place your positive expression filters to efficiently eliminate the most events step by step. An exception to this rule is the &lt;code&gt;container&lt;/code&gt; macro, which can quickly eliminate many events. Therefore, the guiding principle of &amp;quot;divide and conquer&amp;quot; commonly used in database query recommendations, also applies to Falco's filter statements.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;macro&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;open_write&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;(evt.type in (open,openat,openat2) and evt.is_open_write=true and fd.typechar=`f` and fd.num&amp;gt;=0)&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;...&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;macro&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;container&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;(container.id != host)&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;...&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;rule&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;Detect release_agent File Container Escapes&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;...&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;open_write and container and fd.name endswith release_agent and (user.uid=0 or thread.cap_effective contains CAP_DAC_OVERRIDE) and thread.cap_effective contains CAP_SYS_ADMIN&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;...&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;Effective Falco rules should now already be in a good state. Additionally, use exclusionary statements mostly to filter out common anti-patterns and noise. Often, these statements are based on profiling. You will notice that many upstream rules provide an empty template macro for this purpose, which you can customize.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;macro&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;spawned_process&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;(evt.type in (execve, execveat))&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;...&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;list&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;known_drop_and_execute_containers&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;items&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;[]&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;rule&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;Drop and execute new binary in container&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;...&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;spawned_process&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;and container&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;and proc.is_exe_upper_layer=true &lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;and not container.image.repository in (known_drop_and_execute_containers)&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;...&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;Use existing macros for reusability purposes, if applicable (e.g. &lt;code&gt;spawned_process&lt;/code&gt; macro).&lt;/li&gt;
&lt;li&gt;Exercise caution when dealing with complicated nested statements in Falco rules, and ensure you use parentheses consistently to achieve the desired correct behavior. Remember, using too many parentheses does not cause any harm.&lt;/li&gt;
&lt;li&gt;To avoid grammatical syntax errors or sub-optimal performance, refrain from combining &lt;code&gt;or&lt;/code&gt; statements with negation. Instead, use &lt;code&gt;or&lt;/code&gt; statements only for positive filters.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;macro&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;minerpool_https&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;(fd.sport=&amp;#34;443&amp;#34; and fd.sip.name in (https_miner_domains))&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;...&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;... and ((minerpool_http) or (minerpool_https) or (minerpool_other))&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;Furthermore, it is preferred to use &lt;code&gt;and not&lt;/code&gt; to consistently negate a positive sub-expression.&lt;/li&gt;
&lt;li&gt;Avoid double-negation.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;... and not fd.snet in (rfc_1918_addresses)&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;For operations involving string comparison, &lt;code&gt;startswith&lt;/code&gt; or &lt;code&gt;endswith&lt;/code&gt; should be preferred over &lt;code&gt;contains&lt;/code&gt; whenever possible, as they are more efficient.&lt;/li&gt;
&lt;li&gt;Whenever possible, try to avoid making a rule expression too long.&lt;/li&gt;
&lt;li&gt;Upstream rules shall &lt;em&gt;not&lt;/em&gt; contain any &lt;code&gt;exceptions&lt;/code&gt; to ensure simpler rules and facilitate better adoption.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="alert alert-warning" role="alert"&gt;
High-volume syscalls can increase CPU usage and cause kernel side event drops in production systems. When deploying Falco, consider trade-offs and experiments, particularly with I/O related syscalls, as it depends on your unique environment. The upstream rules do not include rules enabled by default regarding I/O syscalls.
&lt;/div&gt;
&lt;h3 id="output-fields"&gt;Output Fields&lt;/h3&gt;
&lt;p&gt;Each rule must include output fields.&lt;/p&gt;
&lt;p&gt;For the output fields, expect that each Falco release typically exposes new &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/reference/rules/supported-fields/"&gt;Supported Output Fields&lt;/a&gt; that can help you write more expressive rules and/or add more context to a rule for incident response.&lt;/p&gt;
&lt;p&gt;Building upon the guide around writing rules with respect to &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/rules/basic-elements/#output"&gt;Falco Outputs&lt;/a&gt;, when considering upstreaming your rule, core output fields relevant for this rule must be included. At the same time, we try to keep them to a minimum, and adopters can add more output fields as they see fit.&lt;/p&gt;
&lt;p&gt;For each rule include the critical fields listed below related to process and user information, as well as the actual event type. For example, the &lt;code&gt;tty&lt;/code&gt; field (terminal) can help determine if the process ran in an interactive shell. Additionally, examining the exepath alongside the process name provides insights into whether the binary might be located in more suspicious folders like &lt;code&gt;tmp&lt;/code&gt;. Understanding the direct parent process is vital for basic process lineage analysis.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;evt_type=%evt.type user=%user.name user_uid=%user.uid user_loginuid=%user.loginuid process=%proc.name proc_exepath=%proc.exepath parent=%proc.pname command=%proc.cmdline terminal=%proc.tty&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;For rules involving only &lt;code&gt;spawned_process&lt;/code&gt;, please also include &lt;code&gt;%evt.arg.flags&lt;/code&gt; in the output fields. If a rule involves multiple syscalls beyond &lt;code&gt;spawned_process&lt;/code&gt;, do not include &lt;code&gt;%evt.arg.flags&lt;/code&gt;.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;exe_flags=%evt.arg.flags&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;General tip: Refer to the &lt;a href="https://github.com/falcosecurity/libs/blob/master/driver/event_table.c"&gt;Event Table Definitions&lt;/a&gt; for the &lt;code&gt;evt.arg.*&lt;/code&gt; fields for each supported syscall, for which we extract and parse the arguments.&lt;/p&gt;
&lt;p&gt;For network-related rules include:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;connection=%fd.name lport=%fd.lport rport=%fd.rport fd_type=%fd.type fd_proto=fd.l4proto&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;For file-related rules include:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;file=%fd.name&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;... and additional specialized fields from the raw args if applicable, such as &lt;code&gt;newpath=%evt.arg.newpath&lt;/code&gt; for non-file descriptor events like symlinking or renaming. Alternatively, you can explore more recent &lt;code&gt;fs.path.*&lt;/code&gt; variants to simplify the consistent logging of file or directory paths, even for non-file descriptor events. Previously, tapping into the raw args as described above was required for such events.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Supported Output Fields &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/reference/rules/supported-fields/#field-class-container"&gt;&lt;code&gt;container.*&lt;/code&gt;&lt;/a&gt; retrieved from the container runtime socket&lt;/li&gt;
&lt;li&gt;Supported Output Fields &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/reference/rules/supported-fields/#field-class-k8s"&gt;&lt;code&gt;k8s.*&lt;/code&gt;&lt;/a&gt; also retrieved from the container runtime socket&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;All of these fields are incredibly crucial for effective incident response and play a vital role in determining the workload owner.&lt;/p&gt;
&lt;p&gt;For specialized use cases, generic fields such as &lt;code&gt;%container.ip&lt;/code&gt; or &lt;code&gt;%container.cni.json&lt;/code&gt; can be further helpful for incident response, especially concerning non-network syscall related alerts in Kubernetes. These fields can be correlated, for example, with network proxy logs. Additionally, for certain rules, it can be important to traverse the parent process lineage for up to 7 levels. In some cases, instead of relying solely on the process name, it might be more effective to traverse the exepath, for example, &lt;code&gt;proc.aexepath[2]&lt;/code&gt;. The process name and executable of the session leader (&lt;code&gt;%proc.sname&lt;/code&gt;, &lt;code&gt;%proc.sid.*&lt;/code&gt;) and process group leader (&lt;code&gt;%proc.vpgid.*&lt;/code&gt;), or other specific process fields such as &lt;code&gt;proc.is_exe_upper_layer&lt;/code&gt;, &lt;code&gt;proc.is_exe_from_memfd&lt;/code&gt; or &lt;code&gt;proc.is_vpgid_leader&lt;/code&gt;, can also hold considerable generic value for each rule. However, it is up to you as an adopter to decide.&lt;/p&gt;
&lt;p&gt;We kindly ask you to add fields related to IDs later in your customization process to keep the upstream Falco output fields to a minimum. This is because there are many ID-related fields, such as &lt;code&gt;%proc.pid %proc.ppid %proc.vpid %proc.pvpid %proc.sid %proc.vpgid ...&lt;/code&gt;. You can explore the &lt;code&gt;-p&lt;/code&gt; option for this purpose and add these fields to each rules' output fields.&lt;/p&gt;
&lt;p&gt;Falco also supports outputting the output as a resolved string. Therefore, use a sentence style, first concisely re-iterating the rule's purpose, and then including the output field in parentheses after the &lt;code&gt;=&lt;/code&gt; character, with its meaning explained before the &lt;code&gt;=&lt;/code&gt; character, adhering to the snake_case variable naming convention.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;output&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#b44"&gt;&amp;#34;Read monitored file via directory traversal | file=%fd.name fileraw=%fd.nameraw gparent=%proc.aname[2] ggparent=%proc.aname[3] gggparent=%proc.aname[4] user=%user.name user_uid=%user.uid user_loginuid=%user.loginuid process=%proc.name proc_exepath=%proc.exepath parent=%proc.pname command=%proc.cmdline terminal=%proc.tty&amp;#34;&lt;/span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="priority"&gt;Priority&lt;/h3&gt;
&lt;p&gt;Please refer to the relevant &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/reference/rules/rule-fields/"&gt;reference/rules&lt;/a&gt; section and the &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/rules/basic-elements/#priority"&gt;Basic Rules Guide&lt;/a&gt; for more information.&lt;/p&gt;
&lt;p&gt;When considering upstreaming the rule to The Falco Project, the &lt;code&gt;priority&lt;/code&gt; level shall not be set to &lt;code&gt;DEBUG&lt;/code&gt; and instead shall be at a minimum of &lt;code&gt;INFO&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id="tags"&gt;Tags&lt;/h3&gt;
&lt;p&gt;Tags include various categories to convey relevant information about the rule.&lt;/p&gt;
&lt;p&gt;According to the Falco &lt;a href="https://github.com/falcosecurity/rules/blob/main/CONTRIBUTING.md#rules-maturity-framework"&gt;Rules Maturity Framework&lt;/a&gt;, the first tag in the tags list must always indicate the maturity of the rule. The &lt;a href="https://github.com/falcosecurity/rules"&gt;Rules Repo&lt;/a&gt; contains concrete guidance on how to categorize a rule when considering upstreaming the rule to The Falco Project.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;maturity_stable&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;maturity_incubating&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;maturity_sandbox&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;maturity_deprecated&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Next, the tags must indicate for what workloads this rule is relevant. Add &lt;code&gt;host&lt;/code&gt; and &lt;code&gt;container&lt;/code&gt; if the rule works for any event. You can include additional tags to specify the rule's type, such as &lt;code&gt;process&lt;/code&gt;, &lt;code&gt;network&lt;/code&gt;, &lt;code&gt;k8s&lt;/code&gt;, &lt;code&gt;aws&lt;/code&gt;, etc.&lt;/p&gt;
&lt;p&gt;When considering upstreaming your rule, we expect the &lt;a href="https://attack.mitre.org/techniques/enterprise/"&gt;Mitre Attack&lt;/a&gt; phase followed by the best Tactic or Technique, whichever is the best fit. This information is used to create the &lt;a href="https://github.com/falcosecurity/rules/blob/main/rules_inventory/rules_overview.md"&gt;Rules Overview Document&lt;/a&gt; of Falco's predefined rules and also help the Falco adoption process.&lt;/p&gt;
&lt;p&gt;Lastly, if the rule is relevant for a compliance use case, please add the corresponding &lt;code&gt;PCI_DSS_*&lt;/code&gt; or &lt;code&gt;NIST_*&lt;/code&gt; tag, referring to the &lt;a href="https://v0-43--falcosecurity.netlify.app/blog/falco-nist-controls/"&gt;Validating NIST Requirements with Falco&lt;/a&gt; and &lt;a href="https://v0-43--falcosecurity.netlify.app/blog/falco-pci-controls/"&gt;PCI/DSS Controls with Falco&lt;/a&gt; blog posts and rules contributing criteria outlined in the &lt;a href="https://github.com/falcosecurity/rules"&gt;Rules Repo&lt;/a&gt;.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;tags&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;[maturity_incubating, host, container, filesystem, mitre_defense_evasion, NIST_800-53_AU-10]&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="additional-information"&gt;Additional Information&lt;/h2&gt;
&lt;h3 id="rule-types-and-robustness"&gt;Rule Types and Robustness&lt;/h3&gt;
&lt;p&gt;Some rules are more specific signatures, while others focus on behavior-based detection. When testing rules, it's essential to consider not only if the rule catches the intended attack or how much noise it could generate but also its robustness. Robustness refers to how easily an attacker can bypass the detection by making minor changes to their payload or approach. Exploring different approaches to catch an attack can help identify the most effective detection method.&lt;/p&gt;
&lt;h3 id="rules-loading"&gt;Rules Loading&lt;/h3&gt;
&lt;p&gt;Refer to the up-to-date description in the &lt;a href="https://github.com/falcosecurity/falco/blob/master/falco.yaml"&gt;falco.yaml&lt;/a&gt; file for &lt;code&gt;rules_files&lt;/code&gt; to understand in which order rules are loaded. Keep in mind that Falco by default applies rules per event type on a &amp;quot;first match wins&amp;quot; basis. Starting from Falco Release 0.36.0, you have the option to modify the configuration to &lt;code&gt;rule_matching: all&lt;/code&gt;. This change ensures that rules sharing the same event type cannot override each other, preventing inconsistent logging. Be aware, though, that this modification may lead to increased CPU usage.&lt;/p&gt;
&lt;h3 id="contributing-your-falco-rules"&gt;Contributing Your Falco Rules&lt;/h3&gt;
&lt;p&gt;Refer to the &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/contribute/"&gt;Contributing&lt;/a&gt; page and the &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/contribute/share-rules/"&gt;How to Share Your Falco Rules&lt;/a&gt; guide.&lt;/p&gt;</description></item><item><title>Docs: Accessing File System Paths in Falco Rules</title><link>https://v0-43--falcosecurity.netlify.app/docs/concepts/rules/fspath/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-43--falcosecurity.netlify.app/docs/concepts/rules/fspath/</guid><description>
&lt;h2 id="introduction"&gt;Introduction&lt;/h2&gt;
&lt;p&gt;This section explains how the fields &lt;code&gt;fs.path.*&lt;/code&gt; work and when they can be used.&lt;/p&gt;
&lt;h3 id="motivation"&gt;Motivation&lt;/h3&gt;
&lt;p&gt;A variety of different syscalls take file system paths as arguments. However, there is little consistency in the fields that can access those file system paths. Depending on the syscall, the file system path might be available in &lt;code&gt;evt.rawarg.path&lt;/code&gt;, &lt;code&gt;evt.rawarg.pathname&lt;/code&gt;, &lt;code&gt;evt.rawarg.name&lt;/code&gt;, &lt;code&gt;fd.name&lt;/code&gt;, etc. This makes writing simple Falco rules that act on file system paths challenging because the field must depend on the syscall.&lt;/p&gt;
&lt;p&gt;To help address this inconsistency, in Falco version 0.36, we added a new set of fields that normalize file system paths across various syscalls.&lt;/p&gt;
&lt;h4 id="what-counts-as-a-file-system-path"&gt;What Counts As A File System Path?&lt;/h4&gt;
&lt;p&gt;Lots of existing fields also refer to file system paths. For example, &lt;code&gt;proc.exepath&lt;/code&gt; contains the file system path for an executable, and there are related fields &lt;code&gt;proc.pexepath&lt;/code&gt;/&lt;code&gt;proc.aexepath&lt;/code&gt;. &lt;code&gt;container.mount.*&lt;/code&gt; fields all contain the file system paths for file systems mounted into a container.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;fs.path.*&lt;/code&gt; fields are &lt;em&gt;only&lt;/em&gt; populated for syscalls generally related to reading, writing, or modifying some file system object and have a file system path as an argument. The goal is to have a single set of fields that can always be relied on to refer to those paths, compared to checking the widely varying per-event fields.&lt;/p&gt;
&lt;h3 id="fs-path-fields"&gt;&lt;code&gt;fs.path.*&lt;/code&gt; fields&lt;/h3&gt;
&lt;p&gt;The following fields are available for any syscall that operates on a file system path:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;fs.path.name&lt;/li&gt;
&lt;li&gt;fs.path.nameraw&lt;/li&gt;
&lt;li&gt;fs.path.source&lt;/li&gt;
&lt;li&gt;fs.path.sourceraw&lt;/li&gt;
&lt;li&gt;fs.path.target&lt;/li&gt;
&lt;li&gt;fs.path.targetraw&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;code&gt;fs.path.name&lt;/code&gt; is for file operations that work on a path like open, unlink, rmdir, etc. For other file operations that have a source and target, like cp, symlink, link, mv, etc., there are fields &lt;code&gt;fs.path.source&lt;/code&gt; and &lt;code&gt;fs.path.target&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;These convert relative paths to absolute paths when needed, using the thread's current working directory (cwd).&lt;/p&gt;
&lt;p&gt;&lt;code&gt;fs.path.nameraw/fs.path.sourceraw/fs.path.targetraw&lt;/code&gt; are like the above but do &lt;em&gt;not&lt;/em&gt; convert relative paths to absolute paths. They always contain the original path, which may or may not be relative.&lt;/p&gt;
&lt;p&gt;The fields only work for exit events and only return a value if the syscall succeeds.&lt;/p&gt;
&lt;p&gt;The below tables show:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;the specific syscalls that are are supported&lt;/li&gt;
&lt;li&gt;the specific falco event identifiers are supported. The reason there are multiple event identifiers for the same syscall (e.g. MKDIR vs MKDIR_2) is that libs used to define new events every time we added/modified arguments to the event. Older applications using the older version of libs will use the older event identifier for the syscall name, while newer applications will use the newer event identifier.&lt;/li&gt;
&lt;li&gt;the specific event fields that are mapped to &lt;code&gt;fs.path.*&lt;/code&gt; fields&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="single-argument-file-system-syscalls"&gt;Single Argument File System Syscalls&lt;/h4&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Syscall&lt;/th&gt;
&lt;th&gt;&lt;code&gt;fs.path.name&lt;/code&gt; field&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;mkdir&lt;/td&gt;
&lt;td&gt;&lt;code&gt;evt.rawarg.path&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;mkdirat&lt;/td&gt;
&lt;td&gt;&lt;code&gt;evt.rawarg.path&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;rmdir&lt;/td&gt;
&lt;td&gt;&lt;code&gt;evt.rawarg.path&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;unlink&lt;/td&gt;
&lt;td&gt;&lt;code&gt;evt.rawarg.path&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;unlinkat&lt;/td&gt;
&lt;td&gt;&lt;code&gt;evt.rawarg.name&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;open&lt;/td&gt;
&lt;td&gt;&lt;code&gt;evt.rawarg.name&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;openat&lt;/td&gt;
&lt;td&gt;&lt;code&gt;evt.rawarg.name&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;openat2&lt;/td&gt;
&lt;td&gt;&lt;code&gt;evt.rawarg.name&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;fchmod&lt;/td&gt;
&lt;td&gt;&lt;code&gt;fd.name&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;fchmodat&lt;/td&gt;
&lt;td&gt;&lt;code&gt;evt.rawarg.filename&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;chmod&lt;/td&gt;
&lt;td&gt;&lt;code&gt;evt.rawarg.filename&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;chown&lt;/td&gt;
&lt;td&gt;&lt;code&gt;evt.rawarg.path&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;lchown&lt;/td&gt;
&lt;td&gt;&lt;code&gt;evt.rawarg.path&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;fchown&lt;/td&gt;
&lt;td&gt;&lt;code&gt;fd.name&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;fchownat&lt;/td&gt;
&lt;td&gt;&lt;code&gt;evt.rawarg.pathname&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;quotactl&lt;/td&gt;
&lt;td&gt;&lt;code&gt;evt.rawarg.special&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;umount&lt;/td&gt;
&lt;td&gt;&lt;code&gt;evt.rawarg.name&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;umount2&lt;/td&gt;
&lt;td&gt;&lt;code&gt;evt.rawarg.name&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h4 id="source-target-file-system-syscalls"&gt;Source/Target File System Syscalls&lt;/h4&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Syscall&lt;/th&gt;
&lt;th&gt;&lt;code&gt;fs.path.source&lt;/code&gt; field&lt;/th&gt;
&lt;th&gt;&lt;code&gt;fs.path.target&lt;/code&gt; field&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;rename&lt;/td&gt;
&lt;td&gt;&lt;code&gt;evt.rawarg.oldpath&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;evt.arg.newpath&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;renameat&lt;/td&gt;
&lt;td&gt;&lt;code&gt;evt.rawarg.oldpath&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;evt.arg.newpath&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;renameat2&lt;/td&gt;
&lt;td&gt;&lt;code&gt;evt.rawarg.oldpath&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;evt.arg.newpath&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;link&lt;/td&gt;
&lt;td&gt;&lt;code&gt;evt.arg.newpath&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;evt.rawarg.oldpath&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;linkat&lt;/td&gt;
&lt;td&gt;&lt;code&gt;evt.arg.newpath&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;evt.rawarg.oldpath&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;symlink&lt;/td&gt;
&lt;td&gt;&lt;code&gt;evt.arg.linkpath&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;evt.rawarg.target&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;symlinkat&lt;/td&gt;
&lt;td&gt;&lt;code&gt;evt.arg.linkpath&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;evt.rawarg.target&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;mount&lt;/td&gt;
&lt;td&gt;&lt;code&gt;evt.rawarg.dev&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;evt.rawarg.dir&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3 id="example-rule-using-fs-path-fields"&gt;Example Rule Using &lt;code&gt;fs.path.*&lt;/code&gt; Fields&lt;/h3&gt;
&lt;p&gt;Here is an example rule that allows monitoring a wide variety of different file related operations below a set of specifed root directories:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;- list: file_operation_paths
items: [/tmp/example-dir]
- macro: file_operation
condition: (mkdir or rename or remove or open_write or create_symlink or evt.type in (link, linkat))
- rule: Any File Related Operation on Path
desc: Detect any file operation on a single path
condition: (fs.path.name pmatch (file_operation_paths) or fs.path.source pmatch (file_operation_paths) or fs.path.target pmatch (file_operation_paths)) and file_operation
output: &amp;gt;
Some File Related Operation on Path (evt.type=%evt.type path=%fs.path.name source=%fs.path.source
target=%fs.path.target %user.name=%user.name proc.cmdline=%proc.cmdline proc.pcmdline=%proc.pcmdline
container.id=%container.id container.name=%container.name image=%container.image.repository)
priority: DEBUG
source: syscall
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>Docs: Adoption of Falco Rules in Production</title><link>https://v0-43--falcosecurity.netlify.app/docs/concepts/rules/adoption-rules/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-43--falcosecurity.netlify.app/docs/concepts/rules/adoption-rules/</guid><description>
&lt;p&gt;You have learned how to write Falco rules with best practices in mind and are now ready to deploy Falco to production and operationalize the rules. You might be wondering, &amp;quot;How do I go about this? How can I not only get the most value out of Falco but also maintain the rules effectively across varying infrastructure setups?&amp;quot;&lt;/p&gt;
&lt;p&gt;The Falco Project has introduced the &lt;a href="https://github.com/falcosecurity/rules/blob/main/CONTRIBUTING.md#rules-maturity-framework"&gt;Rules Maturity Framework&lt;/a&gt; to precisely assist you in this process. The framework facilitates the adoption of the stable default rules more effectively while also providing guidance for custom rules. This framework ensures a smooth transition for adopters, whether they use rules generically or for specific use cases. A smooth adoption process is defined by making it easy for adopters to understand each rule and also gain an understanding of not just what the rule is doing, but also how beneficial it can be under various circumstances. As a result, adopters should have a clear idea of which rules can likely be adopted as-is versus which rules may require significant engineering efforts to evaluate and adopt.&lt;/p&gt;
&lt;p&gt;To begin, allocate some time to assess the top cyber threats that are specific to your organization and require monitoring in place. One way to go about this is by exploring the already mentioned default rules tagged with the maturity level &amp;quot;stable&amp;quot; first. Explore the source &lt;a href="https://github.com/falcosecurity/rules/blob/main/rules/falco_rules.yaml"&gt;falco_rules.yaml&lt;/a&gt; file and/or the latest &lt;a href="https://falcosecurity.github.io/rules/"&gt;rules overview&lt;/a&gt; document. These rules are designed to detect more universal system-level cyber threats, aligned with the &lt;a href="https://attack.mitre.org/"&gt;Mitre Attack&lt;/a&gt; framework. Examples include remote code execution, generic malicious executions, container escapes, network pivots, privilege escalations, or credentials lifting. Some of these rules are also valuable for compliance-related monitoring.&lt;/p&gt;
&lt;p&gt;Depending on your familiarity with security monitoring and detections, a little ramping up may be necessary to assess how useful a particular rule is in your environment. This includes determining the level of customization needed for a rule, for example, tuning out noise to reduce False Positives, and on the flip side, ensuring you are resilient against False Negatives. Additionally, it involves determining the appropriate output fields and the deployment configurations you need. It may also include finding the most optimal ways to maintain different deployment configurations across various infrastructures where you intend to deploy Falco. Existing descriptions of Falco rules, the &lt;a href="https://falco.org/docs/"&gt;official guides&lt;/a&gt; you've read, as well as the many &lt;a href="https://falco.org/blog/"&gt;blog&lt;/a&gt; posts hosted by The Falco Project, can provide you with further assistance.&lt;/p&gt;
&lt;h2 id="high-level-phases"&gt;High-level Phases&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Newcomers to Falco will be encouraged to start by configuring their setup with introductory rules labeled as &amp;quot;Falco's default rules&amp;quot; (&lt;code&gt;maturity_stable&lt;/code&gt;). These rules, which are currently based on syscall and container events, live in the established &lt;a href="https://github.com/falcosecurity/rules/blob/main/rules/falco_rules.yaml"&gt;falco_rules.yaml&lt;/a&gt; file.&lt;/li&gt;
&lt;li&gt;As users become more familiar with Falco and better understand their unique environments, they can gradually fine-tune the default rules to meet their specific requirements. Tuning rules goes hand in hand with assessing the performance overhead and adjusting Falco's &lt;a href="https://github.com/falcosecurity/falco/blob/master/falco.yaml"&gt;configuration&lt;/a&gt; accordingly. This consideration is important to keep in mind as there are usually limitations to the budget allocated for security monitoring.&lt;/li&gt;
&lt;li&gt;Once adopters have integrated the stable default rules with low false positives and acceptable performance consistently, they can add a next set of rules. This set may include rules with &lt;code&gt;maturity_incubating&lt;/code&gt; or &lt;code&gt;maturity_sandbox&lt;/code&gt;, offering more specific detections and/or broader monitoring, depending on the rule. The level of engineering effort needed to effectively use these rules at this stage is likely to increase.&lt;/li&gt;
&lt;li&gt;Alongside each of these phases, creating custom rules early on often makes a lot of sense. For instance, enabling monitoring around sensitive files that are unique to your environment and ecosystem would be an appropriate example. The same approach could be applied to set up monitoring for crown jewel services with detailed knowledge of their usual execution patterns, and then set up alerts for any deviations.&lt;/li&gt;
&lt;li&gt;Lastly, up until now, we focused on syscall and container event-based default rules. However, Falco also features a rich &lt;a href="https://github.com/falcosecurity/plugins"&gt;plugins&lt;/a&gt; system alongside plugin rules that you can explore to see if they are a fit for your ecosystem.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;em&gt;Disclaimer&lt;/em&gt;: The maturity level of the rules, however, does not directly reflect their potential for generating noise in the adopters' environment. This is due to the unique and constantly changing nature of each environment, especially in cloud environments, making it challenging to accurately predict the impact of rules.&lt;/p&gt;
&lt;h2 id="effective-end-to-end-operationalization"&gt;Effective End-to-End Operationalization&lt;/h2&gt;
&lt;p&gt;Effective end-to-end operationalization is ideally accomplished through 24/7 detection triage by security analysts and pre-defined runbooks in the incident response workflows. This aspect is unique to your environment, and you can explore how Falco alerts can be augmented with additional data enrichments. Finding the right scope of monitoring can be achieved through experimentation. We also encourage you to find ways to perform continuous end-to-end testing or simulations to ensure the entire data pipeline is functional. This includes validating that Falco is logging the events, ensuring subsequent log transport to your end destination (which can be a data lake and compute platform or a SIEM) is working, and having effective triage and response mechanisms in place.&lt;/p&gt;
&lt;h2 id="continuous-learning-and-maintenance"&gt;Continuous Learning and Maintenance&lt;/h2&gt;
&lt;p&gt;Falco continuously evolves and improves over time. This also means that for each Falco release, allocating time to explore the newest features can be beneficial. Furthermore, infrastructure, cloud environments, and your organization's applications keep evolving as well. Therefore, Falco rules require constant tuning and maintenance to ensure the desired monitoring quality.&lt;/p&gt;</description></item><item><title>Docs: Resolving Domain Names in Falco Rules</title><link>https://v0-43--falcosecurity.netlify.app/docs/concepts/rules/fd-sip-name/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-43--falcosecurity.netlify.app/docs/concepts/rules/fd-sip-name/</guid><description>
&lt;h2 id="introduction"&gt;Introduction&lt;/h2&gt;
&lt;p&gt;This section explains how to use the fd.sip.name field and the related fd.{clr}ip.name fields in the default falco ruleset. For example:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;list&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;https_miner_domains&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;items&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;[&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#b44"&gt;&amp;#34;ca.minexmr.com&amp;#34;&lt;/span&gt;,&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#b44"&gt;&amp;#34;cn.stratum.slushpool.com&amp;#34;&lt;/span&gt;,&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#b44"&gt;&amp;#34;de.minexmr.com&amp;#34;&lt;/span&gt;,&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#b44"&gt;&amp;#34;fr.minexmr.com&amp;#34;&lt;/span&gt;,&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#b44"&gt;&amp;#34;mine.moneropool.com&amp;#34;&lt;/span&gt;,&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#b44"&gt;&amp;#34;mine.xmrpool.net&amp;#34;&lt;/span&gt;,&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#b44"&gt;&amp;#34;pool.minexmr.com&amp;#34;&lt;/span&gt;,&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#b44"&gt;&amp;#34;sg.minexmr.com&amp;#34;&lt;/span&gt;,&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#b44"&gt;&amp;#34;stratum-eth.antpool.com&amp;#34;&lt;/span&gt;,&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#b44"&gt;&amp;#34;stratum-ltc.antpool.com&amp;#34;&lt;/span&gt;,&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#b44"&gt;&amp;#34;stratum-zec.antpool.com&amp;#34;&lt;/span&gt;,&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#b44"&gt;&amp;#34;stratum.antpool.com&amp;#34;&lt;/span&gt;,&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#b44"&gt;&amp;#34;xmr.crypto-pool.fr&amp;#34;&lt;/span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;]&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#080;font-style:italic"&gt;## Add rule based on crypto mining IOCs&lt;/span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;macro&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;minerpool_https&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;(fd.sport=&amp;#34;443&amp;#34; and fd.sip.name in (https_miner_domains))&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The fd.sip.name field and the related fd.{clr}ip.name fields behave differently than the other fields in the falco ruleset. See the following to learn more.&lt;/p&gt;
&lt;h2 id="resolve-domains-first-match-ips-later"&gt;Resolve Domains First, Match IPs Later&lt;/h2&gt;
&lt;p&gt;When a rule contains a field &lt;code&gt;fd.*ip.name&lt;/code&gt;, the domain names on the right hand side of the comparison (The &lt;code&gt;foo.com&lt;/code&gt; in &lt;code&gt;=foo.com or in (foo.com, bar.com)&lt;/code&gt;) are saved internally within the falco engine. The engine looks up the A records for those domains immediately and saves the set of returned IPs internally. This behavior prevents stalling the system call event loop to perform a blocking time-consuming DNS lookup at the time of the system call event.&lt;/p&gt;
&lt;p&gt;Later, when a system call event is matched against the condition in the filter, the &lt;em&gt;actual&lt;/em&gt; IP address associated with the system call event (the server IP for &lt;code&gt;fd.sip.name&lt;/code&gt;, the client IP for &lt;code&gt;fd.cip.name&lt;/code&gt;, etc) is compared against the previously looked up set of IPs for the domain name. The actual IP is compared against the set of resolved IPs, based on the comparison operator (=/!=/in, perhaps with a preceding not, etc) and results in a true/false result.&lt;/p&gt;
&lt;p&gt;Here's an example. If a rule contains a predicate &lt;code&gt;evt.type=connect and fd.sip.name=yahoo.com&lt;/code&gt;, the engine resolves the domain yahoo.com to a set of IPs (say 1.2.3.4, 1.2.3.5, 1.2.3.6) at the time the rules are loaded. Later, if a connect system call occurs (say to 1.2.3.5), the server side of the connection is compared against that set of IPs. Since the actual IP 1.2.3.5 is in the set of IPs for the domain yahoo.com, the rule snippet resolves to true.&lt;/p&gt;
&lt;p&gt;The right hand side of a predicate can be &lt;code&gt;in&lt;/code&gt; e.g. &lt;code&gt;fd.sip.name in (yahoo.com, foo.com)&lt;/code&gt;. In this case, the set of IPs for both domains are resolved and held. A later system call event will compare a given IP to the set of IPs for both sets of domains.&lt;/p&gt;
&lt;h2 id="how-falco-engine-refreshes-domain-ip-mappings"&gt;How Falco Engine Refreshes Domain/IP Mappings&lt;/h2&gt;
&lt;p&gt;The actual lookup of domains is done on a separate thread, to avoid stalling the main system call event loop. Additionally, the set of IPs for the domain is refreshed periodically, with the following strategy:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Domain names have a base refresh time of 10 seconds.&lt;/li&gt;
&lt;li&gt;If after a refresh cycle the IP addresses haven't changed, the refresh timeout for that domain name is doubled until 320 seconds (~5mins).&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="caveats-related-to-fd-ip-name-fields"&gt;Caveats Related to fd.*ip.name Fields&lt;/h2&gt;
&lt;p&gt;There are a few caveats related to the use of &lt;code&gt;fd.*ip.name&lt;/code&gt; fields that should be considered when writing Falco Rules.&lt;/p&gt;
&lt;h3 id="the-right-hand-side-must-be-a-resolvable-domain-name"&gt;The Right-Hand Side Must Be a Resolvable Domain Name&lt;/h3&gt;
&lt;p&gt;Since the right hand side of the predicate (e.g. the &lt;code&gt;foo.com&lt;/code&gt; part of &lt;code&gt;fd.sip.name=foo.com&lt;/code&gt;) is used to perform a DNS lookup at the time the rules are loaded, it must be a resolvable domain name. As a result, it's not possible to use domain substrings in conjunction with comparison operators like startswith/endswith/contains/etc. e.g. &lt;code&gt;fd.sip.name contains company.com&lt;/code&gt;. Also, the falco engine must be able to resolve domain names in order for rules using &lt;code&gt;fd.*ip.name&lt;/code&gt; fields to return accurate results.&lt;/p&gt;
&lt;h3 id="using-fd-ip-name-fields-in-outputs"&gt;Using fd.*ip.name Fields in Outputs&lt;/h3&gt;
&lt;p&gt;The fields &lt;code&gt;fd.*ip.name&lt;/code&gt; can be used in rule outputs, but they will return meaningful values only when the actual IP for the system call event matches one of the IPs associated with the domain name for the field. For example, the following rule will display a meaningful output for &lt;code&gt;...IP=%fd.sip.name&lt;/code&gt;, as the rule condition has a positive comparison for a &lt;code&gt;fd.sip.name&lt;/code&gt; field:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;rule&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;Connect to Yahoo&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;desc&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;Detect Connects to yahoo.com IPs&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;evt.type=connect and fd.sip.name=yahoo.com&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;output&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;Some connect to yahoo | command=%proc.cmdline connection=%fd.name IP=%fd.sip.name&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;priority&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;INFO&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In contrast, this rule will never display a meaningful output for &lt;code&gt;...IP=%fd.sip.name&lt;/code&gt;, as the comparison uses a negative match:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;rule&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;Connect to Anything but Yahoo&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;desc&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;Detect Connects to anything other than yahoo.com IPs&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;condition&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;evt.type=connect and fd.sip.name!=yahoo.com&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;output&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;Some connect to something other than yahoo | command=%proc.cmdline connection=%fd.name IP=%fd.sip.name&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#008000;font-weight:bold"&gt;priority&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;INFO&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The rule can match a given connect to an IP like 1.5.6.7, which is outside the known IPs 1.2.3.4/1.2.3.5/1.2.3.6 and generate an alert, but the value for &lt;code&gt;%fd.sip.name&lt;/code&gt; will be blank. (The full connection information is still available in &lt;code&gt;%fd.name&lt;/code&gt;, though.)&lt;/p&gt;
&lt;h3 id="limited-comparison-operators"&gt;Limited Comparison Operators&lt;/h3&gt;
&lt;p&gt;Although the falco rules syntax supports a fairly wide set of comparison operators for IPs, including contains, the only allowed operators for &lt;code&gt;fd.*ip.name&lt;/code&gt; fields are =/!=/in, with an optional preceding not.&lt;/p&gt;</description></item><item><title>Docs: Rule Format Version</title><link>https://v0-43--falcosecurity.netlify.app/docs/concepts/rules/versioning/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-43--falcosecurity.netlify.app/docs/concepts/rules/versioning/</guid><description>
&lt;p&gt;From time to time, we make changes to the &lt;a class='glossary-tooltip' title='A Falco rules file is a YAML file containing three types of elements: rules, macros, and lists.' data-toggle='tooltip' data-placement='top' href='https://v0-43--falcosecurity.netlify.app/docs/rules' target='_blank' aria-label='rules file'&gt;rules file&lt;/a&gt; format that are not backwards-compatible with older versions of Falco. Similarly, &lt;a class='glossary-tooltip' title='libsinsp receives the events from libscap library and enriches them with machine states.' data-toggle='tooltip' data-placement='top' href='https://github.com/falcosecurity/libs' target='_blank' aria-label='libsinsp'&gt;libsinsp&lt;/a&gt; and &lt;a class='glossary-tooltip' title='Falco uses libscap to collect the events from the ring buffer before forwarding them up to libsinsp.' data-toggle='tooltip' data-placement='top' href='https://github.com/falcosecurity/libs' target='_blank' aria-label='libscap'&gt;libscap&lt;/a&gt; may define new filtercheck fields, operators, etc. We want to denote that a given set of rules depends on the fields/operators from those libraries.&lt;/p&gt;
&lt;p&gt;There are currently two optional fields in the falco rules file related to versioning:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th style="text-align: left"&gt;Element&lt;/th&gt;
&lt;th style="text-align: left"&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;required_engine_version&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;Used to track compatibility between rules content and the falco &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/rules/versioning/#falco-engine-versioning"&gt;engine version&lt;/a&gt;.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;code&gt;required_plugin_versions&lt;/code&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;Used to track compatibility between rules content and &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/plugins#plugin-versions-and-falco-rules"&gt;plugin versions&lt;/a&gt;.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3 id="falco-engine-versioning"&gt;Falco Engine Versioning&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;falco&lt;/code&gt; executable and the &lt;code&gt;falco_engine&lt;/code&gt; C++ object now support returning a version number. The initial version is 2 (implying that prior versions were 1). We will increment this version whenever we make an incompatible change to the rules file format or add new &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/reference/rules/supported-fields/"&gt;fields&lt;/a&gt;, &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/reference/rules/supported-events/"&gt;events&lt;/a&gt; or &lt;a href="https://v0-43--falcosecurity.netlify.app/docs/rules/conditions/"&gt;syntax elements&lt;/a&gt; to Falco. You can check the Falco engine version that your installation supports by running &lt;code&gt;falco --version&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id="falco-rules-file-versioning"&gt;Falco Rules File Versioning&lt;/h3&gt;
&lt;p&gt;The Falco rules files included with Falco include a new top-level object, &lt;code&gt;required_engine_version: N&lt;/code&gt;, that specifies the minimum engine version required to read this rules file. If not included, no version check is performed when reading the rules file. Here's an example:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#080;font-style:italic"&gt;# This rules file requires a falco with falco engine version 7.&lt;/span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;- &lt;span style="color:#008000;font-weight:bold"&gt;required_engine_version&lt;/span&gt;:&lt;span style="color:#bbb"&gt; &lt;/span&gt;&lt;span style="color:#666"&gt;7&lt;/span&gt;&lt;span style="color:#bbb"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If a rules file has an &lt;code&gt;engine_version&lt;/code&gt; greater than the Falco engine version, the rules file is loaded and an error is returned.&lt;/p&gt;
&lt;h3 id="official-rules-file-versioning"&gt;Official Rules File Versioning&lt;/h3&gt;
&lt;p&gt;If you use the official rules distributed by the Falco organization, they are versioned in &lt;a href="https://github.com/falcosecurity/rules/releases"&gt;the repository&lt;/a&gt; along with the relevant changelog.&lt;/p&gt;</description></item><item><title>Docs: IDE Support</title><link>https://v0-43--falcosecurity.netlify.app/docs/concepts/rules/ide-support/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-43--falcosecurity.netlify.app/docs/concepts/rules/ide-support/</guid><description>
&lt;p&gt;For some Integrated Development Environment (IDE) Editors, there is support for falco rules files that allow for on-the-fly syntax checking and validation of rules content.&lt;/p&gt;
&lt;h4 id="emacs"&gt;Emacs&lt;/h4&gt;
&lt;p&gt;For emacs, there is a &lt;a href="https://www.flycheck.org"&gt;Flycheck&lt;/a&gt; checker called &lt;a href="https://github.com/falcosecurity/flycheck-falco-rules"&gt;flycheck-falco-rules&lt;/a&gt;:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://github.com/falcosecurity/flycheck-falco-rules/raw/main/flycheck-falco-rules-example.png" alt="" loading="lazy" /&gt;
&lt;/p&gt;</description></item></channel></rss>