Просмотр исходного кода

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>
Matt Richardson 1 день назад
Родитель
Сommit
a2d11717bb
4 измененных файлов с 0 добавлено и 28 удалено
  1. 0 7
      localapi/info.go
  2. 0 4
      localapi/platform_unix.go
  3. 0 5
      localapi/platform_windows.go
  4. 0 12
      localapi/wire.go

+ 0 - 7
localapi/info.go

@@ -64,9 +64,6 @@ var (
 	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
 // 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
@@ -139,10 +136,6 @@ func (s *InfoServer) Rebind(ctx context.Context, path string, acc Access) error
 	s.mu.Lock()
 	defer s.mu.Unlock()
 
-	if !infoSupported {
-		return errInfoUnsupported
-	}
-
 	return s.rebindLocked(ctx, path, acc, func(ln net.Listener) io.Closer {
 		srv := &http.Server{
 			Handler:           s.handler(),

+ 0 - 4
localapi/platform_unix.go

@@ -44,10 +44,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.
 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.
 //
 // Access control is the socket's own mode and group, which the node is created no

+ 0 - 5
localapi/platform_windows.go

@@ -46,11 +46,6 @@ func logListening(l *slog.Logger, path string, acc Access) {
 	)
 }
 
-// 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
 // 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

+ 0 - 12
localapi/wire.go

@@ -194,10 +194,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 {
 	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) {
 		cfg, err := infoConfigFrom(c)
 		if err != nil {
@@ -217,14 +213,6 @@ func wireInfo(ctx context.Context, l *slog.Logger, c *config.C, reg *commands.Re
 			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
 		// 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.