Container is running without AppArmor profile Affecting Container service in Kubernetes


0.0
medium
    Severity Framework Snyk CCSS
    Rule category Containers / Access Control

Is your enviroment affected by this misconfiguration?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
    Frameworks
    CIS-Controls
  • Snyk ID SNYK-CC-00619
  • credit Snyk Research Team

Description

AppArmor is a Linux kernel security module that confines programs to limited resources, complementing standard permissions. It enhances security by configuring applications to minimize attack surfaces and provide stronger defense.

How to fix?

Add the container.apparmor.security.beta.kubernetes.io/<container-name> to the annotations attribute with value runtime/default or localhost/<name-of-profile>.

Example Configuration

apiVersion: v1
kind: Pod
metadata:
  name: unconfined-apparmor-profile-pod
  labels:
    app: myapp
  annotations:
    container.apparmor.security.beta.kubernetes.io/myapp-container1: unconfined
spec:
  containers:
    - name: myapp-container1
      image: busybox
      command: ["sh", "-c", "echo Hello Kubernetes! && sleep 3600"]
      securityContext:
        privileged: true
        capabilities:
          add:
            - SYS_ADMIN
      resources:
        limits:
          cpu: "500m"
          memory: "256Mi"
        requests:
          cpu: "200m"
          memory: "128Mi"

Terraform