Enum Class ProxyFailure.TlsFailed.Reason

java.lang.Object
java.lang.Enum<ProxyFailure.TlsFailed.Reason>
org.microproxy.ProxyFailure.TlsFailed.Reason
All Implemented Interfaces:
Serializable, Comparable<ProxyFailure.TlsFailed.Reason>, Constable
Enclosing class:
ProxyFailure.TlsFailed

public static enum ProxyFailure.TlsFailed.Reason extends Enum<ProxyFailure.TlsFailed.Reason>
Why a TLS handshake failed, read from the exception's cause chain: the certificate checks first, then an alert from the peer, a timeout, or anything else. code() is the snake_case name the access log's %UPSTREAM_TRANSPORT_FAILURE_REASON% starts with.
  • Enum Constant Details

    • CERTIFICATE_EXPIRED

      public static final ProxyFailure.TlsFailed.Reason CERTIFICATE_EXPIRED
      The certificate (or one in its chain) has expired.
    • CERTIFICATE_NOT_YET_VALID

      public static final ProxyFailure.TlsFailed.Reason CERTIFICATE_NOT_YET_VALID
      The certificate (or one in its chain) is not valid yet.
    • CERTIFICATE_REVOKED

      public static final ProxyFailure.TlsFailed.Reason CERTIFICATE_REVOKED
      The certificate was revoked: a CRL or an OCSP response said so.
    • REVOCATION_STATUS_UNKNOWN

      public static final ProxyFailure.TlsFailed.Reason REVOCATION_STATUS_UNKNOWN
      Revocation checking was required, but no CRL or OCSP response could tell.
    • CERTIFICATE_UNTRUSTED

      public static final ProxyFailure.TlsFailed.Reason CERTIFICATE_UNTRUSTED
      The chain does not lead to a trusted anchor, or failed another validation check.
    • HOSTNAME_MISMATCH

      public static final ProxyFailure.TlsFailed.Reason HOSTNAME_MISMATCH
      The certificate is trusted, but not valid for the host name it was checked against.
    • ALERT_RECEIVED

      public static final ProxyFailure.TlsFailed.Reason ALERT_RECEIVED
      The peer ended the handshake with an alert (ProxyFailure.TlsFailed.alert() names it).
    • TIMEOUT

      public static final ProxyFailure.TlsFailed.Reason TIMEOUT
      The handshake did not finish within the handshake timeout.
    • CLOSED_BEFORE_CLIENT_HELLO

      public static final ProxyFailure.TlsFailed.Reason CLOSED_BEFORE_CLIENT_HELLO
      The connection was reset (or failed otherwise) before the proxy could send its ClientHello: the handshake's first write failed (ClientHelloNotSentException in the cause chain). Through a chained proxy, the proxy (or the server behind it) ended the tunnel right after answering the CONNECT. A connection that was only closed, not reset, still takes the ClientHello, and is CLOSED_DURING_HANDSHAKE.
    • CLOSED_DURING_HANDSHAKE

      public static final ProxyFailure.TlsFailed.Reason CLOSED_DURING_HANDSHAKE
      The peer closed or reset the connection during the handshake, after the proxy's ClientHello, without sending an alert: the JDK's "Remote host terminated the handshake", a "Connection reset", an EOFException. Through a chained proxy, the chained proxy and the server behind it cannot be told apart: the proxy relays the server's end of the connection.
    • OTHER

      public static final ProxyFailure.TlsFailed.Reason OTHER
      Anything else: no common protocol version or cipher suite, ...
  • Method Details

    • values

      public static ProxyFailure.TlsFailed.Reason[] 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 ProxyFailure.TlsFailed.Reason 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
    • code

      public String code()
      Returns the reason's name in lower case: certificate_revoked, ....
      Returns:
      the reason's name in lower case: certificate_revoked, ...
    • of

      public static ProxyFailure.TlsFailed.Reason of(Throwable failure)
      Classifies a failed handshake by its exception's cause chain. A CertPathValidatorException with a CertPathValidatorException.BasicReason, a CertificateExpiredException, CertificateNotYetValidException or CertificateRevokedException anywhere in it says what was wrong with the certificate (the innermost specific one wins); any other certificate path failure means it is not trusted; a host name check that failed says so in its message (the JDK's "No subject alternative ... matching ..."); and the JDK reports an alert from the peer as "Received fatal alert: <description>". A timeout comes next; then a connection the peer ended without an alert: an EOFException, a reset or broken pipe, or the JDK's "Remote host terminated the handshake" (CLOSED_BEFORE_CLIENT_HELLO when the ClientHello could not be sent, else CLOSED_DURING_HANDSHAKE). A socket the proxy closed itself ("Socket closed") is none of these.
      Parameters:
      failure - the handshake's exception, or null
      Returns:
      the reason, OTHER when none is recognized
    • alertOf

      public static String alertOf(Throwable failure)
      The description of the alert the peer ended a handshake with, as the JDK reports it: "Received fatal alert: unrecognized_name", or "Received handshake warning: ..." for a warning it does not accept during a handshake.
      Parameters:
      failure - the handshake's exception, or null
      Returns:
      the alert's description, such as "unrecognized_name", or null