Let an MDM policy set the groups the daemon sockets are restricted to

This commit is contained in:
Viktor Liu
2026-09-08 21:23:08 +02:00
parent b49b5494b4
commit 72bf5adad7
7 changed files with 157 additions and 19 deletions
+8 -2
View File
@@ -16,6 +16,7 @@ import (
"github.com/netbirdio/netbird/client/internal/daemonaddr"
"github.com/netbirdio/netbird/client/internal/ipcauth"
"github.com/netbirdio/netbird/client/mdm"
"github.com/netbirdio/netbird/client/proto"
"github.com/netbirdio/netbird/client/server"
"github.com/netbirdio/netbird/client/system"
@@ -89,12 +90,17 @@ func (p *program) Start(svc service.Service) error {
)
p.serv = grpc.NewServer(opts...)
allowed, err := resolveAllowGroups(allowGroups)
allowed, source, err := daemonSocketPrincipals(mdm.LoadPolicy())
if err != nil {
// Logged as well as returned: the service manager is the only other
// place this surfaces, and it reports a service that will not start
// without saying why. Refusing to serve on a host whose lockdown
// cannot be applied is deliberate, so the reason has to be findable.
log.Errorf("failed to apply the daemon socket restriction, not serving: %v", err)
return err
}
if len(allowed) > 0 {
log.Infof("daemon sockets are restricted to %v", allowed)
log.Infof("daemon sockets are restricted to %v by %s", allowed, source)
}
daemonListener, jsonListener, err := listenDaemonSockets(allowed)