mirror of
https://github.com/slackhq/nebula.git
synced 2026-11-15 18:26: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
@@ -69,12 +69,15 @@ func TestCommandOutput(t *testing.T) {
|
||||
// help on the clone lists and describes. There is no session to end here.
|
||||
reg := control.Commands().Clone()
|
||||
reg.Register(sshd.LogoutCommand(func() {}))
|
||||
// Dispatch with ssh's default-format policy, so the no-flag column records what an
|
||||
// operator at an ssh prompt sees.
|
||||
reg.DefaultFormat = sshd.DefaultFormat
|
||||
|
||||
// run dispatches as the ssh exec path does and returns the output and the error, which
|
||||
// over ssh is exit status 1.
|
||||
run := func(args ...string) (string, error) {
|
||||
buf := &bytes.Buffer{}
|
||||
err := reg.DispatchArgs(args, commands.NewStringWriter(buf))
|
||||
err := reg.DispatchArgs(args, commands.MergedOutput(buf))
|
||||
return buf.String(), err
|
||||
}
|
||||
|
||||
@@ -94,6 +97,8 @@ func TestCommandOutput(t *testing.T) {
|
||||
{"print-cert", nil},
|
||||
{"print-cert", []string{"-raw"}},
|
||||
{"print-cert", []string{"10.222.0.9"}},
|
||||
// A flag after the operand is still a flag, on both surfaces.
|
||||
{"print-cert", []string{"10.222.0.9", "-json"}},
|
||||
{"print-cert", []string{"10.222.0.250"}},
|
||||
{"print-cert", []string{"not-an-address"}},
|
||||
{"print-tunnel", nil},
|
||||
|
||||
Vendored
+567
-177
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user