Package org.microproxy.tls
Class CertificateAuthorityMitmManager
java.lang.Object
org.microproxy.tls.CertificateAuthorityMitmManager
- All Implemented Interfaces:
MitmManager
A
MitmManager that impersonates servers with certificates issued on demand by a CertificateAuthority. Each certificate covers the CONNECT host plus the DNS names and IP
addresses in the real server's certificate. Certificates are cached per host in a bounded LRU
cache and re-issued after a day, well before they expire.-
Constructor Summary
ConstructorsConstructorDescriptionIntercepts withauthority, validating real servers against the JDK trust store.CertificateAuthorityMitmManager(CertificateAuthority authority, SSLContext upstreamContext) Creates an interception manager using this CA and upstream TLS context.CertificateAuthorityMitmManager(CertificateAuthority authority, SSLContext upstreamContext, int maxCachedHosts) Creates an interception manager using this CA and upstream TLS context. -
Method Summary
Modifier and TypeMethodDescriptionintReturns number of hosts with a cached certificate.clientSslContextFor(HttpRequest connectRequest, SSLSession serverSslSession) TLS configuration presented to the client (proxy is TLS server), typically holding a certificate for the requested host signed by a CA the client trusts.Returns the authority used to issue interception certificates.keyMaterialFor(String host) A certificate forhostissued by this manager's CA, with its private key: what the HTTP/3 listener of a reverse proxy presents (HttpProxyServerBootstrap.withHttp3(boolean)) when the proxy has no TLS listener of its own.serverSslContext(String peerHost, int peerPort) TLS configuration for the proxy's connection to the real server (proxy is TLS client).Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.microproxy.MitmManager
clientSslContextFor, configureServerSocket, configureServerSocket, forConnection, serverSslContext, serverTrustManager, shouldIntercept
-
Constructor Details
-
CertificateAuthorityMitmManager
Intercepts withauthority, validating real servers against the JDK trust store.- Parameters:
authority- the CA used to issue interception certificates
-
CertificateAuthorityMitmManager
Creates an interception manager using this CA and upstream TLS context.- Parameters:
authority- the CA used to issue interception certificatesupstreamContext- how real servers are validated, e.g.SslContexts.trustAll()to accept any server
-
CertificateAuthorityMitmManager
public CertificateAuthorityMitmManager(CertificateAuthority authority, SSLContext upstreamContext, int maxCachedHosts) Creates an interception manager using this CA and upstream TLS context.- Parameters:
authority- the CA used to issue interception certificatesupstreamContext- the TLS context used to validate real serversmaxCachedHosts- how many hosts' certificates to keep (least recently used are dropped)
-
-
Method Details
-
keyMaterialFor
A certificate forhostissued by this manager's CA, with its private key: what the HTTP/3 listener of a reverse proxy presents (HttpProxyServerBootstrap.withHttp3(boolean)) when the proxy has no TLS listener of its own. Cached per host like the interception certificates, and re-issued after a day.- Parameters:
host- the DNS name or IP literal the certificate is for- Returns:
- the certificate, followed by the CA's, and its key
-
cachedHostCount
public int cachedHostCount()Returns number of hosts with a cached certificate.- Returns:
- number of hosts with a cached certificate
-
getCertificateAuthority
Returns the authority used to issue interception certificates.- Returns:
- the authority used to issue interception certificates
-
serverSslContext
Description copied from interface:MitmManagerTLS configuration for the proxy's connection to the real server (proxy is TLS client).- Specified by:
serverSslContextin interfaceMitmManager- Parameters:
peerHost- the real server host namepeerPort- the real server port- Returns:
- the TLS context used towards the real server
-
clientSslContextFor
Description copied from interface:MitmManagerTLS configuration presented to the client (proxy is TLS server), typically holding a certificate for the requested host signed by a CA the client trusts.- Specified by:
clientSslContextForin interfaceMitmManager- Parameters:
connectRequest- the client's CONNECT requestserverSslSession- the established session with the real server- Returns:
- the TLS context presented to the client
-