Description
In a legacy Terraform PSP, set allowed_proc_mount_types = ["Default"]. Allowing Unmasked lets a Pod request removal of default protections on /proc.
Potential impact
A container that uses this option can access kernel paths normally masked or read-only. Its PID namespace and permissions determine which processes it can see and what it can do.
Remediation
Check the workload’s actual proc mount, privileged mode and host PID sharing. On current clusters, enforce default mounts with Restricted Pod Security Admission or a policy engine. Isolate any workload that genuinely needs an exception.
Examples
Kubernetes deprecated PSP in 1.21 and removed it in 1.25. These excerpts require a cluster and Terraform provider that support the legacy API.
Before
resource "kubernetes_pod_security_policy" "policy" {
metadata {
name = "terraform-example"
}
spec {
allowed_proc_mount_types = ["Unmasked"]
}
}
After
resource "kubernetes_pod_security_policy" "policy" {
metadata {
name = "terraform-example"
}
spec {
allowed_proc_mount_types = ["Default"]
}
}
The second policy allows only Default, retaining the runtime’s masked and read-only paths.