[client] Improve error surfacing for restricted daemon sockets (#7704)

* Add probe for daemon restriction and improve error surfacing
This commit is contained in:
Theodor Midtlien
2026-10-23 11:38:26 +02:00
committed by GitHub
parent c75f272252
commit e13dbe8cb4
36 changed files with 646 additions and 70 deletions
+15
View File
@@ -14,6 +14,21 @@ import (
"github.com/netbirdio/netbird/client/internal/ipcauth"
)
// errDaemonAccessDenied reports that the daemon socket refuses this user.
var errDaemonAccessDenied = errors.New("this account is not allowed to use the NetBird daemon on this device: " +
"an administrator restricted it to other users or groups")
// daemonConnectError explains a failed dial.
func daemonConnectError(err error) error {
if errors.Is(err, errDaemonAccessDenied) {
return err
}
// nolint
return fmt.Errorf("failed to connect to daemon error: %w\n"+
"If the daemon is not running please run: "+
"\nnetbird service install \nnetbird service start\n", err)
}
// daemonCallError adds the context a failed daemon call happened in.
func daemonCallError(context string, err error) error {
return fmt.Errorf("%s: %w", context, err)