I'm trying to set an SSL connection with stunnel. Some kind of SSL proxy.
Final aim
Connect http only CLIENT to https only SERVER.
My plan is
- CLIENT: change endpoint to PROXY
- PROXY: use stunnel to receive requests from CLIENT and forward them to SERVER
stunnel.conf
cert = /etc/stunnel/stunnel.pem
foreground = yes
chroot = /var/run/stunnel
setuid = stunnel
setgid = stunnel
pid = /stunnel.pid
debug = 7
[my_route]
accept = 7121
connect = SERVER:443
;connect = SERVER:443/somedata
Test 1
$openssl s_client -connect SERVER:443
New, TLSv1/SSLv3, Server public key is 2048 bit
Test 2
openssl s_client -connect PROXY:7121
New, TLSv1/SSLv3, Server public key is 2048 bit
Result (connecting from CLIENT to SERVER through PROXY).
Service [my_route] accepted (FD=3) from 10.0.2.2:12345
Service [my_route] started
Service [my_route] accepted connection from 10.0.2.2:12345
SSL state (accept): before/accept initialization
SSL_accept: 1408F10B: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number
Connection reset: 0 byte(s) sent to SSL, 0 byte(s) sent to socket
Local socket (FD=3) closed
Service [my_route] finished (0 left)
Questions
Why doesn't the IP match to SERVER? Why is it connectiong to 10.0.2.2?
Does it mean that I'm connecting to a wrong server? How can that happen?What does this error say? That remote server uses another version of SSL, doesn't it?