How can I test stunnel?

skynyrd picture skynyrd · Nov 25, 2013 · Viewed 8.1k times · Source

I've created a conf file for a connection to an address and port for stunnel whose location is in /usr/local/etc/stunnel/ and started the stunnel service.

I've binded the address to my local ip address 127.0.0.1:60005

To test the connection, I've tried to connect the address via telnet with:

telnet 127.0.0.1 60005

Turns:

Trying 127.0.0.1... Connected to 127.0.0.1. Escape character is '^]'. Connection closed by foreign host.

I know that connection is not closed by foreign host as I tried telnet with the original ip address, there is no problem.

So, how can I test my stunnel connection except using telnet? Thanks.

Answer

user1529891 picture user1529891 · Mar 13, 2016

One way to test it is to use tcpdump.

Try: tcpdump port 60005 -n -vvvv

Then send some data to that interface: echo "blah" > nc localhost 60005

You should see packets from tcpdump; if you do not see any packets try having tcpdump listen on a different interface with the -i switch.