Enum Class MitmServerHandshake

java.lang.Object
java.lang.Enum<MitmServerHandshake>
org.microproxy.MitmServerHandshake
All Implemented Interfaces:
Serializable, Comparable<MitmServerHandshake>, Constable

public enum MitmServerHandshake extends Enum<MitmServerHandshake>
When the proxy runs its TLS handshake with the server for a CONNECT it intercepts: after answering the CONNECT and reading the client's ClientHello, or before answering. A field of a ProtocolPolicy (ProtocolPolicy.mitmServerHandshake()), which a request's filters can override (HttpFilters.proxyToServerMitmHandshake()). Either way, a handshake that fails is one more failed attempt at its route: the next chained proxy (or the direct fallback) the ChainedProxyManager offered is tried, after the RetryBackoff wait, as when the connection itself fails.

Proxy authentication happens on the CONNECT in both: the choice is about what the server's handshake can use and what the client sees when it fails.

  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    The CONNECT is answered once the proxy is connected to the server (or through a chained proxy's tunnel), and the server's handshake waits for the client's ClientHello, so that it can mirror it: the protocols the client offers by ALPN, and the server name it sends when the CONNECT named an IP address.
    The proxy connects and runs the server's handshake before it answers the CONNECT, as LittleProxy does: its ProxyToServerConnection.initializeConnectionFlow runs the server's EncryptChannel step before RespondCONNECTSuccessful, so that its MitmManager.clientSslEngineFor(HttpRequest, SSLSession) has the server's session to make the client's certificate from.
  • Method Summary

    Modifier and Type
    Method
    Description
    parse(String value)
    The value a configuration names: deferred or eager (any case).
    Returns the enum constant of this class with the specified name.
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • DEFERRED

      public static final MitmServerHandshake DEFERRED
      The CONNECT is answered once the proxy is connected to the server (or through a chained proxy's tunnel), and the server's handshake waits for the client's ClientHello, so that it can mirror it: the protocols the client offers by ALPN, and the server name it sends when the CONNECT named an IP address. That ClientHello also decides whether the session is intercepted at all (host rules, MitmManager.shouldIntercept(org.microproxy.ClientHello, org.microproxy.FlowContext), HttpFilters.proxyToServerAllowMitm(ClientHello)), before any handshake with the server. When every route's handshake fails, the client's handshake still completes, with the proxy's certificate, and its first request in the session is answered 502 for the TLS failure (ProxyFailure.TlsFailed); a client whose handshake cannot complete is disconnected. The default.
    • EAGER

      public static final MitmServerHandshake EAGER
      The proxy connects and runs the server's handshake before it answers the CONNECT, as LittleProxy does: its ProxyToServerConnection.initializeConnectionFlow runs the server's EncryptChannel step before RespondCONNECTSuccessful, so that its MitmManager.clientSslEngineFor(HttpRequest, SSLSession) has the server's session to make the client's certificate from. The handshake sends the CONNECT's host (or the request's TlsServerIdentity) as SNI and offers the protocols the proxy would offer on its own (h2 and http/1.1 with HTTP/2 to servers on), since the client's ClientHello has not come yet: neither can be mirrored (a client that then offers only HTTP/1.1 has its requests sent on a second connection that offers what it offered, when the server chose HTTP/2 on the first). A server that speaks no TLS and never answers the proxy's ClientHello holds the CONNECT until the TLS handshake timeout. When every route's handshake fails, the CONNECT itself is answered 502 (ProxyFailure.TlsFailed), and no tunnel opens. A session that the client's ClientHello then decides not to intercept (host rules, the MITM manager, a filter) is tunnelled over a new connection, the one made for the handshake being closed.
  • Method Details

    • values

      public static MitmServerHandshake[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static MitmServerHandshake valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • parse

      public static MitmServerHandshake parse(String value)
      The value a configuration names: deferred or eager (any case).
      Parameters:
      value - the configuration value
      Returns:
      the value it names
      Throws:
      IllegalArgumentException - for any other value