Class FrontEndBindingCheck

java.lang.Object
com.iizix.jetty.FrontEndBindingCheck

public final class FrontEndBindingCheck extends Object
Checks at server start that a port behind a front end is not open beside its front end (CC-FIX-RESET-LINK-BASE, proposal (b)).

A port that is front-end secured (PortConfig.isFrontEndSecured) is meant to be reached through a reverse proxy only. Without a bind address (PortConfig.bind), or with the any-address, WSHelper.createWebServer binds it to every interface of the host, and it is reachable without the proxy as well.

Nothing is changed or refused here: the operator is told, once, at start. The check reads the ports only, so that it is here, with the code that binds them; what the server knows of its front end beyond the ports - the trusted proxies of the server settings - is checked by com.iizix.server.web.FrontEndProxyCheck.

Author:
Christopher Mindus
  • Method Details

    • describeOpenBinding

      public static String describeOpenBinding(PortConfig[] portConfigs)
      Describes the front-end secured ports that are bound to every interface of the host (CC-FIX-RESET-LINK-BASE, proposal (b)). Such a port is reachable without the front-end proxy, from the LAN or from the Internet when the host is exposed: a connection that bypasses the proxy can forge the Host header the server reads the session's external base from (the base of the password reset link), and is believed secure (frontEndSecured) although it is plain HTTP.

      Nothing is changed or refused here: the operator is told, once, at start.

      Parameters:
      portConfigs - The ports of the web server, null for none.
      Returns:
      The warning, or null when no front-end secured port is without a bind address (or bound to the any-address 0.0.0.0 or ::).
    • warnOpenBinding

      public static boolean warnOpenBinding(PortConfig[] portConfigs)
      Logs the warning of describeOpenBinding(PortConfig[]), when there is one.
      Parameters:
      portConfigs - The ports of the web server, null for none.
      Returns:
      true when a warning was logged.