Skip to content
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

Add k8s event generator #997

Merged
merged 2 commits into from
Jan 15, 2020
Merged

Add k8s event generator #997

merged 2 commits into from
Jan 15, 2020

Conversation

mstemm
Copy link
Contributor

@mstemm mstemm commented Jan 15, 2020

What type of PR is this?

Uncomment one (or more) /kind <> lines:

/kind bug

/kind cleanup

/kind design

/kind documentation

/kind failing-test

/kind feature

If contributing rules or changes to rules, please make sure to also uncomment one of the following line:

/kind rule-update

/kind rule-create

Any specific area of the project related to this PR?

Uncomment one (or more) /area <> lines:

/area build

/area engine

/area examples

/area rules

/area integrations

/area tests

/area proposals

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

update: add support for k8s audit events to the falco-event-generator container.

Currently, the falco event generator only generates system call
activity. This adds support for k8s_audit events by adding a script +
supporting k8s object files that generate activity that matches the k8s
audit event ruleset.

The main script is k8s_event_generator.sh, which loops over the files in
the yaml subdirectory, running kubectl apply -f for each.

In the interests of keeping things self-contained, all objects are
created in a `falco-event-generator` namespace. This means that some
activity related with cluster roles/cluster role bindings is not
performed.

Each k8s object has annotations that note:

1. The specific falco rules that should trigger.
2. A user-friendly message to print when apply-ing the file.

You can provide a specific rule name to the script. If provided, only
those objects related to that rule will trigger. The default is "all",
meaning that all objects are created.

The script loops forever, deleting the falco-event-generator namespace
after each iteration.

Additionally, the docker image has been updated to also copy the script
+ supporting files, as well as fetching the latest available `kubectl`
binary. The entrypoint is now a script that allows choosing between:
 - syscall activity: run with .... "syscall"
 - k8s_audit activity: run with .... "k8s_audit"
 - spawn a shell: run with .... "bash"

The default is "syscall" to preserve existing behavior.

In most cases, you'll need to provide kube config
files/directories that allow access to your cluster. A
command like the following will work:

```
docker run -v $HOME/.kube:/root/.kube -it falcosecurity/falco-event-generator
k8s_audit
```

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
Noticed these while compiling in the latest alpine image.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
@markjacksonfishing
Copy link
Contributor

/lgtm

@poiana
Copy link

poiana commented Jan 15, 2020

LGTM label has been added.

Git tree hash: fe4cb8e312533f3c6333d3b8760f09fd6f3efe8c

Copy link
Contributor

@fntlnz fntlnz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thanks @mstemm

@poiana
Copy link

poiana commented Jan 15, 2020

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fntlnz, markyjackson-taulia

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@fntlnz
Copy link
Contributor

fntlnz commented Jan 15, 2020

@mstemm I'm working on a mechanism to automatically release docker images for the dev branch and PRs in #968 - do you want this image to be included?
For PRs it will only work only for the ones coming from maintainers.

@fntlnz
Copy link
Contributor

fntlnz commented Jan 15, 2020

It's normal that Circle fails right now, it's not yet enabled on the dev branch and forks so I'm going to merge this.

@fntlnz fntlnz merged commit 09cdc85 into dev Jan 15, 2020
@poiana poiana deleted the add-k8s-event-generator branch January 15, 2020 08:35
mstemm added a commit to falcosecurity/falco-website that referenced this pull request Jan 16, 2020
falcosecurity/falco#997 recently added support
for k8s audit rules to the event generator. This updates the docs to
reflect those changes.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
@fntlnz fntlnz added this to the 0.19.0 milestone Jan 22, 2020
poiana pushed a commit to falcosecurity/falco-website that referenced this pull request Jan 23, 2020
falcosecurity/falco#997 recently added support
for k8s audit rules to the event generator. This updates the docs to
reflect those changes.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants