Skip to content

Run as non-root, OpenShift support #185

@kenmoini

Description

@kenmoini

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 runAsUser and runAsGroup parameters 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions