Sometimes I find it useful to do a quick telnet session to port 80 of my web server and throw at it a few requests to see how it responds. However, how do you do this with an SSL connection? Obviously Telnet doesn’t do SSL, so is there something else that’s quick and dirty?
Why yes, there is!
I tend to keep a copy of OpenSSL installed on whatever machine I’m working. Usually it’s for the DLLs to let wget work with SSL connections or to split and splice SSL certs. But it turns out you can also use OpenSSL as a command-line client to open SSL connections to remove servers. It’s quite simple, just drop to a command line/terminal session and use the following command:
openssl s_client -host <server> -port 443
Now work the HTTP magic like you would were you using telnet. Let’s see that in action!
>openssl s_client -host http://www.microsoft.com -port 443
GET / HTTP/1.0
HTTP/1.1 200 OK
Last-Modified: Mon, 16 Mar 2009 20:35:26 GMT
P3P: CP="ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI"
Date: Mon, 25 Jan 2010 14:51:15 GMT