mirror of
https://github.com/slackhq/nebula.git
synced 2026-11-15 20:56:52 +01:00
Add a local control socket and nebula ctl (#1975)
Add support for accessing the previously ssh-only debug commands via `nebula ctl <command>.` - unix socket (named pipe on windows) for communication - sockets scoped to the user + an optional group - in cmd/nebula and cmd/nebula-service, but not nebula.Main Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
9a5bdb508e
commit
0f767ce529
54 files changed
+7581
-925
No files matched your search
@@ -0,0 +1,30 @@
|
||||
//go:build windows
|
||||
|
||||
package localapi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"golang.org/x/sys/windows"
|
||||
)
|
||||
|
||||
// lookupGroupID resolves an account name, local or domain qualified, or a SID written
|
||||
// out, to the SID as a string, which is how the pipe's security descriptor names it.
|
||||
// Any account the host can resolve is accepted, as docker accepts any SID for its -G: a
|
||||
// group is the natural thing to name, but the descriptor does not care.
|
||||
func lookupGroupID(name string) (string, error) {
|
||||
if strings.HasPrefix(strings.ToUpper(name), "S-1-") {
|
||||
sid, err := windows.StringToSid(name)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("%q is not a SID: %w", name, err)
|
||||
}
|
||||
return sid.String(), nil
|
||||
}
|
||||
|
||||
sid, _, _, err := windows.LookupSID("", name)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("account %q does not exist on this host: %w", name, err)
|
||||
}
|
||||
return sid.String(), nil
|
||||
}
|
||||
Reference in new issue
Block a user