-
Notifications
You must be signed in to change notification settings - Fork 905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Formatting output of alerts generated by k8saudit plugin does not work #2289
Comments
/milestone 0.34.0 |
/milestone 0.35.0 |
Issues go stale after 90d of inactivity. Mark the issue as fresh with Stale issues rot after an additional 30d of inactivity and eventually close. If this issue is safe to close now please do so with Provide feedback via https://github.com/falcosecurity/community. /lifecycle stale |
Milestone is set to 0.35.0, I can confirm it is not working in 0.34.1 /remove-lifecycle stale |
/milestone 0.36.0 |
Checking in here, a PR is up for #2127, need to check if this solves problem for plugins as well or if this is a slightly different request meaning the relevant code for plugins that supports this feature is elsewhere (haven't looked yet)? @jasondellaluce |
Issues go stale after 90d of inactivity. Mark the issue as fresh with Stale issues rot after an additional 30d of inactivity and eventually close. If this issue is safe to close now please do so with Provide feedback via https://github.com/falcosecurity/community. /lifecycle stale |
/remove-lifecycle stale |
The
-p
flag (docs) seems to only work with syscall alerts, but not with alerts from plugins (k8saudit).How to reproduce it
Install Falco 0.33.0 (tested on AlmaLinux, with rpm install).
Enable the k8saudit plugin in
falco.yaml
:Copy the
k8s_audit_rules.yaml
torules.d
and add a catch all rule for testing purposes:Run falco:
Expected behaviour
Expected to have the text 'This is Some Extra' appended to the output field of all alerts.
Screenshots
Edit a file under
/etc/
to trigger a syscall alert:Indeed, as expected, the text 'This is Some Extra' is appended to the output.
Create a file
event.json
with. a k8s audit event blob:Sent the audit event to falco using curl:
falco output:
Unfortunately no 'This is Some Extra' text added to the alert from the k8saudit plugin.
Environment
Falco version: 0.33.0
Libs version: 0.9.0
Plugin API: 2.0.0
Driver:
API version: 2.0.0
Schema version: 2.0.0
Default driver: 3.0.1+driver
{
"machine": "x86_64",
"nodename": "xxx",
"release": "4.18.0-425.3.1.el8.x86_64",
"sysname": "Linux",
"version": "# 1 SMP Tue Nov 8 14:08:25 EST 2022"
}
Virtual Machine
AlmaLinux 8.7 (Stone Smilodon)
Linux 4.18.0-425.3.1.el8.x86_64 # 1 SMP Tue Nov 8 14:08:25 EST 2022 x86_64 x86_64 x86_64 GNU/Linux
RPM
Additional context
My goal is to run a central falco (cluster) ingesting k8saudit events (or other cloud based events supported by falco plugins). A k8saudit event though misses important metadata to be able to trace the event back to the cluster (related discussion), like a cluster name/id.
The only way I see to do this, is by using the client authentication to provide additional metadata. A (reverse)proxy/ingress controller is responsible for handling authentication and pass additional metadata based on the authentication to falco by setting additional http headers. This is usually a pretty standard feature of a proxy (e.g. X-Forward-For headers). For example we can use mtls with k8s cluster specific client certs to authenticate. The proxy can forward the certificate subject field to the k8saudit plugin, and we can encode the cluster name in the subject for example.
I am looking into extending the k8saudit plugin with support to grab additional fields from http headers. Passing these values along the plugin event processing pipeline gets a bit ugly though. Only option seems to be altering the event from the http body with the header metadata. This unfortunately seems to mean the field names are fixed, as required by the extractor part.
Last challenge is to actually get the extra fields in the output, apart from editing all rules, the
-p
options seems atm the only way (related comment). See issue as well for additional output fields.Downside of this approach is that each plugin requires a dedicated falco cluster, as the
-p
flag (with %field markers) is specific to each plugin. Falco validates the-p
argument very early on, even before excluding rules with the -T/-t flags. E.g. adding a '%ka.auditid' with-p
fails even if you only enable k8s rules (-t k8s).Another downside is that the extra metadata is added to the output field. A better alternative is to only add these fields to the 'output_fields', not the 'output'. Just like falcosidekick allows to set 'custom fields', which are only added to the 'output_fields'.
Furthermore it would be ideal to be able to add 'custom' named fields to the output_fields of the alert. The additional fields a user wants to set, based on authentication/headers, is completely up to the user. Especially if you are forwarding the alerts with falcosidekick to other tools, the extra output_fields basically become 'labels' standardised across the organisation. E.g. alerts are forwarded as log lines to a log aggregation system. Each log line has a number of fixed labels so its origin can easily be found. The kubernetes cluster of origin is just one possibility, but one could add labels like division, project or team.
The text was updated successfully, but these errors were encountered: