nodejs-verge icon indicating copy to clipboard operation
nodejs-verge copied to clipboard

ECONNRESET Error when making calls. (Using SSL)

Open haydencarlson opened this issue 7 years ago • 5 comments

Here is my VERGE.conf

server=1
rpcuser=
rpcpassword=
rpcport=20102
rpcssl=1
rpcsslcertificatechainfile=verged.crt
rpcsslprivatekeyfile=verged.pem
rpcallowip=0.0.0.0/0

I've tried some wildcard certs I had laying around but also tried

  openssl genrsa -out server.pem 2048
  openssl req -new -x509 -nodes -sha1 -days 3650 -key verged.pem > verged.cert

Whenever I try to make a call it returns ECONNRESET. I can't see anything in the VERGEd log. Also if I try to use it without SSL it returns 403 forbidden error everytime.

var fs = require('fs')

var ca = fs.readFileSync('verged.crt')

var verge = require('node-verge')({
  user: 'rpcusername',
  pass: 'rpcpassword',
  https: true,
  ca: ca
})

I'm using the library just like the docs say here, reading the .crt file creating from before.

VERGEd is running on a ubuntu 16.04 machine, and I'm trying to connect remotely with node-verge.

haydencarlson avatar Oct 04 '18 19:10 haydencarlson

Thanks for your submission, I just tried everything exactly like you did but running the node remotely. (my system: MacOS Mojave)

script:

var fs = require('fs');

var ca = fs.readFileSync('./verged.cert');

var verge = require('node-verge')({
  user: 'kyon',
  pass: 'lolcat',
  https: true,
  ca: ca,
}).send('getinfo', info => {
  console.log(info);
});

Config:

server=1
rpcuser=kyon
rpcpassword=lolcat
rpcport=20102
rpcssl=1
rpcsslcertificatechainfile=verged.cert
rpcsslprivatekeyfile=verged.pem
rpcallowip=0.0.0.0/0
gen=0
printtoconsole=1

And receiving: Error: self-signed certificate, because it's true but I can actually connect to it. So it has something to do with your remote access. Please make sure that no firewall or something else is blocking it. Maybe try to run this exact same setup on your local machine.

marpme avatar Oct 04 '18 20:10 marpme

I have it working now without an SSL on the same server as the node. (No remote connection)

I'm not sure why it wasn't working remotely, because the port was open and I could hit the node without the ssl but it would just get a forbidden error.

haydencarlson avatar Oct 04 '18 22:10 haydencarlson

Maybe your way to "allow" IP's is wrong there? I check an example config and there it is noted like this:

# By default, only RPC connections from localhost are allowed.  Specify
# as many rpcallowip= settings as you like to allow connections from
# other hosts (and you may use * as a wildcard character):
rpcallowip=10.1.1.34
rpcallowip=192.168.1.*

https://github.com/vergecurrency/VERGE/blob/8f22bd819d723e7f71eb5a43a50782b3b96e2dd8/contrib/debian/examples/VERGE.conf#L40

marpme avatar Oct 05 '18 06:10 marpme

Please give us a short feedback, if everything is working for you so we can mark it as resolved. Thank you 👍

marpme avatar Oct 07 '18 09:10 marpme

I changed rpcallowip to how you said and still nothing remotely. I'm using it locally to the node so it's not a big issue. If I do get it to connect remotely to the node I will let you know.

haydencarlson avatar Oct 09 '18 16:10 haydencarlson