]> git.ipfire.org Git - thirdparty/squid.git/commit
Peek at the origin server SSL certificate when bumping intercepted HTTPS.
authorAlex Rousskov <rousskov@measurement-factory.com>
Wed, 14 Dec 2011 18:24:29 +0000 (11:24 -0700)
committerAlex Rousskov <rousskov@measurement-factory.com>
Wed, 14 Dec 2011 18:24:29 +0000 (11:24 -0700)
commitd7ce0bcd1ca3d7f068e8238aa2bf90bdbf5b386f
tree7126a43faedfd4cfb445ed8e4f68ec8e1ce23266
parent4090b8be71c8a96a50ceafd0ab42b16375c1c139
Peek at the origin server SSL certificate when bumping intercepted HTTPS.

* Configuration changes:

Allow intercepted SSL connections to be bumped, in addition to the
tproxied SSL connections.

Honor and check ssl-bump flag in https_port. Earlier code apparently
assumed that the flag must be present in http_port and left
Ssl::TheGlobalContextStorage uninitialized if only https_port had the
flag.

* Client-side changes:

Added a new Ssl::ServerPeeker class to do client-side error handling
while peeking at the origin server certificate. Peeking is done at the
server-side. Server-side uses Store and store_client API to report
errors to the client-side. That works OK when the errors can be sent to
the client, but when we bump intercepted connections, the client does
not yet have a secure connection established with Squid so errors cannot
be sent (popular browsers do not display CONNECT-stage errors). Instead,
the errors must be accumulated and sent after the secure connection with
the client is established (in response to the first HTTP request on that
connection). Ssl::ServerPeeker needs work to support such accumulation.

Start Ssl::ServerPeeker job in ConnStateData::switchToHttps() and wait
for somebody to call the new ConnStateData::httpsPeeked() method back.
Needs more work to actually use the peeked certificate and handle
errors.

Changed ConnStateData::switchToHttps() profile to require destination
port number.  Without it, we cannot switch intercepted SSL connections
because they do not have a proper request structure that can supply port
details.

Polished pinned connection cleaning code: If our Comm close handler for
the pinned connection was called, do no try to remove the handler. If
the pinned connection was closed (e.g., by a server-side error), do not
try to close it again. If we already called unpinConnection(), do not
try to close the pinned connection again.

Do not assume we have a request when pinning a connection to the server.
Intercepted connections do not have requests at the connection pinning
stage.

* Server-side changes:

Bug 3243 (CVE 2009-0801: Bypass of browser same-origin access control in
intercepted communication) fix always created a new connection to the
origin server. I think it is safe (and possibly even safer!) to reuse a
pinned connection instead (if one is available). We now do that in the
new FwdState::selectPeerForIntercepted() method. If bump-server-first
does not reuse a pinned connection (left from certificate peeking),
Squid would be opening and closing to-server connections just to learn
the certificate, which is not kosher.

Added a new internal protocol type (PROTO_SSL_PEEK) to allow FwdState to
detect peeking requests and end processing after the certificate is
received (instead of proceeding with to httpStart()).
src/anyp/ProtocolType.h
src/client_side.cc
src/client_side.h
src/client_side_request.cc
src/forward.cc
src/forward.h
src/ssl/Makefile.am
src/ssl/ServerPeeker.cc [new file with mode: 0644]
src/ssl/ServerPeeker.h [new file with mode: 0644]