using correct SSL protocol when using client from node-json-rpc library
using correct SSL protocol when using client from node-json-rpc library
I am using this library https://www.npmjs.com/package/node-json-rpc to make client calls to https server exposing RPC apis.
However, when I run the code, I get this error
Error: SSLv3 methods disabled
at new SecureContext (_tls_common.js:50:20)
at Object.createSecureContext (_tls_common.js:89:13)
at Object.connect (_tls_wrap.js:1120:48)
at Agent.createConnection (https.js:119:22)
at Agent.createSocket
My code is
var rpc = require('node-json-rpc');
var options =
port: 443,
host: 'mynode',
path: '/rpc',
strict: true,
ssl:
// protocol: 'TLSv1.2'
;
this.client = new rpc.Client(options);
this.client.call(
"jsonrpc": "2.0", "method": "txpool_content", "params": , "id": 1,
function (err, res)
if( err )
resolve(null);
else
resolve(res.result);
);
I made sure that this api works from Postman with this endpoint https://mynode/rpc
https://mynode/rpc
I understand that this protocol SSLv3
might be disabled for node js, but I don't find any other options in the documentation.
I don't have the cert and the key.
SSLv3
https
1 Answer
1
From the library code (node_modules/node-json-rpc/lib/rpcclient.js
):
node_modules/node-json-rpc/lib/rpcclient.js
if (conf.ssl) {
options.servername = conf.ssl.sniName || 'RPC-Server';
options.secureProtocol = conf.ssl.protocol || 'SSLv3_client_method';
...
So, it looks like you can set ssl: protocol: 'something'
in your options.
ssl: protocol: 'something'
What is that something
? Let's go looking through the Node.js docs:
something
https://nodejs.org/api/https.html:
The following additional options from tls.connect()
are also accepted: ... secureProtocol
...
tls.connect()
secureProtocol
https://nodejs.org/api/tls.html#tls_tls_connect_options_callback:
secureProtocol
<string>
Optional SSL method to use. The possible values are listed as SSL_METHODS
, use the function names as strings. For example, 'TLSv1_2_method'
to force TLS version 1.2
secureProtocol
<string>
SSL_METHODS
'TLSv1_2_method'
The example they give would be a good place to start, but that page also links to a full list of the available SSL methods: https://www.openssl.org/docs/man1.1.0/ssl/ssl.html#Dealing-with-Protocol-Methods
Thanks a lot, I solved the problem using
TLSv1_2_client_method
– user3288346
Aug 22 at 1:24
TLSv1_2_client_method
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
This library is ancient, has not been updated in a long time, and does not appear to be available on GitHub any longer. I would suggest rewriting your code to use Node's
https
module directly.– jnylen
Aug 22 at 1:16