ssl - How to setup secure tunnel to allow a client to communicate to a websocket? -
i need allow client connect websocket on server 10.0.4.160. 10.0.4.160 server not have ssl installed on have websocket running on port 8080.
i need setup secure tunnel allow client connect websocket.
i installed stunnel on windows server 2008 r2, , changed stunnel.conf file loke
[websockets] accept = 8443 connect = 8080 verify = 2 cafile = ca-certs.pem client = yes
i expecting connect server on port 8433 , stunnel allow connection connect port 8080
this code use in client's console "of course, console on pc on internal network"
var conn = new websocket('wss://10.0.4.160:8443'); conn.onopen = function(e) { console.log("connection established!"); }; conn.onmessage = function(e) { console.log(e.data); };
while on server open command line , execute telnet localhost 8080
i command line , when fire code above console see in server's command line
but few seconds later error in console
websocket connection 'wss://10.0.4.160:8443/' failed: error in connection establishment: net::err_timed_out
if try send command using conn.sent('hello')
error
vm289:2 uncaught domexception: failed execute 'send' on 'websocket': still in connecting state. @ error (native) @ <anonymous>:2:6 @ object.injectedscript._evaluateon (<anonymous>:905:140) @ object.injectedscript._evaluateandwrap (<anonymous>:838:34) @ object.injectedscript.evaluate (<anonymous>:694:21)
additionally, tried turn on debugging in strunnel adding debug = 7
this got in stunnel console. don't understand wrong logs show client connected can't send messages client server
2015.08.16 16:40:06 log7[36]: service [websockets] started 2015.08.16 16:40:06 log5[36]: service [websockets] accepted connection 10.0.4.195:21963 2015.08.16 16:40:06 log6[36]: s_connect: connecting 127.0.0.1:8080 2015.08.16 16:40:06 log7[36]: s_connect: s_poll_wait 127.0.0.1:8080: waiting 10 seconds 2015.08.16 16:40:06 log5[36]: s_connect: connected 127.0.0.1:8080 2015.08.16 16:40:06 log5[36]: service [websockets] connected remote server 127.0.0.1:50891 2015.08.16 16:40:06 log7[36]: remote socket (fd=668) initialized 2015.08.16 16:40:06 log6[36]: sni: sending servername: localhost 2015.08.16 16:40:06 log7[36]: ssl state (connect): before/connect initialization 2015.08.16 16:40:06 log7[36]: ssl state (connect): sslv2/v3 write client hello
what doing wrong here? how come connection keeps failing?
Comments
Post a Comment