repak shawahb
people who speak in metaphors can shampoo my crotch

^

   

rsw@jfet.org


blogroll

       
Tue, 13 Sep 2005

mod_proxy + openssl s_client

At the gym today, I was ruminating on how to run both an HTTPS and an SSH server on port 443 of a machine so as to allow it to both serve secure content and function as the outside endpoint for proxy tunnels which exploit open HTTPS access and/or HTTPS CONNECT tunnels.

Until earlier today, I'd completely forgotten about Apache's mod_proxy, a cute little module that provides basic proxy functionality from Apache. Clearly, this little honey is exactly what we want, though: a proxy server which supports CONNECT and runs in parallel with your HTTP server.

Setup is extremely easy on the server side. For you debian users, make the appropriate symblinks in /etc/apache2/mods-enabled and edit /etc/apache2/mods-available/proxy.conf as appropriate.

You can telnet to port 80 and verify that CONNECT works as expected. Now, give it a whirl using the OpenSSL binary (openssl s_client -connect yourserver:443 -nbio -quiet is a good start) and you'll be disappointed. Yup, there's a bug in mod_proxy_connect that makes it bypass HTTPS and just dump unencrypted data directly on the socket once the CONNECT session starts. Never fear, however, for that same link has the patch you'll need to fix it. apt-get build-dep apache2, apt-get source apache2, cd into upstream/tarballs, untar it, apply the patch, tar it back up, and dpkg-buildpackage -rfakeroot -b.

Now, armed with your hot new Apache build, you're ready to take on the world. The only thing left is a daemon for the client side. Mine is called sprox.pl. I decided to use a wrapper around the openssl binary because I found that IO::Socket::SSL is substantially slower.


[ permalink | 0 comments (add one you lazy bastard!) ]

writebacks (add one you lazy bastard!)




post a comment:

Save name/email/&c
Name:
URL/Email: [http://... or mailto:you@wherever] (optional)
Title: (optional)
Comments:
Key:
(Required)