crowdsecurity/cs-haproxy-spoa-bouncer

[workers] WorkerManager should keep uid, gid from config

Closed this issue · 2 comments

workerManager := worker.NewManager(ctx, workerServer)

The worker manager should have the uid and gid of the socket permission instead of being set on startup by the config handler.

Reasons:

  • Admin socket can create workers on adhoc basis and needs to be able to set uid, gid on socket.

remove:

for _, w := range config.Workers {
w.Gid = config.WorkerGid
w.Uid = config.WorkerUid
}

Set worker uid and gid here from manager context:

func (m *Manager) AddWorker(w *Worker) {
socketString, err := m.Server.NewWorkerListener(w.Name, w.Gid)
if err != nil {
log.Errorf("failed to create worker listener: %s", err)
return
}
go w.Run(socketString)
m.Workers = append(m.Workers, w)
}