.comment-link {margin-left:.6em;} <$BlogRSDURL$>

Sunday, July 30, 2006

openssl: "telnet" with SSL 

If you're accustomed to being able to manually send HTTP commands directly to a server's http port to debug server issues, using SSL (https) can be a pain since it's very difficult for human minds to encrypt text on the fly.
There are SSL-aware versions of telnet out there, but chances are your system doesn't have them installed.

Luckily, openssl has a way to do this already (and you probably have it installed). "man s_client" for more info, but the gist of it is that you can type "openssl s_client -connect host:port" and start typing away whatever commands you want.

eg.
> openssl s_client -quiet -connect www.google.com:443
depth=1 /C=ZA/O=Thawte Consulting (Pty) Ltd./CN=Thawte SGC CA
verify error:num=20:unable to get local issuer certificate
verify return:0

GET /

<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A HREF="http://www.google.com">here</A>.
</BODY></HTML>
read:errno=0

This page is powered by Blogger. Isn't yours?