AWS batch: Document EKS container security context in Batch job definitions
Summary
Adds reference documentation for new Amazon EKS job security-context parameters: container-level `capabilities` (add/drop Linux capabilities), container- and pod-level `seccompProfile` (type/localhostProfile), pod-level `securityContext` (fsGroup, runAsGroup, runAsNonRoot, runAsUser), and `initContainers`. Also clarifies runAsGroup/runAsUser value ranges and corrects the `runAsNonRoot` type from Long to Boolean.
Security assessment
The diff documents security-hardening controls for AWS Batch EKS jobs, including dropping/adding Linux capabilities, enforcing non-root execution (runAsNonRoot), setting user/group IDs, and applying seccomp profiles. It also fixes an incorrect parameter type (Long to Boolean) for runAsNonRoot. These are documentation-only additions of security best-practice configuration; there is no evidence of a specific vulnerability, CVE, or incident being addressed.
Evidence
+Set this parameter to `true` to require the container to run as a user with a user ID (UID) other than `0`. If you don't specify this parameter, no such rule is enforced. This parameter maps to `RunAsUser` and `MustRunAsNonRoot` policy in the [Users and groups pod security policies](https://kubernetes.io/docs/concepts/security/pod-security-policy/#users-and-groups) in the _Kubernetes documentation_.
Diff
diff --git a/batch/latest/userguide/job_definition_parameters.md b/batch/latest/userguide/job_definition_parameters.md index ee3e67f..e3db32a 100644 --- a//batch/latest/userguide/job_definition_parameters.md +++ b//batch/latest/userguide/job_definition_parameters.md @@ -1298,0 +1299,27 @@ Required: No +`capabilities` + + +The Linux capabilities to add to or remove from the container's default capability set. Specify capability names without the `CAP_` prefix. + +Type: [EksContainerLinuxCapabilities](https://docs.aws.amazon.com/batch/latest/APIReference/API_EksContainerLinuxCapabilities.html) object + +Required: No + +`add` + + +The Linux capabilities to add. You can specify up to 64 values. + +Type: Array of strings + +Required: No + +`drop` + + +The Linux capabilities to remove. You can specify up to 64 values. + +Type: Array of strings + +Required: No + @@ -1320 +1347 @@ Required: No -When this parameter is specified, the container is run as the specified group ID (`gid`). If this parameter isn't specified, the default is the group that's specified in the image metadata. This parameter maps to `RunAsGroup` and `MustRunAs` policy in the [Users and groups pod security policies](https://kubernetes.io/docs/concepts/security/pod-security-policy/#users-and-groups) in the _Kubernetes documentation_. +When you specify this parameter, the container runs as the specified group ID (GID). If you don't specify this parameter, the default is the group that's specified in the image metadata. This parameter supports values from `0` through `2147483647` and maps to `RunAsGroup` and `MustRunAs` policy in the [Users and groups pod security policies](https://kubernetes.io/docs/concepts/security/pod-security-policy/#users-and-groups) in the _Kubernetes documentation_. @@ -1329 +1356 @@ Required: No -When this parameter is specified, the container is run as a user with a `uid` other than 0\. If this parameter isn't specified, so such rule is enforced. This parameter maps to `RunAsUser` and `MustRunAsNonRoot` policy in the [Users and groups pod security policies](https://kubernetes.io/docs/concepts/security/pod-security-policy/#users-and-groups) in the _Kubernetes documentation_. +Set this parameter to `true` to require the container to run as a user with a user ID (UID) other than `0`. If you don't specify this parameter, no such rule is enforced. This parameter maps to `RunAsUser` and `MustRunAsNonRoot` policy in the [Users and groups pod security policies](https://kubernetes.io/docs/concepts/security/pod-security-policy/#users-and-groups) in the _Kubernetes documentation_. @@ -1331 +1358 @@ When this parameter is specified, the container is run as a user with a `uid` ot -Type: Long +Type: Boolean @@ -1338 +1365 @@ Required: No -When this parameter is specified, the container is run as the specified user ID (`uid`). If this parameter isn't specified, the default is the user that's specified in the image metadata. This parameter maps to `RunAsUser` and `MustRanAs` policy in the [Users and groups pod security policies](https://kubernetes.io/docs/concepts/security/pod-security-policy/#users-and-groups) in the _Kubernetes documentation_. +When you specify this parameter, the container runs as the specified user ID (UID). If you don't specify this parameter, the default is the user that's specified in the image metadata. This parameter supports values from `0` through `2147483647` and maps to `RunAsUser` and `MustRunAs` policy in the [Users and groups pod security policies](https://kubernetes.io/docs/concepts/security/pod-security-policy/#users-and-groups) in the _Kubernetes documentation_. @@ -1343,0 +1371,36 @@ Required: No +`seccompProfile` + + +The seccomp profile for the container. This value overrides the profile in the pod security context. If you don't specify a container profile, the container uses the pod profile when one is specified. + +Type: [EksSeccompProfile](https://docs.aws.amazon.com/batch/latest/APIReference/API_EksSeccompProfile.html) object + +Required: No + +`type` + + +The seccomp profile type. The following values are valid: + + * `RuntimeDefault` \- Uses the default profile from the container runtime. + + * `Localhost` \- Uses the profile that's specified by `localhostProfile`. + + * `Unconfined` \- Applies no seccomp filtering. + + + + +Type: String + +Required: Yes + +`localhostProfile` + + +The relative path to a profile on each eligible worker node. Specify this value only when `type` is `Localhost`. Install the profile on every node where the job can run. + +Type: String + +Required: Yes, when `type` is `Localhost` + @@ -1399,0 +1463,90 @@ Required: No +`initContainers` + + +The init containers for the Amazon EKS pod. Init containers support the same container security-context properties as application containers, including `capabilities` and `seccompProfile`. + +Type: Array of [EksContainer](https://docs.aws.amazon.com/batch/latest/APIReference/API_EksContainer.html) objects + +Required: No + +`securityContext` + + +The security context for the Amazon EKS pod. Pod-level values apply to every application and init container unless that container specifies its own value for the same setting. + +Type: [EksPodSecurityContext](https://docs.aws.amazon.com/batch/latest/APIReference/API_EksPodSecurityContext.html) object + +Required: No + +`fsGroup` + + +The group ID applied to supported volumes and used for volume ownership. Supported values are `0` through `2147483647`. If this parameter isn't specified, no file-system group is applied. + +Type: Long + +Required: No + +`runAsGroup` + + +The default group ID for containers in the pod. A container-level `runAsGroup` value overrides this value. Supported values are `0` through `2147483647`. If this parameter isn't specified, the pod doesn't set a default group ID. + +Type: Long + +Required: No + +`runAsNonRoot` + + +Specifies whether containers in the pod must run as a non-root user. A container-level `runAsNonRoot` value overrides this value. If this parameter isn't specified, the pod doesn't enforce a default non-root requirement. + +Type: Boolean + +Required: No + +`runAsUser` + + +The default user ID for containers in the pod. A container-level `runAsUser` value overrides this value. Supported values are `0` through `2147483647`. If this parameter isn't specified, the pod doesn't set a default user ID. + +Type: Long + +Required: No + +`seccompProfile` + + +The default seccomp profile for containers in the pod. A container-level profile overrides this value. + +Type: [EksSeccompProfile](https://docs.aws.amazon.com/batch/latest/APIReference/API_EksSeccompProfile.html) object + +Required: No + +`type` + + +The seccomp profile type. The following values are valid: + + * `RuntimeDefault` \- Uses the default profile from the container runtime. + + * `Localhost` \- Uses the profile that's specified by `localhostProfile`. + + * `Unconfined` \- Applies no seccomp filtering. + + + + +Type: String + +Required: Yes + +`localhostProfile` + + +The relative path to a profile on each eligible worker node. Specify this value only when `type` is `Localhost`. Install the profile on every node where the job can run. + +Type: String + +Required: Yes, when `type` is `Localhost` +