I want to set up a private network of applications which can connect to a single Geth node. What options do I have for exposing the RPC server?
I'm running this: geth --rpc --testnet
(sometimes I use --dev
)
How can I achieve the following:
- Permit specific public/private keys to access the node
- Permit anyone to access the node
- Permit IP range to access the node
Possible solution?
Would this just require running a reverse proxy with a server like Nginx?
Best Answer
You can easily and securely create an SSH tunnel to your ETH Node from the application server. This way, the ETH node is fooled into believing that the connection is from localhost and you can ensure that only the holder of a private key can access.
Once you have set that up you can create a tunnel by running a command like:
Once this command has been issued all traffic to
port 9545
onlocalhost
will be forwarded toremotehost.remotedomain.tld:8545
which will consider it to have originated fromlocalhost
and be targeted atlocalhost:8545
This way, you can keep your ETH node behind a firewall and not open it up to the world but still centralize the functionality.
In order to use this in production, you will have to solve the issue of disconnecting SSH sessions.