PageViews: 4,901 hits / 445 nets

DeleGate as a Man-In-The-Middle proxy

Yutaka Sato
July 5, 2006

( Note that this feature is available only in the binary distributions. )

Peeping the encrypted communication in HTTPS/SSL as a HTTP proxy becomes necessary in several situations. If the peeping is done by stealth by a malicious third party, it should be prevented as Man-In-The-Middle attack. But if it is done by the same party including the user of the client, it can be a useful feature.

Configuring DeleGate as a HTTP proxy to do such peeping has become easy in the version 9.2.3, with a STLS option just as: By this option, all of HTTPS/SSL communications relayed on it become peepable. The following is an example of a HTTP proxy to peep the HTTPS/SSL request messages toward the server. Another mode of MITM by DeleGate is doing it only when it is explicitly requested to do MITM by the client. This mode is enabled with STLS=-mitm option and a special format of URL specified by the client. The current implementation of MITM of DeleGate is slow due to Keep-Alive handling with SSL peeping. It will be improved in the next version. The performance of MITM for HTTP in 9.2.3 was about ten times slower than that without MITM, because of disabled HTTP Keep-Alive in MITM, lacking SSL session cache with servers, and so on. These were implemented in 9.2.4 to improve the performance five times. Now the performance with STLS=mitm is about twice slower than without MITM. (but STLS=-mitm in 9.2.4 is still slow because of disabled Keep-Alive to escape a problem around rewriting URLs ...)

( excerpt from the reference manual )

DeleGate reference manual version 9.9 / <A Href=/delegate/Manual.htm?TLS id=hgen>TLS</A> negotiation control
[CTX] [ALL] TLS negotiation control
STLS parameter*     ==  STLS=stlsSpecs[,sslwayCom][:connMap]
         stlsSpecs  ==  [-]stlsSpec[/im][/ssl][,stlsSpecs]
          stlsSpec  ==  fsv | fcl | mitm | imimSec
         sslwayCom  ==  {sslway [-Vrfy] [-CApath dir] ...}
           connMap  ==  ProtoList:dstHostList:srcHostList
                    --  default: none
                    --  restriction: applicable to HTTP, FTP, SMTP, POP, IMAP, SOCKS
                    --  required: SSLway
    This parameter controls the initiation of SSL (TLS) based on a negotiation between client and server in each application protocol. The common scheme of the negotiation is known as "STARTTLS". "fsv" specifies using SSL with server and "fcl" specifies using SSL with client. When SSL is not supported on a connection, the STARTTLS negotiation will fail and the connection will be closed by default. To continue a session even when SSL is not available, prefix "-" to "fsv" or "fcl".

    If "fcl" is specified, a client may start SSL without STARTTLS negotiation. Such implicit SSL negotiation from the client-side is detected by peeping a SSL hand-shake packet on the connection from the client-side at the beginning of a session for a certain period specified with imimSec. The default value is "im0.25" (250m seconds). "-im" disables this implicit SSL negotiation. If a stlsSpec is followed with "/im" as STLS="fsv/im" for example, SSL with the peer (with the server in this case) is applied without the STARTTLS negotiation.

    If "mitm" is specified, it behaves like "-fcl,-fsv" that is if SSL is enabled in the client side then SSL on the server side is enabled. It can be used with a HTTP proxy DeleGate as a "secure proxy" or "SSL-tunnel" to peep the bidirectional communication in CONNECT method, relaying it as a usual HTTP applying filters and cache. ("mitm" means "Man-In-The-Middle" mode) If it is set optional as "STLS=-mitm" then the MITM mode is activated only when the client specified the server name prefixing with "-mitm." as "" for "https://host.domain/".

    If non default SSLway command path or options are necessary to be used, the SSLway command can be specified after stlsSpecs as STLS="fcl,sslway -Vrfy -cert mycert.pem" for example.


      STLS="fcl" -- use SSL with client (exit the session if not available)
      STLS="-fcl" -- use SSL with client if available
      STLS="fsv,-fcl" -- use SSL with server, and with client if available
      STLS="fsv/ssl" SERVER="ftp" -- use AUTH SSL instead of AUTH TLS
      STLS="fsv,im0.5" SERVER="ftp" -- automatic detection of implicit/explicit SSL server

PageViews: 4,901 hits / 445 nets