Skip to content

Generate a variety of suspect actions that are detected by Falco rulesets

License

Notifications You must be signed in to change notification settings

michaelfix/event-generator

 
 

Repository files navigation

event-generator

Generate a variety of suspect actions that are detected by Falco rulesets.

Release License Go Report Card Docker pulls

Warning — We strongly recommend that you run the program within Docker (see below), since some commands might alter your system. For example, some actions modify files and directories below /bin, /etc, /dev, etc. Make sure you fully understand what is the purpose of this tool before running any action.

Usage

The full command line documentation is here.

List actions

$ event-generator list

helper.ExecLs
helper.NetworkActivity
helper.RunShell
k8saudit.ConfigmapPrivateCreds
k8saudit.DisallowedPodDeployment
k8saudit.HostnetworkDeployment
k8saudit.NodeportService
k8saudit.PrivilegedDeployment
k8saudit.RolePodExec
k8saudit.RoleWildcardResources
k8saudit.RoleWritePrivileges
k8saudit.SensitiveMountDeployment
k8saudit.VanillaConfigmap
k8saudit.VanillaDeployment
k8saudit.VanillaRoleRolebindingServiceaccount
k8saudit.VanillaService
syscall.ChangeThreadNamespace
syscall.CreateFilesBelowDev
syscall.DbProgramSpawnProcess
syscall.MkdirBinaryDirs
syscall.ModifyBinaryDirs
syscall.NonSudoSetuid
syscall.ReadSensitiveFile
syscall.ReadSensitiveFileAfterStartup
syscall.RunShellUntrusted
syscall.ScheduleCronJobs
syscall.SystemProcsNetworkActivity
syscall.SystemUserInteractive
syscall.UserMgmtBinaries
syscall.WriteBelowBinaryDir
syscall.WriteBelowEtc
syscall.WriteBelowRpmDatabase

Run actions

event-generator run [regexp]

Without arguments it runs all actions, otherwise only those actions matching the given regular expression.

For example, to run syscall.MkdirBinaryDirs and syscall.ModifyBinaryDirs actions only:

$ sudo event-generator run syscall\.\*BinaryDirs

INFO sleep for 1s                                  action=syscall.MkdirBinaryDirs
INFO writing to /bin/directory-created-by-event-generator  action=syscall.MkdirBinaryDirs
INFO sleep for 1s                                  action=syscall.ModifyBinaryDirs
INFO modifying /bin/true to /bin/true.event-generator and back  action=syscall.ModifyBinaryDirs

Useful options:

  • --loop to run actions in a loop
  • --sleep to set the length of time to wait before running an action (default to 1s)

All other options are documented here.

With Docker

Run all events with the Docker image locally:

docker run -it --rm falcosecurity/event-generator run

With Kubernetes

Run the following command to create the Service Account (falco-event-generator), Cluster Role, and Role that will allow the tool to create objects in the current namespace:

kubectl apply -f deployment/role-rolebinding-serviceaccount.yaml

Run all events once using a Kubernetes job:

kubectl apply -f deployment/run-as-job.yaml

Run all events in a loop using a Kubernetes deployment:

kubectl apply -f deployment/event-generator.yaml

N.B. The above commands apply to the default namespace. Use the --namespace option to use a different namespace. Events will be generated in the same namespace.

Collections

Generate System Call activity

The syscall collection performs a variety of suspect actions that are detected by the default Falco ruleset.

$ docker run -it --rm falcosecurity/event-generator run syscall --loop

The above command loops forever, incessantly generating a sample event each second.

Generate activity for the k8s audit rules

The k8saudit collection generates activity that matches the k8s audit event ruleset.

$ event-generator run k8saudit --loop --namespace `falco-eg-sandbox`

N.B.: the namespace must exist already.

The above command loops forever, creating resources in the falco-eg-sandbox namespace and deleting the after each iteration.

N.B.

  • the namespace must already exist
  • to produce any effect the Kubernetes audit log must be enabled, see here

FAQ

What sample events can be generated by this tool?

See the events registry.

Can I contribute by adding new events?

Sure!

Check out the events registry conventions, then feel free to open a PR. Your contribution is highly appreciated.

Can I use this project as a library?

This project provides three main packages that can be imported and used separately:

  • /cmd contains the CLI implementation
  • /events contains the events registry
  • /pkg/runner contains the actions runner implementations

Feel free to use them as you like on your projects.

Acknowledgments

Special thanks to Mark Stemm (@mstemm) — the author of the first event generator.

About

Generate a variety of suspect actions that are detected by Falco rulesets

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 94.7%
  • Makefile 4.1%
  • Dockerfile 1.2%