mirror of
https://github.com/slackhq/nebula.git
synced 2026-11-17 02:16:52 +01:00
Drop the flag that said the info API was not served on windows
It is served there now, on a pipe, so nothing set the flag any more. It was also a plain bool written by the first reconcile and by the reload callback, which was the review's point about it. - infoSupported, errInfoUnsupported, the Rebind check and the reload branch that warned once go Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
3fb29d6444
commit
aa04cc446a
4 files changed
-28
No files matched your search
@@ -64,9 +64,6 @@ var (
|
|||||||
infoReadTimeout = 15 * time.Second
|
infoReadTimeout = 15 * time.Second
|
||||||
)
|
)
|
||||||
|
|
||||||
// errInfoUnsupported is returned by Rebind on a platform without a socket mode to open.
|
|
||||||
var errInfoUnsupported = errors.New("the info API is not available on this platform")
|
|
||||||
|
|
||||||
// servedOnInfo decides what the info API will run: the commands that report identity
|
// servedOnInfo decides what the info API will run: the commands that report identity
|
||||||
// and nothing else, which the commands declare about themselves. Filter adds help to
|
// and nothing else, which the commands declare about themselves. Filter adds help to
|
||||||
// the result, so a client can ask what is served; help on a filtered registry describes
|
// the result, so a client can ask what is served; help on a filtered registry describes
|
||||||
@@ -123,10 +120,6 @@ func (s *InfoServer) Rebind(ctx context.Context, path string, acc Access) error
|
|||||||
s.mu.Lock()
|
s.mu.Lock()
|
||||||
defer s.mu.Unlock()
|
defer s.mu.Unlock()
|
||||||
|
|
||||||
if !infoSupported {
|
|
||||||
return errInfoUnsupported
|
|
||||||
}
|
|
||||||
|
|
||||||
return s.rebindLocked(ctx, path, acc, func(ln net.Listener) io.Closer {
|
return s.rebindLocked(ctx, path, acc, func(ln net.Listener) io.Closer {
|
||||||
srv := &http.Server{
|
srv := &http.Server{
|
||||||
Handler: s.handler(),
|
Handler: s.handler(),
|
||||||
|
|||||||
@@ -43,10 +43,6 @@ func withPeerFD(conn net.Conn, f func(fd int) error) error {
|
|||||||
// in for root, or for a stranger, without owning a second account on the host.
|
// in for root, or for a stranger, without owning a second account on the host.
|
||||||
var currentUID = func() uint32 { return uint32(os.Geteuid()) }
|
var currentUID = func() uint32 { return uint32(os.Geteuid()) }
|
||||||
|
|
||||||
// infoSupported reports that the info API can be served here: a unix socket takes the
|
|
||||||
// mode an operator configures, which is the whole of its access control.
|
|
||||||
const infoSupported = true
|
|
||||||
|
|
||||||
// listen binds the socket at path with the given access.
|
// listen binds the socket at path with the given access.
|
||||||
//
|
//
|
||||||
// Access control is the socket's own mode and group, which the node is created no
|
// Access control is the socket's own mode and group, which the node is created no
|
||||||
|
|||||||
@@ -33,11 +33,6 @@ const network = "pipe"
|
|||||||
// exists so a Server is built the same way on every platform.
|
// exists so a Server is built the same way on every platform.
|
||||||
var currentUID = func() uint32 { return 0 }
|
var currentUID = func() uint32 { return 0 }
|
||||||
|
|
||||||
// infoSupported is true here: the pipe's security descriptor is what a mode is on unix,
|
|
||||||
// and the group an operator names in the config is the way to open it to other
|
|
||||||
// accounts, as it is for the control pipe. The mode itself means nothing to a pipe.
|
|
||||||
const infoSupported = true
|
|
||||||
|
|
||||||
// listen creates the named pipe at path with a security descriptor that admits the user
|
// listen creates the named pipe at path with a security descriptor that admits the user
|
||||||
// nebula runs as, SYSTEM and Administrators, and the group acc names, if any, for
|
// nebula runs as, SYSTEM and Administrators, and the group acc names, if any, for
|
||||||
// reading and writing, which is what connecting to a pipe takes. acc's mode means
|
// reading and writing, which is what connecting to a pipe takes. acc's mode means
|
||||||
|
|||||||
@@ -200,10 +200,6 @@ func reportRebind(l *slog.Logger, what, old, want string, err error, now string)
|
|||||||
func wireInfo(ctx context.Context, l *slog.Logger, c *config.C, reg *commands.Registry) *InfoServer {
|
func wireInfo(ctx context.Context, l *slog.Logger, c *config.C, reg *commands.Registry) *InfoServer {
|
||||||
srv := NewInfoServer(l, reg)
|
srv := NewInfoServer(l, reg)
|
||||||
|
|
||||||
// Said once per process rather than on every reload: it is a platform limit, not
|
|
||||||
// something the next reload could fix.
|
|
||||||
saidUnsupported := false
|
|
||||||
|
|
||||||
reconcile := func(c *config.C) {
|
reconcile := func(c *config.C) {
|
||||||
cfg, err := infoConfigFrom(c)
|
cfg, err := infoConfigFrom(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -219,14 +215,6 @@ func wireInfo(ctx context.Context, l *slog.Logger, c *config.C, reg *commands.Re
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !infoSupported {
|
|
||||||
if !saidUnsupported {
|
|
||||||
l.Warn("Local info API is enabled in the config but is not served on this platform yet", "key", InfoEnabledKey)
|
|
||||||
saidUnsupported = true
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// The two endpoints speak different protocols; one socket cannot be both. Caught
|
// The two endpoints speak different protocols; one socket cannot be both. Caught
|
||||||
// here, from the configured paths, because listen's own answer, that the socket is
|
// here, from the configured paths, because listen's own answer, that the socket is
|
||||||
// in use by another nebula, would send the operator looking for a second process.
|
// in use by another nebula, would send the operator looking for a second process.
|
||||||
|
|||||||
Reference in new issue
Block a user