mirror of
https://gitlab.kube.huskypup.net/Scooby/Homelabv4.git
synced 2026-08-21 05:26:49 +00:00
73 lines
2.1 KiB
YAML
73 lines
2.1 KiB
YAML
apiVersion: kyverno.io/v1
|
|
kind: ClusterPolicy
|
|
metadata:
|
|
name: require-drop-all-capabilities
|
|
annotations:
|
|
policies.kyverno.io/title: Require Drop All Capabilities
|
|
policies.kyverno.io/category: DoD STIG
|
|
policies.kyverno.io/severity: high
|
|
policies.kyverno.io/description: >-
|
|
STIG V-242398: Containers must drop all Linux capabilities and only
|
|
add back specific capabilities that are required. This follows the
|
|
principle of least privilege for container security contexts.
|
|
spec:
|
|
validationFailureAction: Audit
|
|
background: true
|
|
rules:
|
|
- name: require-drop-all
|
|
match:
|
|
any:
|
|
- resources:
|
|
kinds:
|
|
- Pod
|
|
exclude:
|
|
any:
|
|
- resources:
|
|
namespaces:
|
|
- kube-system
|
|
- rook-ceph
|
|
- istio-system
|
|
- prometheus
|
|
- kyverno
|
|
- argocd
|
|
- cert-manager
|
|
- cnpg-system
|
|
- envoy-gateway-system
|
|
- kiali-operator
|
|
- mariadb-system
|
|
- redis-operator
|
|
- reloader
|
|
- scylla-operator
|
|
- vault
|
|
- mqtt
|
|
- gitlab
|
|
- netbird
|
|
- grafana
|
|
- crowdsec
|
|
- external-dns
|
|
- nextcloud
|
|
- home-assistant
|
|
- guacamole
|
|
- teslamate
|
|
- unpoller
|
|
- frigate
|
|
- authentik
|
|
- checkov
|
|
- external-secrets
|
|
validate:
|
|
message: >-
|
|
Containers must drop ALL capabilities (STIG V-242398).
|
|
Add securityContext.capabilities.drop: ["ALL"] to each container.
|
|
pattern:
|
|
spec:
|
|
containers:
|
|
- securityContext:
|
|
capabilities:
|
|
drop:
|
|
- ALL
|
|
=(initContainers):
|
|
- securityContext:
|
|
capabilities:
|
|
drop:
|
|
- ALL
|