var tlsOptions = { secureProtocol: 'SSLv3_method', // undocumented feature!!! }; var client = this; client.socket = tls.connect(PORT, HOST, tlsOptions, function () { console.log('Connected to remote server: ' + HOST + ':' + PORT); });
Use secureProtocol option if you received error:
[Error: 139927623395104:error:140773F2:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert unexpected message:../deps/openssl/openssl/ssl/s23_clnt.c:658: ]
It's because of the different protocol types: server uses SSL3 and node.js tls module uses TLS1).