You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@trafficserver.apache.org by Jiří Podhorský <po...@gmail.com> on 2015/05/05 13:00:14 UTC

Traffic server and ssl termination

Hello,

I'm trying to configure traffic server with ssl termination
https://docs.trafficserver.apache.org/en/latest/admin/security-options.en.html

But ssl termination don't work with browsers, wget or curl, because first
request is CONNECT, which is not expected in ssl port and creates log:

SSLv3, TLS handshake, Client hello (1):
error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
Closing connection #0

(plain http request connect is taken as Client hello message of ssl).

I didn't find a way, how to redirect this message to not-ssl port or deny
it.

I tried to find some configuration or patch, but I didn't find any
workarouds for this issue.

Can you help me?

Thanks.

Jiri

Re: Traffic server and ssl termination

Posted by Leif Hedstrom <zw...@apache.org>.
> On May 5, 2015, at 5:00 AM, Jiří Podhorský <po...@gmail.com> wrote:
> 
> Hello,
> 
> I'm trying to configure traffic server with ssl termination
> https://docs.trafficserver.apache.org/en/latest/admin/security-options.en.html
> 
> But ssl termination don't work with browsers, wget or curl, because first
> request is CONNECT, which is not expected in ssl port and creates log:


If I understand you, you are trying to do forward proxy (with CONNECT) over TLS. That doesn’t work in most clients. Newer versions of Chrome has support for this, probably with a specific options. For some details on this, see e.g.

	https://www.ogre.com/node/465


There are some links in there, including Daniel’s open issue for Curl supporting forward proxy over TLS.

— leif


Re: Traffic server and ssl termination

Posted by Sudheer Vinukonda <su...@yahoo-inc.com.INVALID>.
Just fyi - a similar issue from the mailing archives.
http://mail-archives.apache.org/mod_mbox/trafficserver-users/201503.mbox/%3C340179796.3540338.1425579527945.JavaMail.yahoo@mail.yahoo.com%3E

      From: Dave Thompson <da...@yahoo-inc.com.INVALID>
 To: "dev@trafficserver.apache.org" <de...@trafficserver.apache.org> 
 Sent: Tuesday, May 5, 2015 6:55 AM
 Subject: Re: Traffic server and ssl termination
   
Jiri, 

This is a client initiated behavior issue.  If you want your client to SSL terminate at ATS, it needs to send an SSL client-hello rather than a CONNECT as the first message.    If you are using curl, a --proxy to an SSL site, will do a CONNECT rather than SSL terminate.   If in doubt, a tcpdump/wireshark can be used to confirm what client is sending.      Perhaps your test browser configured to proxy tunnel as well.

Dave 




    On Tuesday, May 5, 2015 6:02 AM, Jiří Podhorský <po...@gmail.com> wrote:
  

 Hello,

I'm trying to configure traffic server with ssl termination
https://docs.trafficserver.apache.org/en/latest/admin/security-options.en.html

But ssl termination don't work with browsers, wget or curl, because first
request is CONNECT, which is not expected in ssl port and creates log:

SSLv3, TLS handshake, Client hello (1):
error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
Closing connection #0

(plain http request connect is taken as Client hello message of ssl).

I didn't find a way, how to redirect this message to not-ssl port or deny
it.

I tried to find some configuration or patch, but I didn't find any
workarouds for this issue.

Can you help me?

Thanks.

Jiri




  

Re: Traffic server and ssl termination

Posted by Jiří Podhorský <po...@gmail.com>.
Ignore my previous comment. It was configuration issue, which creates
faults of traffic server and core files. It works now.

Thanks anyone for help.

2015-05-06 18:05 GMT+02:00 Jiří Podhorský <po...@gmail.com>:

> I tried to add parameters --no-check-certificate --trust-server-names to
> wget and no change. Hmm, but if client didn't send the client hello packet,
> (according to wireshark) server can't send server hello packet and the
> certificate. So, in this step the certificate shouldn't be verified,
> because client don't have server's certificate and server don't know about
> address which client want to use.
>
> Can be this caused by anything else?
>
>
> 2015-05-06 16:43 GMT+02:00 Leif Hedstrom <zw...@apache.org>:
>
>>
>> > On May 6, 2015, at 5:16 AM, Jiří Podhorský <po...@gmail.com>
>> wrote:
>> >
>> > Ok, I redirected port 443 to proxy via iptables. Now the message connect
>> > disapear. I can see in wireshark the connection is redirected correctly.
>> > But when I try to connect via https:
>> >
>> > wget -4 https://www.google.com
>> > --2015-05-06 13:12:07--  https://www.google.com/
>> > Resolving www.google.com (www.google.com)... 173.194.116.243,
>> > 173.194.116.244, 173.194.116.240, ...
>> > Connecting to www.google.com (www.google.com)|173.194.116.243|:443...
>> > connected.
>> > OpenSSL: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert
>> > handshake failure
>> > Unable to establish SSL connection.
>>
>>
>> You can’t do that. That would be a man-in-the-middle attack against TLS.
>> If you were to try to do intercepting proxying of TLS, you would also need
>> to generate certificates for all sites that you expect to proxy. E.g. a
>> certificate for www.google.com.
>>
>> — Leif
>>
>>
>

Re: Traffic server and ssl termination

Posted by Jiří Podhorský <po...@gmail.com>.
I tried to add parameters --no-check-certificate --trust-server-names to
wget and no change. Hmm, but if client didn't send the client hello packet,
(according to wireshark) server can't send server hello packet and the
certificate. So, in this step the certificate shouldn't be verified,
because client don't have server's certificate and server don't know about
address which client want to use.

Can be this caused by anything else?

2015-05-06 16:43 GMT+02:00 Leif Hedstrom <zw...@apache.org>:

>
> > On May 6, 2015, at 5:16 AM, Jiří Podhorský <po...@gmail.com>
> wrote:
> >
> > Ok, I redirected port 443 to proxy via iptables. Now the message connect
> > disapear. I can see in wireshark the connection is redirected correctly.
> > But when I try to connect via https:
> >
> > wget -4 https://www.google.com
> > --2015-05-06 13:12:07--  https://www.google.com/
> > Resolving www.google.com (www.google.com)... 173.194.116.243,
> > 173.194.116.244, 173.194.116.240, ...
> > Connecting to www.google.com (www.google.com)|173.194.116.243|:443...
> > connected.
> > OpenSSL: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert
> > handshake failure
> > Unable to establish SSL connection.
>
>
> You can’t do that. That would be a man-in-the-middle attack against TLS.
> If you were to try to do intercepting proxying of TLS, you would also need
> to generate certificates for all sites that you expect to proxy. E.g. a
> certificate for www.google.com.
>
> — Leif
>
>

Re: Traffic server and ssl termination

Posted by Leif Hedstrom <zw...@apache.org>.
> On May 6, 2015, at 5:16 AM, Jiří Podhorský <po...@gmail.com> wrote:
> 
> Ok, I redirected port 443 to proxy via iptables. Now the message connect
> disapear. I can see in wireshark the connection is redirected correctly.
> But when I try to connect via https:
> 
> wget -4 https://www.google.com
> --2015-05-06 13:12:07--  https://www.google.com/
> Resolving www.google.com (www.google.com)... 173.194.116.243,
> 173.194.116.244, 173.194.116.240, ...
> Connecting to www.google.com (www.google.com)|173.194.116.243|:443...
> connected.
> OpenSSL: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert
> handshake failure
> Unable to establish SSL connection.


You can’t do that. That would be a man-in-the-middle attack against TLS. If you were to try to do intercepting proxying of TLS, you would also need to generate certificates for all sites that you expect to proxy. E.g. a certificate for www.google.com.

— Leif


Re: Traffic server and ssl termination

Posted by Jiří Podhorský <po...@gmail.com>.
Ok, I redirected port 443 to proxy via iptables. Now the message connect
disapear. I can see in wireshark the connection is redirected correctly.
But when I try to connect via https:

wget -4 https://www.google.com
--2015-05-06 13:12:07--  https://www.google.com/
Resolving www.google.com (www.google.com)... 173.194.116.243,
173.194.116.244, 173.194.116.240, ...
Connecting to www.google.com (www.google.com)|173.194.116.243|:443...
connected.
OpenSSL: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert
handshake failure
Unable to establish SSL connection.

And in log of traffic server:
[May  6 13:12:07.306] Server {0x7f6a043c4700} DEBUG: (ssl)
[SSLNextProtocolAccept:mainEvent] event 202 netvc 0x624ace0
[May  6 13:12:07.306] Server {0x7f6a043c4700} DEBUG: (ssl) IP context is
(nil) for [10.0.133.70:37431] -> [10.0.22.59:8090], default context
0x7f6a1804a3b0
[May  6 13:12:07.306] Server {0x7f6a043c4700} DEBUG: (ssl)
ssl_callback_info ssl: 0x6307c30 where: 16 ret: 1
[May  6 13:12:07.306] Server {0x7f6a043c4700} DEBUG: (ssl)
ssl_callback_info ssl: 0x6307c30 where: 8193 ret: 1
[May  6 13:12:07.306] Server {0x7f6a043c4700} DEBUG: (ssl)
ssl_servername_callback ssl=0x6307c30 ad=112 server=www.google.com
handshake_complete=0
[May  6 13:12:07.306] Server {0x7f6a043c4700} DEBUG: (ssl)
ssl_servername_callback using SSL context 0x7f6a1804a3b0 for requested name
'www.google.com'
[May  6 13:12:07.307] Server {0x7f6a043c4700} DEBUG: (ssl)
ssl_callback_info ssl: 0x6307c30 where: 16392 ret: 552
[May  6 13:12:07.307] Server {0x7f6a043c4700} DEBUG: (ssl)
ssl_callback_info ssl: 0x6307c30 where: 8194 ret: -1
[May  6 13:12:07.307] Server {0x7f6a043c4700} DEBUG: (ssl)
ssl_callback_info ssl: 0x6307c30 where: 8194 ret: -1
[May  6 13:12:07.307] Server {0x7f6a043c4700} DEBUG: (ssl)
SSL::140093314320128:error:1408A0C1:SSL routines:SSL3_GET_CLIENT_HELLO:no
shared cipher:s3_srvr.c:1361: peer address is 10.0.133.70
[May  6 13:12:07.307] Server {0x7f6a043c4700} DEBUG:
<SSLNetVConnection.cc:941 (sslServerHandShakeEvent)> (ssl) SSL handshake
error: SSL_ERROR_SSL (1), errno=0
[May  6 13:12:07.307] Server {0x7f6a043c4700} DEBUG:
<SSLNetVConnection.cc:1037 (sslServerHandShakeEvent)> (ssl)
SSLNetVConnection::sslServerHandShakeEvent, SSL_ERROR_SSL errno=0

But I can see in wireshark only tcp packets with SYN,ACK,PSH,FIN. No ssl
client hello packet.

When I try to redirect traffic of 443 through non-ssl port of traffic
server. Everything seems to be ok.

Do you have any idea how solve this issue?

Thanks for answer.

Re: Traffic server and ssl termination

Posted by Alan Carroll <so...@yahoo-inc.com.INVALID>.
The connect request is being blocked - ATS is rejecting it. You can't redirect the SSL request because your user agent is not generating an SSL request - that's the root of the problem. The user agent is creating a CONNECT request. This also means the user agent is not creating SSL packets, either.
If you want to terminate SSL in ATS, then you need
1) A certificate installed in ATS to use for the termination2) The user agent must connect to ATS as if it were the SSL endpoint, because it is the SSL endpoint for the user agent.3) This means the certificate in ATS must have a domain name that resolves to the ATS address and the user agent must directly connect to that domain name.
E.g., if the domain name is "bob.com", then ATS must have a certificate for the name "bob.com", the user agent must connect via SSL to "bob.com", and the DNS resolution for "bob.com" must be the IP address of the ATS SSL proxy port. The most likely cause of getting CONNECT instead of SSL packets is because the user agent has been configured to use ATS as a proxy. That won't work, ATS must act as if it were the SSL termination point in order to be the SSL termination point. 


     On Tuesday, May 5, 2015 9:21 AM, Jiří Podhorský <po...@gmail.com> wrote:
   

 Hello Dave,

thanks for answer.

I already tried this and I didn't succeed.
I tries configurations of curl/wget, traffic server, even a solution with
created plugin of traffic server, where I wanted to redirect ssl packets to
right ssl ports, but I wasn't succeed.

Is there another way how to block the connect request? At least some
script, which can redirect the ssl requests according to http header to
right port?

Jiri

2015-05-05 15:55 GMT+02:00 Dave Thompson <da...@yahoo-inc.com.invalid>:

> Jiri,
>
> This is a client initiated behavior issue.  If you want your client to SSL
> terminate at ATS, it needs to send an SSL client-hello rather than a
> CONNECT as the first message.    If you are using curl, a --proxy to an SSL
> site, will do a CONNECT rather than SSL terminate.  If in doubt, a
> tcpdump/wireshark can be used to confirm what client is sending.
> Perhaps your test browser configured to proxy tunnel as well.
>
> Dave
>
>
>      On Tuesday, May 5, 2015 6:02 AM, Jiří Podhorský <
> podhorsky.ksj@gmail.com> wrote:
>
>
>  Hello,
>
> I'm trying to configure traffic server with ssl termination
>
> https://docs.trafficserver.apache.org/en/latest/admin/security-options.en.html
>
> But ssl termination don't work with browsers, wget or curl, because first
> request is CONNECT, which is not expected in ssl port and creates log:
>
> SSLv3, TLS handshake, Client hello (1):
> error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
> Closing connection #0
>
> (plain http request connect is taken as Client hello message of ssl).
>
> I didn't find a way, how to redirect this message to not-ssl port or deny
> it.
>
> I tried to find some configuration or patch, but I didn't find any
> workarouds for this issue.
>
> Can you help me?
>
> Thanks.
>
> Jiri
>
>
>
>

  

Re: Traffic server and ssl termination

Posted by Jiří Podhorský <po...@gmail.com>.
Hello Dave,

thanks for answer.

I already tried this and I didn't succeed.
I tries configurations of curl/wget, traffic server, even a solution with
created plugin of traffic server, where I wanted to redirect ssl packets to
right ssl ports, but I wasn't succeed.

Is there another way how to block the connect request? At least some
script, which can redirect the ssl requests according to http header to
right port?

Jiri

2015-05-05 15:55 GMT+02:00 Dave Thompson <da...@yahoo-inc.com.invalid>:

> Jiri,
>
> This is a client initiated behavior issue.  If you want your client to SSL
> terminate at ATS, it needs to send an SSL client-hello rather than a
> CONNECT as the first message.    If you are using curl, a --proxy to an SSL
> site, will do a CONNECT rather than SSL terminate.   If in doubt, a
> tcpdump/wireshark can be used to confirm what client is sending.
> Perhaps your test browser configured to proxy tunnel as well.
>
> Dave
>
>
>      On Tuesday, May 5, 2015 6:02 AM, Jiří Podhorský <
> podhorsky.ksj@gmail.com> wrote:
>
>
>  Hello,
>
> I'm trying to configure traffic server with ssl termination
>
> https://docs.trafficserver.apache.org/en/latest/admin/security-options.en.html
>
> But ssl termination don't work with browsers, wget or curl, because first
> request is CONNECT, which is not expected in ssl port and creates log:
>
> SSLv3, TLS handshake, Client hello (1):
> error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
> Closing connection #0
>
> (plain http request connect is taken as Client hello message of ssl).
>
> I didn't find a way, how to redirect this message to not-ssl port or deny
> it.
>
> I tried to find some configuration or patch, but I didn't find any
> workarouds for this issue.
>
> Can you help me?
>
> Thanks.
>
> Jiri
>
>
>
>

Re: Traffic server and ssl termination

Posted by Dave Thompson <da...@yahoo-inc.com.INVALID>.
Jiri, 

This is a client initiated behavior issue.  If you want your client to SSL terminate at ATS, it needs to send an SSL client-hello rather than a CONNECT as the first message.    If you are using curl, a --proxy to an SSL site, will do a CONNECT rather than SSL terminate.   If in doubt, a tcpdump/wireshark can be used to confirm what client is sending.      Perhaps your test browser configured to proxy tunnel as well.

Dave 


     On Tuesday, May 5, 2015 6:02 AM, Jiří Podhorský <po...@gmail.com> wrote:
   

 Hello,

I'm trying to configure traffic server with ssl termination
https://docs.trafficserver.apache.org/en/latest/admin/security-options.en.html

But ssl termination don't work with browsers, wget or curl, because first
request is CONNECT, which is not expected in ssl port and creates log:

SSLv3, TLS handshake, Client hello (1):
error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
Closing connection #0

(plain http request connect is taken as Client hello message of ssl).

I didn't find a way, how to redirect this message to not-ssl port or deny
it.

I tried to find some configuration or patch, but I didn't find any
workarouds for this issue.

Can you help me?

Thanks.

Jiri