# Rules that reflect decisions about this cluster, reviewed like any other code. # Argo CD syncs this ConfigMap, and values.yaml mounts it into the Falco pods. --- apiVersion: v1 kind: ConfigMap metadata: name: falco-local-rules namespace: falco data: local-rules.yaml: |- # A shell inside a container is normal during development and suspicious in # production. Rather than turning the rule off, this narrows it. - list: shell_allowed_namespaces items: [dev, staging] - rule: Shell in production container desc: >- Someone opened an interactive shell inside a running container outside the namespaces where that is expected. condition: > spawned_process and container and shell_procs and not k8s.ns.name in (shell_allowed_namespaces) output: >- Shell opened in a production container (user=%user.name container=%container.name image=%container.image.repository namespace=%k8s.ns.name pod=%k8s.pod.name command=%proc.cmdline) priority: WARNING tags: [container, shell, mitre_execution] # Reading the service account token is how a compromised pod starts moving # sideways. Legitimate clients read it through the mounted file at startup, # so a read by a shell or a network tool is the interesting case. - rule: Service account token read by an unexpected process desc: Something other than the application read the mounted service account token. condition: > open_read and container and fd.name startswith /var/run/secrets/kubernetes.io/serviceaccount and proc.name in (curl, wget, nc, ncat, socat, python3, perl, ruby, sh, bash) output: >- Service account token read by an unexpected process (process=%proc.name command=%proc.cmdline container=%container.name namespace=%k8s.ns.name pod=%k8s.pod.name) priority: CRITICAL tags: [container, credentials, mitre_credential_access]