Skip to content

Commit

Permalink
nfs: run dbus-daemon sidecar as dbus user instead of root
Browse files Browse the repository at this point in the history
When the dbus-daemon in the sidecar is started as "root" user, it fails
with the following log entry:

Failed to start message bus: Failed to drop capabilities: Operation not permitted

By starting the sidecar as "dbus" user (uid=81), the executable does not
try to drop capabilities, and starts successfully.

Signed-off-by: Niels de Vos <[email protected]>
(cherry picked from commit 320b112)
(cherry picked from commit 6afe22a)
  • Loading branch information
nixpanic authored and BlaineEXE committed Aug 11, 2023
1 parent ff81035 commit 869976e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/operator/ceph/nfs/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,9 @@ func (r *ReconcileCephNFS) daemonContainer(nfs *cephv1.CephNFS, cfg daemonConfig
func (r *ReconcileCephNFS) dbusContainer(nfs *cephv1.CephNFS) v1.Container {
_, dbusMount := dbusVolumeAndMount()

// uid of the "dbus" user in most (all?) Linux distributions
dbusUID := int64(81)

return v1.Container{
Name: "dbus-daemon",
Command: []string{
Expand All @@ -270,6 +273,9 @@ func (r *ReconcileCephNFS) dbusContainer(nfs *cephv1.CephNFS) v1.Container {
},
Env: k8sutil.ClusterDaemonEnvVars(r.cephClusterSpec.CephVersion.Image), // do not need access to Ceph env vars b/c not a Ceph daemon
Resources: nfs.Spec.Server.Resources,
SecurityContext: &v1.SecurityContext{
RunAsUser: &dbusUID,
},
}
}

Expand Down

0 comments on commit 869976e

Please sign in to comment.