openshift / cluster-etcd-operator

Operator to manage the lifecycle of the etcd members of an OpenShift cluster
Apache License 2.0
96 stars 130 forks source link

Access to a privileged container allows for breakout to the underlying host #1181

Closed lance5890 closed 7 months ago

lance5890 commented 10 months ago
  1. I have seen many ocp containers have set the ""privileged": true"

        "terminationMessagePolicy": "FallbackToLogsOnError",
        "imagePullPolicy": "IfNotPresent",
        "securityContext": {
          "privileged": true
        }
  2. I just wonder why should the etcd containerd should set the "privileged": true flag. compared to the kubeadm installation, the etcd container has not this flag

  3. when using standard container runtimes (for example ContainerD or CRI-O) access to a privileged container allows for easy breakout to the underlying host, which in turn allows for access to all other workloads on that host and credentials for the node agent (Kubelet)

lance5890 commented 10 months ago

@Elbehery @tjungblu

tjungblu commented 10 months ago

I just wonder why should the etcd containerd should set the "privileged": true flag.

because we write the etcd data dir onto a hostPath, which requires this unfortunately.

lance5890 commented 10 months ago

I just wonder why should the etcd containerd should set the "privileged": true flag.

because we write the etcd data dir onto a hostPath, which requires this unfortunately.

1 but even without the 'privileged: true', the etcd can also write to /var/lib/etcd 2 as the etcd container run as root by default

tjungblu commented 10 months ago

I doubt that you can just mount /var/lib/etcd on the host without it. But feel free to try, you already know how to run PRs. Plenty of detail around this in https://kubernetes.io/docs/concepts/storage/volumes/#hostpath

lance5890 commented 10 months ago

I doubt that you can just mount /var/lib/etcd on the host without it. But feel free to try, you already know how to run PRs. Plenty of detail around this in https://kubernetes.io/docs/concepts/storage/volumes/#hostpath

can I join the cluster-etcd-operator as a member ? that would be my honor

tjungblu commented 10 months ago

Unless you're at RedHat and can authenticate via our SSO the automation won't be able to add you :) But I'm happy to give you the ok-to-test label to try it out.