Class ServerMonitorAccess

java.lang.Object
com.iizix.server.monitor.ServerMonitorAccess

public final class ServerMonitorAccess extends Object
The rule of who may connect to the Server Monitor's WebSocket /iizi/sm.ws of a development server, in one place (CC-MONITOR-LOOPBACK, order 607's row MS-D-2, ruled 2026-11-11), in the manner VSViewerAccess gates the VSViewer:
  • A production server has no Server Monitor. Its WebSocket is registered by a development server only (JettyRunConfiguration); nothing here changes that.
  • The monitor accepts a connection from the computer the server runs on, and no other. The socket has no sign-in: it sends the server's configuration without its secret values, the list of plug-ins and every session with its user, address, session ID and client environment to whoever connects. A connection is accepted when the remote address of its socket is a loopback address (127.0.0.0/8, ::1), and refused otherwise, with a WARNING line (isAccepted(boolean,IWebSocketComm), logRefused(IWebSocketComm)). THE ONLY enabler for other computers is the system property "iizi.allow.monitor.remote" set to true at the start of the server's JVM (-Diizi.allow.monitor.remote=true).

The address that counts is the socket's own (IWebSocketComm.getSocketAddress()): never a Forwarded, X-Forwarded-For or other header field of the request, which the remote party writes itself. A connection that arrives through a front-end proxy is therefore judged by the proxy's address: a proxy on the server's own computer that forwards the monitor's path opens it to whoever the proxy lets in.

The property is read ONCE, when this class is loaded, which the start of the server does (logAtServerStart(boolean)): setting it in a running server changes nothing.

Author:
Christopher Mindus
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The system property that lets the Server Monitor of a development server accept connections from other computers: iizi.allow.monitor.remote, the value true.
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    Explains in words, for the user of a monitor client (iiziGo's Server Monitor view), a connection the server answered without accepting the monitor's WebSocket: the server refused this computer, or it has no Server Monitor.
    static boolean
    isAccepted(boolean remoteAllowed, IWebSocketComm comm)
    Checks if a connection to the Server Monitor is accepted: every connection of a server started with "iizi.allow.monitor.remote", otherwise a connection from this computer only (isLoopback(IWebSocketComm)).
    static boolean
    Checks if a connection comes from this computer: the remote address of its socket is a loopback address, 127.0.0.0/8 or ::1 (an IPv4-mapped IPv6 address counts as its IPv4 address).
    static boolean
    Checks if this server's Server Monitor accepts connections from other computers: the property "iizi.allow.monitor.remote" as it was at the start of the JVM.
    static void
    logAtServerStart(boolean hasMonitor)
    Logs at the start of the server who may connect to its Server Monitor, and loads this class, which reads the property "iizi.allow.monitor.remote".
    static void
    Logs the refusal of a connection to the Server Monitor: ONE WARNING line per remote address in REFUSAL_LOG_INTERVAL, which names the address and the start option and nothing of the request (no query, no header, no session).
  • Field Details

    • ALLOW_REMOTE_PROPERTY

      public static final String ALLOW_REMOTE_PROPERTY
      The system property that lets the Server Monitor of a development server accept connections from other computers: iizi.allow.monitor.remote, the value true. The only enabler; without effect on a production server.
      See Also:
  • Method Details

    • isRemoteAllowed

      public static boolean isRemoteAllowed()
      Checks if this server's Server Monitor accepts connections from other computers: the property "iizi.allow.monitor.remote" as it was at the start of the JVM.
      Returns:
      true when other computers are accepted.
    • logAtServerStart

      public static void logAtServerStart(boolean hasMonitor)
      Logs at the start of the server who may connect to its Server Monitor, and loads this class, which reads the property "iizi.allow.monitor.remote".
      Parameters:
      hasMonitor - true for a server that has a Server Monitor: a development server.
    • isAccepted

      public static boolean isAccepted(boolean remoteAllowed, IWebSocketComm comm)
      Checks if a connection to the Server Monitor is accepted: every connection of a server started with "iizi.allow.monitor.remote", otherwise a connection from this computer only (isLoopback(IWebSocketComm)).
      Parameters:
      remoteAllowed - Whether the server accepts other computers (isRemoteAllowed()).
      comm - The WebSocket of the connection, null for none.
      Returns:
      true when the connection is accepted, false when it is refused.
    • isLoopback

      public static boolean isLoopback(IWebSocketComm comm)
      Checks if a connection comes from this computer: the remote address of its socket is a loopback address, 127.0.0.0/8 or ::1 (an IPv4-mapped IPv6 address counts as its IPv4 address). Only where the WebSocket has no socket address is the remote address it reports as text read instead (IWebSocketComm.getRemoteAddr(), the address of the same socket). Nothing a request header says is read. An unknown address is not a loopback address.
      Parameters:
      comm - The WebSocket of the connection, null for none.
      Returns:
      true for a connection from a loopback address.
    • logRefused

      public static void logRefused(IWebSocketComm comm)
      Logs the refusal of a connection to the Server Monitor: ONE WARNING line per remote address in REFUSAL_LOG_INTERVAL, which names the address and the start option and nothing of the request (no query, no header, no session). Further refusals of the same address in that time are counted, and the next line says how many there were.
      Parameters:
      comm - The WebSocket of the refused connection, null for none.
    • explainRefusedConnection

      public static String explainRefusedConnection(Throwable e)
      Explains in words, for the user of a monitor client (iiziGo's Server Monitor view), a connection the server answered without accepting the monitor's WebSocket: the server refused this computer, or it has no Server Monitor. Any other failure (no answer, a refused TCP connection, a broken link) is not explained here.
      Parameters:
      e - The failure the client's connection reported, null for none.
      Returns:
      The explanation, several sentences; null when the failure is not an upgrade the server answered and did not accept.