javascript - Socket.io chat server not presenting SSL certificate -
a (simple) chat part of application i've created while back. today i'm switching website http https. therefore have ssl socket.io chat socket, otherwise browsers whine.
for reason though chatserver isn't presenting certificate @ all. using openssl on linux confirms this:
openssl s_client -connect my.subdomain.tld:1337 -servername my.subdomain.tld -ssl3 returns
connected(00000003) 140136057653064:error:1409e0e5:ssl routines:ssl3_write_bytes:ssl handshake failure:s3_pkt.c:596: --- no peer certificate available --- no client certificate ca names sent --- ssl handshake has read 0 bytes , written 0 bytes --- new, (none), cipher (none) secure renegotiation not supported compression: none expansion: none ssl-session: protocol : sslv3 cipher : 0000 session-id: session-id-ctx: master-key: key-arg : none krb5 principal: none psk identity: none psk identity hint: none start time: 1436357417 timeout : 7200 (sec) verify return code: 0 (ok) --- i replaced domains. port 1337 , server uses sni believe have use -servername argument?
my node server (simplified):
var fs = require('fs'); var privatekey = fs.readfilesync('/home/ssl_certificates/my_subdomain_tld.key').tostring(); var certificate = fs.readfilesync('/home/ssl_certificates/my_subdomain_tld.crt').tostring(); var ca = fs.readfilesync('/home/ssl_certificates/addtrustexternalcaroot.crt').tostring(); var io = require('socket.io').listen(1337, {key: privatekey, cert: certificate, 'ca': ca}); the certificates exist @ location , valid (double checked). how can go debugging this? why socket.io not presenting certificate?
as can see in docs listen instance method of server class. instantiate https server first, attach certificates it, , pass server() constructor.
var https = require('https'); var fs = require('fs'); var options = { key: fs.readfilesync('~/.certs/my-sub.key'), cert: fs.readfilesync('~/.certs/my-sub.crt') }; var app = https.createserver(options); var io = require('socket.io')(app); app.listen(1337); there documented ability start server using socket.io described here.options can passed io's server() method listed in engine.io docs. seems can't attach certificates it.
Comments
Post a Comment