-
Notifications
You must be signed in to change notification settings - Fork 52
Description
Problem Statement:
As a best practice, it's not advised to run containers as the root user: https://www.armosec.io/blog/kubernetes-security-best-practices/#limit-application-privileges
This provides a point of privilege escalation that can impact the wider cluster. As a solution to this, platforms such as OpenShift run containers as a random UID/GID unless specified.
When a container is built with the filesystem being owned to the root user, such as /opt/cribl then only the root user can read/write to those locations, so in order to have the container deploy to a Ready state you must run the container as root.
Solution Option(s):
- Ideally the containers have a specific user created with a UID/GID higher than 1000. This requires a rebuild of the Cribl container. Then in the podSecurityContext, you would specify the
runAsUserandrunAsGroupparameters to target that user. - If the containers MUST be run as root, then provide the RoleBinding to allow the containers to run as Privileged containers on OpenShift:
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: crible-priv
namespace: cribl-stream
subjects:
- kind: ServiceAccount
name: ls-wg-pci-logstream-workergroup
namespace: cribl-stream
- kind: ServiceAccount
name: ls-wg-system-metrics-logstream-workergroup
namespace: cribl-stream
- kind: ServiceAccount
name: default
namespace: cribl-stream
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: 'system:openshift:scc:privileged'I don't see the Cribl container source in the GitHub org, otherwise I'd try to provide a patch to this end. Is there any requirement for running as root that is not apparent to me? Thoughts on these options?