Review container seccomp profiles

Apply an appropriate seccomp profile to Linux containers and verify actual behavior.

Description

A Linux seccomp profile limits which system calls a container process can make. Unconfined disables this filtering. If the profile is omitted, check the kubelet and runtime defaults in effect.

Potential impact

A permissive profile can allow unnecessary system calls. A restrictive one can block normal application operations.

Remediation

With a compatible Terraform provider, set security_context.seccomp_profile.type to RuntimeDefault. For Localhost, install the reviewed file named by localhost_profile on every node where the Pod can run. Check container-level overrides and privileged mode. Privileged containers run without seccomp filtering.

Examples

Both excerpts use the same Pod-level block, changing Unconfined to RuntimeDefault. Use a maintained Linux image, test required functions and review denial logs. Keep non-root execution, limited capabilities and security updates in place.

Before

hcl
resource "kubernetes_pod" "pod" {
  metadata {
    name = "terraform-example"
  }

  spec {
    security_context {
      seccomp_profile {
        type = "Unconfined"
      }
    }

    container {
      image = "nginx:1.7.9"
      name  = "example"
    }
  }
}

After

hcl
resource "kubernetes_pod" "pod" {
  metadata {
    name = "terraform-example"
  }

  spec {
    security_context {
      seccomp_profile {
        type = "RuntimeDefault"
      }
    }

    container {
      image = "nginx:1.7.9"
      name  = "example"
    }
  }
}

References