Pod Security Admission Integration
by Stanislav Láznička
1
CONFIDENTIAL Designator
Feature Use Case
Use cases
Non-Goals
CONFIDENTIAL Designator
Global Pod Security Admission Configuration
apiVersion: pod-security.admission.config.k8s.io/v1beta1�kind: PodSecurityConfiguration
defaults:
enforce: "privileged"
enforce-version: "latest"
audit: "restricted"
audit-version: "latest"
warn: "restricted"
warn-version: "latest"
exemptions:
usernames:
- system:serviceaccount:openshift-infra:build-controller
CONFIDENTIAL Designator
OpenShift Automated Pod Security Namespace Labeling
CONFIDENTIAL Designator
New SCCs
CONFIDENTIAL Designator
Demo
kind: Pod
apiVersion: v1
metadata:
name: mypod-p
spec:
restartPolicy: Never
containers:
- name: fedora
image: fedora:latest
command:
- sleep
args:
- "infinity"
securityContext:
privileged: true
The next slide will show a set of commands that allow working more closely with the pod security admission and the label synchronization mechanism in 4.11
The following pod manifest is used as the privileged pod in the example:
CONFIDENTIAL Designator
Demo
$ oc new-project demo # create a new project
$ oc get ns demo -oyaml
apiVersion: v1
kind: Namespace
metadata:
annotations:
openshift.io/description: ""
openshift.io/display-name: ""
openshift.io/requester: system:admin
openshift.io/sa.scc.mcs: s0:c26,c10
openshift.io/sa.scc.supplemental-groups: 1000670000/10000
openshift.io/sa.scc.uid-range: 1000670000/10000
creationTimestamp: "2022-06-08T15:39:42Z"
labels:
kubernetes.io/metadata.name: demo
pod-security.kubernetes.io/audit: restricted
pod-security.kubernetes.io/audit-version: v1.24
pod-security.kubernetes.io/warn: restricted
pod-security.kubernetes.io/warn-version: v1.24
name: demo
resourceVersion: "30293"
uid: c89c78b5-adc0-4aa7-b475-2e23e41e8884
spec:
finalizers:
- kubernetes
status:
phase: Activ
$ # the next command will print a warning, the label selector correctly evaluated the NS to be restricted according to the SA permissions but we are applying pod directly as a privileged user
$ oc create pod -f ~/privileged_pod.yaml
Warning: would violate PodSecurity "restricted:v1.24": privileged (container "fedora" must not set securityContext.privileged=true), allowPrivilegeEscalation != false (container "fedora" must set securityContext.allowPrivilegeEscalation=false), unrestricted capabilities (container "fedora" must set securityContext.capabilities.drop=["ALL"]), runAsNonRoot != true (pod or container "fedora" must set securityContext.runAsNonRoot=true), seccompProfile (pod or container "fedora" must set securityContext.seccompProfile.type to "RuntimeDefault" or "Localhost")
pod/mypod-p created
$ # opt the namespace out of the labelsync
$ oc label ns demo --overwrite \
security.openshift.io/scc.podSecurityLabelSync=false \
pod-security.kubernetes.io/audit=privileged \
pod-security.kubernetes.io/warn=privileged
$
$ oc delete pods --all
$ # the following command no longer prints warnings as we configured PSa warnings and audits to privileged level
$ oc create pod -f ~/privileged_pod.yaml
pod/mypod-p created
$ oc label ns demo \
pod-security.kubernetes.io/audit- \
pod-security.kubernetes.io/audit-version- \
pod-security.kubernetes.io/warn- \
pod-security.kubernetes.io/warn-version-
$
$ oc delete pods –all
$ # the following command prints the warning as the namespace now uses the global configuration
$ oc create pod -f ~/privileged_pod.yaml
Warning: would violate PodSecurity "restricted:latest": privileged (container "fedora" must not set securityContext.privileged=true), allowPrivilegeEscalation != false (container "fedora" must set securityContext.allowPrivilegeEscalation=false), unrestricted capabilities (container "fedora" must set securityContext.capabilities.drop=["ALL"]), runAsNonRoot != true (pod or container "fedora" must set securityContext.runAsNonRoot=true), seccompProfile (pod or container "fedora" must set securityContext.seccompProfile.type to "RuntimeDefault" or "Localhost")
pod/mypod-p created
CONFIDENTIAL Designator
Documentation
CONFIDENTIAL Designator
Testing
CONFIDENTIAL Designator
Other Topics
Known Issues
Additional resources
The label synchronization is based on ServiceAccounts. Users with higher SCC privileges than any SA for a given NS might be prevented from directly creating a pod in such a namespace when such a pod would be more privileged than the namespace PSa level.
CONFIDENTIAL Designator
Managing seccomp and SELinux policies with Security Profiles Operator
Presenter: Jakub Hrozek, ISC team
11
CONFIDENTIAL Designator
[SPO] Security Profile Operator
CONFIDENTIAL Designator
The Use Case for Security Profiles
CONFIDENTIAL Designator
The Use Case for Security Profiles Operator
CONFIDENTIAL Designator
Feature Use Case
CONFIDENTIAL Designator
Making profile installation and usage easier
CONFIDENTIAL Designator
Making profile creation easier
CONFIDENTIAL Designator
Installation and configuration
CONFIDENTIAL Designator
API overview
CONFIDENTIAL Designator
API usage: create a profile
$ cat <<EOF | oc create -f -
apiVersion: security-profiles-operator.x-k8s.io/v1beta1
kind: SeccompProfile
metadata:
namespace: my-namespace
name: profile1
spec:
defaultAction: SCMP_ACT_LOG
EOF
CONFIDENTIAL Designator
API usage: observe a profile
CONFIDENTIAL Designator
API usage: take a profile into use
spec:
securityContext:
seccompProfile:
type: Localhost
localhostProfile: operator/my-namespace/profile1.json
CONFIDENTIAL Designator
API usage: record a profile
spec:
securityContext:
seccompProfile:
type: Localhost
localhostProfile: operator/my-namespace/profile1.json
CONFIDENTIAL Designator
API usage: bind a profile to an image
apiVersion: security-profiles-operator.x-k8s.io/v1beta1
kind: ProfileBinding
metadata:
name: nginx-binding
spec:
profileRef:
kind: SeccompProfile
name: profile-complain
image: nginx:1.19.1
CONFIDENTIAL Designator
Architecture overview
Security-profiles-operator
SPOD DS pod (node1)
SPOD DS pod (node2)
seccomp-controller
Selinux-controller
selinuxd
seccomp-controller
Selinux-controller
selinuxd
Audit log parser
Profile recorder
Audit log parser
Profile recorder
spod/spod
SPO
Webhook
binding
recording
CONFIDENTIAL Designator
TIP: If needed cover this section in multiple slides!
DEMO
Show off the awesome work you/your team did, and explain how awesome this feature is!
CONFIDENTIAL Designator
Known issues and gotchas
CONFIDENTIAL Designator
Links and documentation
CONFIDENTIAL Designator
Testing
CMP-1091 Make Security Profiles Operator a part of OpenShift�Test cases are available at link�Test scenarios:
:
�
CONFIDENTIAL Designator
Enable the RuntimeDefault seccomp profile in OpenShift for all workloads
Presenter: PETER HUNT
30
CONFIDENTIAL Designator
Feature Use Case
TIP: If needed cover this section in multiple slides!
CONFIDENTIAL Designator
Overview
TIP: If needed cover this section in multiple slides!
CONFIDENTIAL Designator
Unshare
TIP: If needed cover this section in multiple slides!
CONFIDENTIAL Designator
Documentation
CONFIDENTIAL Designator
Testing
TIP: QE can help you fill out this slide! Talk to your testers to assist with filling out this slide.
CONFIDENTIAL Designator
Other Topics
Online First
Known Issues
Troubleshooting
TIP: Use this slide to cover other topics or facilitate conversation.
Use this slide to explain how this feature is working in online, and or what issues were are seeing!
Use this slide to explain how to debug/ troubleshoot this feature!
CONFIDENTIAL Designator