How to telnet to port 443 to test HTTPS sites

Testing websites, it’s sometimes beneficial to just telnet google.com 80 and speak HTTP. But, of course, that won’t work for HTTPS sites, because you’re expected to set up an SSL connection, not send HTTP commands.

It turns out you have two options (at least), but neither involves using telnet.

Use openssl

This is the more common one: use the s_client option on the OpenSSL CLI tool.

Matthew.Wagner ~ $ openssl s_client -connect ma.ttwagner.com:443
CONNECTED(00000003)
depth=1 /C=BE/O=GlobalSign nv-sa/CN=GlobalSign Organization Validation CA - G2
verify error:num=20:unable to get local issuer certificate
verify return:0
---
Certificate chain
...

This will output a ton of SSL information, but then you’re in the equivalent of a telnet session, tunneled through a secure connection. You can use your classic dialog, e.g.,

GET / HTTP/1.1
HOST: ma.ttwagner.com

And you’ll get the expected response.

Use gnutls-cli

Thanks to a fellow Matt, at bearfruit.org, for this great suggestion. If you’ve got gnutls installed, it’s even easier:

Matthew.Wagner ~ $ gnutls-cli login.yahoo.com
Processed 237 CA certificate(s).
Resolving 'login.yahoo.com'...
Connecting to '98.139.21.169:443'...
Cannot connect to 98.139.21.169:443: Operation timed out

(The “Cannot connect” error is not erroneous. I was confirming that my browser wasn’t insane, and that login.yahoo.com really was down at the time.)

gnutls-cli is present on my Mac, but not on a CentOS box. There, it’s provided by gnutls-utils.

6 thoughts on “How to telnet to port 443 to test HTTPS sites

  1. Olá!. Sei que é meio off-topic mas, eu preciso fazer uma pergunta .
    Você estaria interessado em negociar links ou comentários?
    Poderia ser postando um artigo no meu blog e vice-versa?
    Meu site discute assuntos muito parecidos com o seu e eu acredito que nós realmente podemos nos beneficiar.
    Se você se interessar sinta-se livre para comentar no meu blog .
    Estou ansioso para ouvir sua resposta!! Seu site é Maravilhoso , a propósito!

  2. Olá como vai ? possuo um blog na internet e diariamente recebo muito spam você
    sabe como eu posso reduzir desse problema ? desculpe usar este espaço
    para perguntar isso, mas vejo que seu blog é bem bacana
    e você já devem ter sofrido com isso antes . Obrigado

Leave a Reply to web site Cancel reply

Your email address will not be published. Required fields are marked *

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax