drogue-iot / drogue-cloud

Cloud Native IoT
https://drogue.io
Apache License 2.0
113 stars 30 forks source link

take a look at new pod security warnings #335

Closed ctron closed 1 year ago

ctron commented 1 year ago

When deploying, with OpenShift 4.11, I get the following warning:

W1013 15:29:22.613598  136837 warnings.go:70] would violate PodSecurity "restricted:v1.24": allowPrivilegeEscalation != false (container "service" must set securityContext.allowPrivilegeEscalation=false), unrestricted capabilities (container "service" must set securityContext.capabilities.drop=["ALL"]), runAsNonRoot != true (pod or container "service" must set securityContext.runAsNonRoot=true), seccompProfile (pod or container "service" must set securityContext.seccompProfile.type to "RuntimeDefault" or "Localhost")

I think we need to add the following to all pods:

spec:
  securityContext:
    runAsNonRoot: true
    seccompProfile:
      type: RuntimeDefault
  containers:
    - name: some-container
      securityContext:
        allowPrivilegeEscalation: false
        capabilities:
          drop:
            - ALL

I think we should: