Ssl – Squid SSL Bump TAG_NONE / HEIR_NONE

squidssltransparent-proxy

I have a transparent proxy, Squid, version 3.5.20 (latest stable at this time)
I need to do domain whitelisting. Squid is configured to do SSLBumping (see squid config below)

I try to install Sumologic on a server which is located behind the squid transparent NAT.

The problem is that sumologic cannot connect out through the transparent NAT. Why can't it connect through the app, but I can using curl?

When I install Sumologic, I get the following error:

javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
    at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
    at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:394)
    at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:353)
    at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:141)
    at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
    at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
    at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
    at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
    at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
    at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
    at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:107)
    at com.sumologic.scala.collector.rest.RestClient$class.getResponse(RestClient.scala:83)
    at com.sumologic.scala.collector.rest.RestClient$class.makeGetRequest(RestClient.scala:68)
    at com.sumologic.scala.collector.auth.CollectorRegistrationManager.makeGetRequest(CollectorRegistrationManager.scala:49)
    at com.sumologic.scala.collector.rest.RestClient$class.makeRequest(RestClient.scala:119)
    at com.sumologic.scala.collector.auth.CollectorRegistrationManager.com$sumologic$scala$collector$rest$RestClientRetries$$super$makeRequest(CollectorRegistrationManager.scala:49)
    at com.sumologic.scala.collector.rest.RestClientRetries$$anonfun$makeRequest$1.apply(RestClientRetries.scala:42)
    at com.sumologic.scala.collector.rest.RestClientRetries$$anonfun$makeRequest$1.apply(RestClientRetries.scala:35)
    at com.sumologic.util.retry.Retry$.whileExceptionsAreThrown(Retry.scala:143)
    at com.sumologic.scala.collector.rest.RestClientRetries$$anonfun$withRetries$1.apply(RestClientRetries.scala:23)
    at com.sumologic.scala.collector.rest.RestClientRetries$$anonfun$withRetries$1.apply(RestClientRetries.scala:23)
    at com.sumologic.scala.collector.rest.RestClientRetries$class.makeRequest(RestClientRetries.scala:35)
    at com.sumologic.scala.collector.auth.CollectorRegistrationManager.com$sumologic$scala$collector$rest$RestClientDeploymentRedirection$$super$makeRequest(CollectorRegistrationManager.scala:49)
    at com.sumologic.scala.collector.rest.RestClientDeploymentRedirection$class.makeRequest(RestClientDeploymentRedirection.scala:74)
    at com.sumologic.scala.collector.auth.CollectorRegistrationManager.makeRequest(CollectorRegistrationManager.scala:49)
    at com.sumologic.scala.collector.auth.CollectorRegistrationManager.ping(CollectorRegistrationManager.scala:361)
    at com.sumologic.scala.collector.Collector.init(Collector.scala:546)
    at com.sumologic.scala.collector.Collector$.main(Collector.scala:831)
    at com.sumologic.scala.collector.Collector.main(Collector.scala)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:290)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.io.EOFException: SSL peer shut down incorrectly
    at sun.security.ssl.InputRecord.read(Unknown Source)
    ... 40 more

If I open a powershell and do a curl on 'service.au.sumologic.com', it works…

PS > curl https://service.au.sumologic.com


StatusCode        : 200
StatusDescription : OK
Content           : <html>
                    <body>
                    <h2>Tweep</h2>
                    </body>
                    </html>
RawContent        : HTTP/1.1 200 OK
                    Strict-Transport-Security: max-age=15552000
                    X-Content-Type-Options: nosniff
                    X-Frame-Options: SAMEORIGIN
                    X-XSS-Protection: 1; mode=block
                    Connection: keep-alive
                    Accept-Ranges: byte...
Forms             : {}
Headers           : {[Strict-Transport-Security, max-age=15552000], [X-Content-Type-Options, nosniff],
                    [X-Frame-Options, SAMEORIGIN], [X-XSS-Protection, 1; mode=block]...}
Images            : {}
InputFields       : {}
Links             : {}
ParsedHtml        : System.__ComObject
RawContentLength  : 44

In my squid access.log I can see:

1470638115.212    164 172.26.192.122 TAG_NONE/200 0 CONNECT 54.252.91.36:443 - HIER_NONE/- -

which is service.au.sumologic.com….

Have I missed something in my squid config?

Squid Config

visible_hostname squid

http_port 3129 intercept
acl allowed_http_sites dstdomain .amazonaws.com
acl allowed_http_sites dstdomain .newrelic.com
acl allowed_http_sites dstdomain .windowsupdate.com
acl allowed_http_sites dstdomain .microsoft.com
acl allowed_http_sites dstdomain ocsp.comodoca.com
acl allowed_http_sites dstdomain crl.usertrust.com
acl allowed_http_sites dstdomain ocsp.globalsign.com
acl allowed_http_sites dstdomain crl.globalsign.net


http_access allow allowed_http_sites

https_port 3130 ssl-bump intercept connection-auth=off generate-host-certificates=on dynamic_cert_mem_cache_size=8MB cert=/etc/squid/ssl/squid.pem key=/etc/squid/ssl/squid.key c$acl SSL_port port 443
http_access allow SSL_port
acl allowed_https_sites ssl::server_name .amazonaws.com
acl allowed_https_sites ssl::server_name .newrelic.com
acl allowed_https_sites ssl::server_name .microsoft.com
acl allowed_https_sites ssl::server_name .windowsupdate.com
acl allowed_https_sites ssl::server_name .sumologic.com
acl allowed_https_sites ssl::server_name .datadoghq.com

sslproxy_cert_error allow all

acl NoSSLIntercept ssl::server_name_regex -i "/etc/squid/url.nobump"
acl step1 at_step SslBump1
acl step2 at_step SslBump2
acl step3 at_step SslBump3
ssl_bump peek step1 all
ssl_bump peek step2 allowed_https_sites
ssl_bump peek step2 NoSSLIntercept
ssl_bump splice step1 NoSSLIntercept
ssl_bump splice step3 allowed_https_sites
ssl_bump terminate step2 all

http_access deny all

Best Answer

The access.log line is the TCP connection arriving and being accepted to begin the bumping process.

Your ssl_bump rules say to peek at step1 then to terminate at step2 unless the client sent a TLS SNI value containing one of a few whitelisted server names in one of allowed_https_sites or NoSSLIntercept ACLs.

It seems the Java application either does not send SNI, or sends a value not whitelisted. It also crashes when TLS is unsuccessful (terminated by the other endpoint).