EOSIO / eosjs

General purpose library for the EOSIO blockchain.
http://eosio.github.io/eosjs
MIT License
1.43k stars 463 forks source link

EOS RPC-API through HTTPS with self signed certificate #326

Closed syncro2017 closed 6 years ago

syncro2017 commented 6 years ago

Hi Everyone, Is it possible to work with nodeos RPC-API secured with HTTPS using self signed cert? When i access it using web browser there is no issue, however when i try to do the same from our react-native app using eosjs it doesn't work. When i looked at the wireshark, it clearly shows device dropping the connection to the server right after receiving a self signed cert, error message in the debugger says can't establish connection.

jcalfee commented 6 years ago

From node or the browser? I think you can load the self signed cert into the browser manually, there are directions online I have done this before. You could make a html page to make it easier.

Lets encrypt does not ask any personal questions and will re-issue free certs to your server. This will probably be a better experience:

https://letsencrypt.org/

The API access configuration may be tuned here incase you need something. The config is pass-through so anything that works in eosjs-api config works in eosjs config:

https://github.com/EOSIO/eosjs-api#optionsfetchconfiguration-example

syncro2017 commented 6 years ago

@jcalfee , Thanks a lot for the reply. I'm looking at eosjs-api code but can't find any description of all the possible configuration options, sorry if this is a dumb question but i'm not a java script pro :(, can you please point me where i can get the list of all the configuration options eosjs-api supports? your help is very appriciated

jcalfee commented 6 years ago

This is all of them so far: https://github.com/EOSIO/eosjs-api#configuration

syncro2017 commented 6 years ago

@jcalfee Thanks a again, i saw this , unfortunately there is no way to pass the option to accept self signed certs so it can be passed to the SSL/TLS context struct down the road. no worries, i'll just have to move the node outside and get a proper cert with letsencrypt thanks for all your help

jcalfee commented 6 years ago

import the public part of the self-signed cert into the browser OR use letsencrypt

syncro2017 commented 6 years ago

we are using EOSJS from react native running on mobile so not using the browser :(

jcalfee commented 6 years ago

you did say that .. ok, thanks for the reminder. I'll keep this in mind..

jcalfee commented 6 years ago

It is the same though, RN should have a way to import a ssl cert .. If not, that is not very decentralized is it..

syncro2017 commented 6 years ago

Actually i found a solution to this issue, all that needs to be done is to install the certificates on IOS devices and make them trusted, lots of tutorials online, same goes for the IOS simulator in xcode. All works perfect now :) Thanks for all your help