The default Falco rule set defines a number of macros that makes it easier to start writing rules. These macros provide shortcuts for a number of common scenarios and can be used in any user defined rule sets. Falco also provide Macros that should be overridden by the user to provide settings that are specific to a user's environment. The provided Macros can also be appended to in a local rules file.
- macro: open_write
condition: (evt.type=open or evt.type=openat) and evt.is_open_write=true and fd.typechar='f' and fd.num>=0
- macro: open_read
condition: (evt.type=open or evt.type=openat) and evt.is_open_read=true and fd.typechar='f' and fd.num>=0
- macro: never_true
condition: (evt.num=0)
- macro: always_true
condition: (evt.num=>0)
- macro: proc_name_exists
condition: (proc.name!="<NA>")
- macro: rename
condition: evt.type in (rename, renameat)
- macro: mkdir
condition: evt.type = mkdir
- macro: remove
condition: evt.type in (rmdir, unlink, unlinkat)
- macro: modify
condition: rename or remove
- macro: spawned_process
condition: evt.type = execve and evt.dir=<
- macro: bin_dir
condition: fd.directory in (/bin, /sbin, /usr/bin, /usr/sbin)
- macro: shell_procs
condition: (proc.name in (shell_binaries))
- macro: sensitive_files
condition: >
fd.name startswith /etc and
(fd.name in (sensitive_file_names)
or fd.directory in (/etc/sudoers.d, /etc/pam.d))
- macro: proc_is_new
condition: proc.duration <= 5000000000
- macro: inbound
condition: >
(((evt.type in (accept,listen) and evt.dir=<)) or
(fd.typechar = 4 or fd.typechar = 6) and
(fd.ip != "0.0.0.0" and fd.net != "127.0.0.0/8") and (evt.rawres >= 0 or evt.res = EINPROGRESS))
- macro: outbound
condition: >
(((evt.type = connect and evt.dir=<)) or
(fd.typechar = 4 or fd.typechar = 6) and
(fd.ip != "0.0.0.0" and fd.net != "127.0.0.0/8") and (evt.rawres >= 0 or evt.res = EINPROGRESS))
- macro: inbound_outbound
condition: >
(((evt.type in (accept,listen,connect) and evt.dir=<)) or
(fd.typechar = 4 or fd.typechar = 6) and
(fd.ip != "0.0.0.0" and fd.net != "127.0.0.0/8") and (evt.rawres >= 0 or evt.res = EINPROGRESS))
- macro: container
condition: container.id != host
- macro: interactive
condition: >
((proc.aname=sshd and proc.name != sshd) or
proc.name=systemd-logind or proc.name=login)
The below macros contain values that can be overridden for a user's specific environment.
Override this macro to reflect ports in your environment that provide SSH services.
- macro: ssh_port
condition: fd.sport=22
Override this macro to reflect hosts that can connect to known SSH ports (ie a bastion or jump box).
- macro: allowed_ssh_hosts
condition: ssh_port
Whitelist containers that are allowed to run in privileged mode.
- macro: user_trusted_containers
condition: (container.image startswith sysdig/agent)
Whitelist containers that are allowed to spawn shells, which may be needed if containers are used in the CI/CD pipeline.
- macro: user_shell_container_exclusions
condition: (never_true)
Whitelist containers that are allowed to communicate with the EC2 metadata service. Default: any container.
- macro: ec2_metadata_containers
condition: container
Set the IP of your Kubernetes API Service here.
- macro: k8s_api_server
condition: (fd.sip="1.2.3.4" and fd.sport=8080)
Whitelist containers that are allowed to communicate with the Kubernetes API Service. Requires k8s_api_server being set.
- macro: k8s_containers
condition: >
(container.image startswith gcr.io/google_containers/hyperkube-amd64 or
container.image startswith gcr.io/google_containers/kube2sky or
container.image startswith sysdig/agent or
container.image startswith sysdig/falco or
container.image startswith sysdig/sysdig)
- macro: nodeport_containers
condition: container
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.