-
Notifications
You must be signed in to change notification settings - Fork 695
By default accept requests from localhost only #529
Conversation
The default behavior of nodejs http server when not specifying hostname is listen to 0.0.0.0 for IPv4 or :: for IPv6, which means accept connections on all IP address. This patch specifes the hostname to localhost when the hostname was not specified in command line argument (-h and --hostname), because: * Let RPC port opening to world is a bad idea. * The default behavier of geth is listening to localhost only. * I believe it is the original intention, see the message from L189.
Thanks for contributing @zhouer! I agree that we should not default to all IP addresses. Unfortunately |
Thanks for your review, how about this. |
This is better @zhouer, thanks for the quick turn around. I'm going to discuss this offline with the other devs to see if this is the best approach to the problem at hand |
Hi @zhouer - thanks for submitting! Normally I wouldn't hesitate to accept this, but in essence it's a breaking change. For example this change might break scripts or containerized setups which rely on bridged networking if either fail to specify a hostname explicitly. If you experiencing some acute pain as a result of this default being set the way it is, I'm eager to do something about it. Otherwise, I worry about the maintenance burden that this change will cause. Typically we like to plan out major releases a bit, whereas we're willing to make minor/patch releases fairly ad-hoc. However I think our stance on major release numbers is softening. Thinking aloud here, I think the right strategy might be to open/announce a merge window for breaking changes so that others may propose similar breaking changes. If you have any thoughts on this, I'd love to hear them. |
Hi @benjamincburns, Just do whatever make you guys comfortable. I can always use However, I did suffer from this issue. I noticed this issue because sometimes my dapp didn't work as expect, but after restarting ganache my dapp became normal again. At beginning I thought it's a bug from ganache, so I just keep restarting ganache again and again, but then I found there were still logging messages came out even when I was not using ganache. And then I figured out there were somebody trying to steal all the balance, and caused my dapp failed at random point. Moreover, the |
Hmm... strange that we write |
A separate note @zhouer: I highly suggest you use a firewall to close all ports for applications that don't need to be open ports. 8545 should not be open to prevent these kinds of issues. Further, you can specify the firewall rules to be interface-specific. |
👍 for patch fix -- the number of people using this on an external interface is really low. Also 👍 for |
To that I should say, thanks @zhouer! |
Thank you guys! |
Hello @zhouerm, @tcoulter, @seesemichaelj , This PR breaks Docker integration. Using Please advise, Edit: OK so using |
Hi @dragos-vlad |
@dragos-vlad Sorry for the delay! Using |
@seesemichaelj Yeap, this is how I'm using it now. What I'm trying to explain is that this should be the default in the Dockerfile, since this is the expected behaviour when running a server in Docker. |
The default behavior of nodejs http server when not specifying hostname
is listen to 0.0.0.0 for IPv4 or :: for IPv6, which means accept
connections on all IP address. This patch specifes the hostname to
localhost when the hostname was not specified in command line argument
(-h and --hostname), because: