Skip to content

Commit 04e79d4

Browse files
authored
Merge pull request #36137 from snarayan-redhat/BZ1873324_seccomp_profile_new
BZ1873324: seccomp profile changes
2 parents fdefd95 + d2a8613 commit 04e79d4

File tree

5 files changed

+110
-0
lines changed

5 files changed

+110
-0
lines changed

_topic_map.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ Topics:
764764
File: audit-log-policy-config
765765
- Name: Configuring TLS security profiles
766766
File: tls-security-profiles
767+
- Name: Configuring seccomp profiles
768+
File: seccomp-profiles
767769
- Name: Allowing JavaScript-based access to the API server from additional hosts
768770
File: allowing-javascript-access-api-server
769771
Distros: openshift-enterprise,openshift-origin
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[id="applying-custom-seccomp-profile_{context}"]
2+
= Applying the custom seccomp profile to the workload
3+
4+
.Prerequisite
5+
* The cluster administrator has set up the custom seccomp profile. For more details, see "Setting up the custom seccomp profile".
6+
7+
.Procedure
8+
* Apply the seccomp profile to the workload by setting the `securityContext.seccompProfile.type` field as following:
9+
+
10+
.Example
11+
+
12+
[source, yaml]
13+
----
14+
spec:
15+
securityContext:
16+
seccompProfile:
17+
type: Localhost
18+
localhostProfile: <custom-name>.json <1>
19+
----
20+
<1> Provide the name of your custom seccomp profile.
21+
+
22+
Alternatively, you can use the pod annotations `seccomp.security.alpha.kubernetes.io/pod: localhost/<custom-name>.json`. However, this method is deprecated in {product-title} {product-version}.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[id="configuring-default-seccomp-profile_{context}"]
2+
= Configuring the default seccomp profile
3+
OpenShift ships with a default seccomp profile that is referenced as `runtime/default`. You can enable the default seccomp profile for a pod or container workload by setting `RuntimeDefault` as following:
4+
5+
.Example
6+
7+
[source, yaml]
8+
----
9+
spec:
10+
securityContext:
11+
seccompProfile:
12+
type: RuntimeDefault
13+
----
14+
15+
Alternatively, you can use the pod annotations `seccomp.security.alpha.kubernetes.io/pod: runtime/default` and `container.seccomp.security.alpha.kubernetes.io/<container_name>: runtime/default`. However, this method is deprecated in {product-title} {product-version}.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[id="setting-custom-seccomp-profile_{context}"]
2+
= Setting up the custom seccomp profile
3+
4+
.Prerequisite
5+
* You have cluster administrator permissions.
6+
* You have created a custom security context constraints (SCC). For more information, see "Additional resources".
7+
* You have created a custom seccomp profile.
8+
9+
.Procedure
10+
. Upload your custom seccomp profile to `/var/lib/kubelet/seccomp/<custom-name>.json` by using the Machine Config. See "Additional resources" for detailed steps.
11+
12+
. Update the custom SCC by providing reference to the created custom seccomp profile:
13+
+
14+
[source, yaml]
15+
----
16+
seccompProfiles:
17+
- localhost/<custom-name>.json <1>
18+
----
19+
<1> Provide the name of your custom seccomp profile.

security/seccomp-profiles.adoc

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
[id="seccomp-profiles"]
2+
= Configuring seccomp profiles
3+
include::modules/common-attributes.adoc[]
4+
:context: configuring-seccomp-profiles
5+
6+
toc::[]
7+
8+
An {product-title} container or a pod runs a single application that performs one or more well-defined tasks. The application usually requires only a small subset of the underlying operating system kernel APIs.
9+
Seccomp, secure computing mode, is a Linux kernel feature that can be used to limit the process running in a container to only call a subset of the available system calls. These system calls can be configured by creating a profile that is applied to a container or pod.
10+
Seccomp profiles are stored as JSON files on the disk.
11+
12+
[IMPORTANT]
13+
====
14+
OpenShift workloads run unconfined by default, without any seccomp profile applied.
15+
====
16+
17+
[IMPORTANT]
18+
====
19+
Seccomp profiles cannot be applied to privileged containers.
20+
====
21+
22+
include::modules/configuring-default-seccomp-profile.adoc[leveloffset=+1]
23+
24+
[id="custom-seccomp-profile"]
25+
== Configuring a custom seccomp profile
26+
You can configure a custom seccomp profile, which allows you to update the filters based on the application requirements. This allows cluster administrators to have greater control over the security of workloads running in OpenShift Container Platform.
27+
28+
include::modules/setting-custom-seccomp-profile.adoc[leveloffset=+2]
29+
include::modules/applying-custom-seccomp-profile.adoc[leveloffset=+2]
30+
31+
During deployment, the admission controller validates the following:
32+
33+
* The annotations against the current SCCs allowed by the user role.
34+
* The SCC, which includes the seccomp profile, is allowed for the pod.
35+
36+
If the SCC is allowed for the pod, the kubelet runs the pod with the specified seccomp profile.
37+
38+
[IMPORTANT]
39+
====
40+
Ensure that the seccomp profile is deployed to all worker nodes.
41+
====
42+
43+
[NOTE]
44+
====
45+
The custom SCC must have the appropriate priority to be automatically assigned to the pod or meet other conditions required by the pod, such as allowing CAP_NET_ADMIN.
46+
====
47+
48+
49+
[id="additional-resources_configuring-seccomp-profiles"]
50+
== Additional resources
51+
* xref:../authentication/managing-security-context-constraints.adoc[Managing security context constraints]
52+
* xref:../post_installation_configuration/machine-configuration-tasks.adoc[Post-installation machine configuration tasks]

0 commit comments

Comments
 (0)