How to make netcat support ssl by combining openssl?

2

1

Original netcat doesn't support ssl. ncat from nmap project does.
In linux, we can connect multiple commands with pipeline.
Is it possible to combine netcat and openssl to create a ncat?

kev

Posted 2012-11-23T18:17:36.667

Reputation: 9 972

Answers

2

No doubt you can do it with stunnel, a generic program that makes TCP connections such that they're done with SSL.

It's generic, so it make POP go through SSL too, making Secure POP, or it could do HTTP.

barlop

Posted 2012-11-23T18:17:36.667

Reputation: 18 677

2

Socat is netcat on steroids. If you can use socat, see Securing Traffic Between two Socat Instances Using SSL

RedGrittyBrick

Posted 2012-11-23T18:17:36.667

Reputation: 70 632

2

Use stunnel+netcat to connect smtp.gmail.com:

$ grep smtp /etc/services
smtp            25/tcp          mail
ssmtp           465/tcp         smtps           # SMTP over SSL

$ cat stunnel.conf
[gmail-smtp]
client = yes
accept = localhost:smtp
connect = smtp.gmail.com:ssmtp

$ sudo stunnel4 stunnel.conf

$ nc -C localhost smtp
220 mx.google.com ESMTP s7sm6983451paz.7
ehlo
250-mx.google.com at your service, [112.91.181.20]
250-SIZE 35882577
250-8BITMIME
250-AUTH LOGIN PLAIN XOAUTH XOAUTH2
250 ENHANCEDSTATUSCODES
quit
221 2.0.0 closing connection s7sm6983451paz.7

kev

Posted 2012-11-23T18:17:36.667

Reputation: 9 972