Skip to content

Instantly share code, notes, and snippets.

@shazadbrohi
Last active November 4, 2020 07:53
Show Gist options
  • Save shazadbrohi/5d3871a204b251dd1b4cff1547383686 to your computer and use it in GitHub Desktop.
Save shazadbrohi/5d3871a204b251dd1b4cff1547383686 to your computer and use it in GitHub Desktop.
A restricted pod security policy
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
name: my-restricted-psp
spec:
privileged: false
# Required to prevent escalations to root.
allowPrivilegeEscalation: false
# Allow core volume types.
volumes:
- 'configMap'
- 'emptyDir'
- 'projected'
- 'secret'
- 'downwardAPI'
- 'nfs'
- 'persistentVolumeClaim'
- 'awsElasticBlockStore'
hostNetwork: false
hostIPC: false
hostPID: false
runAsUser:
# Require the container to run without root privileges.
rule: 'RunAsAny'
seLinux:
# This policy assumes the nodes are using AppArmor rather than SELinux.
rule: 'RunAsAny'
supplementalGroups:
rule: 'MustRunAs'
ranges:
# Forbid adding the root group.
- min: 1
max: 65535
fsGroup:
rule: 'MustRunAs'
ranges:
# Forbid adding the root group.
- min: 1
max: 65535
readOnlyRootFilesystem: false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment