0

Debian (and other distro if you recompile the source) can use a ssl version of telnetd.

telnet-ssl -z cacert=/etc/ssl/certs/mydomain.crt -z cert=/etc/ssl/certs/client.mydomain.crt -z key=/etc/ssl/private/client.mydomain.key othersite Trying 192.168.0.217... Connected to othersite.mydomain Escape character is '^]'. [SSL - attempting to switch on SSL] [SSL - handshake starting] [SSL - OK] 

I want to know more details on ssl connection (ciphers used, etc..) I know this command

openssl s_client -showcerts -connect othersite.mydomain:23 -tls1_2 

but return only..

CONNECTED(00000003) 

I try also to pass certificates with --cert and --key flags for s_client, but nothing appear except CONNECTED(00000003)

Some output appear using those options, but no details

openssl s_client -key KEYPATH -cert CERTPATH -CAfile CACERTPATH -connect othersite.mydomain:23 -starttls telnet CONNECTED(00000003) --- no peer certificate available --- No client certificate CA names sent --- SSL handshake has read 3 bytes and written 0 bytes Verification: OK --- New, (NONE), Cipher is (NONE) Secure Renegotiation IS NOT supported Compression: NONE Expansion: NONE No ALPN negotiated Early data was not sent Verify return code: 0 (ok) 

How to see ssl connection details for this service?

0

1 Answer 1

3

The initial connection messages from the telnet-ssl client:

Connected to othersite.mydomain Escape character is '^]'. [SSL - attempting to switch on SSL] 

include "attempting to switch on SSL", indicating that the client doesn't simply start with the SSL connection negotiation once a basic TCP connection is established, but there is some sort of Telnet protocol handshake first, that includes some way to say "I would want to use encryption". And apparently the server side does not begin the SSL negotiation until it sees that. So it would actually be something similar to STARTTLS, not just plain SSL.

Debian's openssl s_client has the -starttls <protocol> option, which would be just the thing for situations like this. Unfortunately, it does not seem to include support for the Telnet protocol.

According to this expired Internet Draft, as soon as the TCP connection opens, the server should be sending the Telnet protocol message IAC DO START_TLS, which would be three bytes on the TCP connection: 0xff 0xfd 0x2e in hexadecimal. That matches the SSL handshake has read 3 bytes and written 0 bytes message.

The client would have to answer with another Telnet protocol message that acknowledges it's able and willing to make SSL/TLS encrypted connections, and then another pair of messages would be exchanged to mark the actual start of the SSL/TLS negotiation. But because your openssl s_client doesn't know how to speak Telnet, it cannot give the server the answer that would allow the SSL/TLS negotiation to begin.

Unless you find a version of openssl s_client that includes STARTTLS support for the Telnet protocol, I would guess the only way would be to use tcpdump to capture the connection negotiation done by the real telnet-ssl client, and then use wireshark or similar to analyze the results.

The procedure would be: 1.) Have two terminal windows open. 2.) In the first window, start the capture:

sudo tcpdump -i <network interface> -s0 -Knpvv -w telnet-ssl-dump.cap host othersite 

3.) After entering the password for sudo (if necessary), leave that command running, move to the second terminal window, and run your telnet-ssl command there. You should see a counter of captured packets increase in the first window.

4.) You don't have to actually log in: as soon as you see the remote login prompt, the SSL/TLS negotiation should be done and you can stop the packet capture by moving to the first window and pressing Ctrl+C.

Now in the session of the first terminal window, you should have a telnet-ssl-dump.cap file, which you can analyze further.

Wireshark is a professional-grade network traffic analyzer with a GUI interface. It is best to run it in your local workstation. If your local system is Linux, you can probably find it in your distribution's package repositories. For Windows, you can download it from the link above.

If you give Wireshark the name of the packet capture file as a parameter, it won't require any special privileges, so run wireshark telnet-ssl-dump.cap. Without any parameters, Wireshark will assume that you are planning to start capturing traffic, and may show you some questions about network interface(s) to use. But when started with a packet capture file, it should immediately show a list of captured packets. You can select one of them to see a detailed breakdown of it as far as Wireshark can parse it. Find the packets that contain the SSL/TLS protocol negotiation, and you should be able to see which encryption algorithm gets chosen and other connection details. If you see the packet contents listed only as <encrypted data>, you went too far, and are looking at the SSL/TLS encrypted datastream after the negotiation has completed.

1
  • Good and complete explanation, thanks Commented Mar 10, 2023 at 1:50

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.