Glossary

#Falco - Host Intrusion Detection tool (only log the detection)

https://falco.org/

Detects threats at runtime by observing the behaviour of your applications and containers. It is installed on every node. It works between the container and kernel.

Falco uses system calls to secure and monitor a system, by:

  • Parsing the Linux system calls from the kernel at runtime

  • Asserting the stream against a powerful rules engine

  • Alerting when a rule is violated

Kubernetes Audit Rules

Rules devoted to Kubernetes audit events are given in the default k8saudit plugin rules. When installed as a daemon, falco installs this rules file to /etc/falco/, so they are available for use.

#seccomp - restrict system calls within a container

Valid options for type include RuntimeDefault, Unconfined, and Localhost. localhostProfile must only be set if type: Localhost. It indicates the path of the pre-configured profile on the node, relative to the kubelet's configured Seccomp profile location (configured with the --root-dir flag).

...
securityContext:
  seccompProfile:
    type: RuntimeDefault

Here is an example that sets the Seccomp profile to a pre-configured file at <kubelet-root-dir>/seccomp/my-profiles/profile-allow.json:

#AppArmour - a layer between userspace and kernel syscalls

AppArmor is a Linux kernel security module that allows the system administrator to restrict programs' capabilities with per-program profiles

Profiles:

  • AppArmor must be installed on every node

  • AppArmor profiles need to be available on every node.

  • AppArmor profiles are specified per container and done using annotations.

ProfileModes:

  • Unconfined (no profiles will be loaded - disables AppArmor)

  • Complain (profile violations are permitted but logged)

  • Enforce (profile violations are not permitted)

The profile_ref can be one of:

  • runtime/default to apply the runtime's default profile

  • localhost/<profile_name> to apply the profile loaded on the host with the name <profile_name>

  • unconfined to indicate that no profiles will be loaded

#Network Policy

  • Ingress

  • Egress

#Ingress

  • host

  • annotation - rewrite

  • don't forget to specify

    spec:

    ingressClassName: nginx

#CIS Center for Internet Security (secure OS)

#CIS Benchmark (secure Kubernetes)

Tools:

  • kube-bench

  • (docker bench)

#ETCD - Encrypting Secret Data at Rest

HashiCorp - Vault

kube-apiserver

Name
Encryption
Strength
Speed
Key Length
Other Considerations

identity

None

N/A

N/A

N/A

no encryption

secretbox

XSalsa20 and Poly1305

Strong

Faster

32-byte

A newer standard and may not be considered acceptable in environments that require high levels of review.

aesgcm

AES-GCM with random nonce

Must be rotated every 200k writes

Fastest

16, 24, or 32-byte

Is not recommended for use except when an automated key rotation scheme is implemented.

aescbc

AES-CBC with PKCS#7 padding

Weak

Fast

32-byte

Not recommended

kms

Uses envelope encryption scheme: Data is encrypted by data encryption keys (DEKs) using AES-CBC with PKCS#7 padding (prior to v1.25), using AES-GCM starting from v1.25, DEKs are encrypted by key encryption keys (KEKs) according to configuration in Key Management Service (KMS)

Strongest

Fast

32-bytes

The recommended choice for using a third party tool for key management. Simplifies key rotation, with a new DEK generated for each encryption, and KEK rotation controlled by the user. Configure the KMS provider.

#Container Runtime Sandboxes ????

  • more resources needed

  • might be better for smaller containers.

  • not good for syscall heavy workloads

  • no direct access to hardware

Dirty Cow exploit.

  • gVisor

Installation

Define RuntimeClass

Use in a pod

  • kata (lightweight vm) (QEMU)

#Security Contexts

#Open Policy Agent and Gatekeeper (OPA)

create the Constraint Template

create the Constraint

https://github.com/killer-sh/cks-course-environment/tree/master/course-content/opa

https://play.openpolicyagent.org

https://medium.com/axons/admission-control-on-kubernetes-9a1667b7e322

https://github.com/BouweCeunen/gatekeeper-policies

#Image footprint (security)

  • reduce image footprint with Multistage

  • secure and harden images

    • use specific package versions

    • don't run as a root

    • make the filesystem read-only ???

    • remove shell access

    • follow the docker best practices

#Static Analysis

  • manual approach - visual check

  • kubesec (https://kubesec.io/)

    • kubesec scan pod.yaml

  • Conftest - OPA ???

kubesec run as:

#Image Vulnerability Scanning

  • trivy-operator

https://github.com/aquasecurity/trivy-operator/blob/main/docs/index.md

#Secure supply chain

Kubernetes - private registry

Whitelist Registries with OPA Gatekeeeper

??? how to allow the default registry??????

ImagePolicyWenhook

  • /etc/kubernetes/admission/admission_configuration.yaml

  • /etc/kubernetes/admission/kubeconf

  • /etc/kubernetes/manifests/kube-apiserver.yaml

  • --admission-control-config-file=/etc/kubernetes/admission/admission_configuration.yaml

    --enable-admission-plugins=NodeRestriction,ImagePolicyWebhook

???? Find an example of an external WebHook service ????

Last updated