-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Binding IP for nodejs #11
Comments
Is this something different than URL settings or other settings keys ? |
I reviewed the sources of the package, but the only parameter i discovered "wekan root-url" which might be suitable was not able to limit the listen port to 127.0.0.01.
|
For localhost it should be http://localhost . For running on port 80 you would need to to give permission to bind to lower ports: I don't know is it possible to bind to port 80 inside snap. It does work in source installs like with VirtualBox at https://wekan.xet7.org . Usually root-url is setup to IP address like http://192.168.10.100 or domain name like http://example.com . Another way is to have Caddy or Nginx proxy in front of Wekan, there is examples at Wekan GitHub wiki. |
In settings keys there is port option to change port. |
But setting "port" to "127.0.0.1:8080" haven't resulted in a listen on loopback. It should look like this :-)
|
I believe this is controlled by MONGO_URL env value on nodejs side. In case of wekan snap, when you set "MONGODB_BIND_IP" this will result in two actions:
This might look complicated but logic behind was that you can freely configure wekan snap for your setup. Then mongo can be shared with different snap(s) (e.g. rocket chat). In this case it's better to run one instance, rather each snap having own independent mongo. If I remember right, there might be way for wekan and rocket share users like this…. |
MongoDB is not in the focus of what i am requesting. If nodejs is bound to 127.0.0.1:8080 i can use caddy, apache or nginx to provide secure access to wekan. This prevents bypass access i.e. without ssl encryption to wekan. |
It is still not possible to limit the listen ip to 127.0.0.1:5000 to prevent direct connections to nodejs from network without using iptables. |
I have test build with caddy support build inside. I'm still waiting for snapd to land some extra changes |
+1 on rebinding node to 127.0.0.1. It's normally how you shunt nginx / apache reverse proxy over to it - locally only, and the reverse proxy is only what's reachable from the network. I'm using iptables to prevent visitors accessing the port 8080 node instance until this is a configurable item |
@huornlmj @scoopex I'm not familiar with node how to make it bind only on localhost. |
Looks like this is simple config for server.listen(,); |
Anyone can add changes to Wekan as pull requests to devel branch. I have not yet looked where that server.listen is defined, but it could be set in environment variable when correct place in code is found. I check those pull requests from wekan/wekan repo and merge them to Wekan. I could also add the change if I find the correct place to add it. Generally all settings need to be able to be set as environment variables for future integrations to other platforms. |
I just want to ask or try to understand why the main application wekan (or the nodejs webserver) cant bind on 127.0.0.1. I installed wekan via snap and and changed the bind port, but cant change the bind-IP. Wekan/Node is still listening on 0.0.0.0:3001 and not 127.0.0.1:3001. The problem now, my wekan is reachable via 80, 443 and 3001. Port 80 ist redirected to 443 via nginx, that works fine. But wekan is also reachable via wekan.example.com:3001 (no https!). So you can bypass the encryption. Any idea how to bind-ip on 127.0.0.1? |
Wekan could bind to localhost, if someone looks at code, figures out how, and submits pull request. I'm just thinking, don't you use any firewall on your server? So only http/https/ssh would be exposed? Like for example:
|
It would be safer to leave it bound to localhost on a high order port (denoting that it's not running as a privileged user) and using a reverse proxy instead like apache or nginx which would take care of TLS also. |
Thanks for your answer! Sorry i forgot to write that i handle this "behavior" with a firewall. Im just opening 80 and 443. But it would be nice to bind-IP on localhost. Thanks for your work! |
Wekan runs in strict sandboxing of Snap, code directories are read-only, and only modifiable directory is For running Wekan without sandboxing of Snap/Docker/Sandstorm, node only needs this bind capability, not full root: For "nice to have" issues like binding on localhost, those are usually fixed by anyone in Wekan Community, like a good first issue for beginner programmer, using code search like this:
For snap, files are at |
i just installed wekan snap after a reverse proxy. so i googled and found this github issue. +1 from me for it ;-) It would be nice and good security hygiene to be able to set the bind ip to 127.0.0.1 via a snap set . |
hello @huornlmj in a separte layer I'm adding nginx service that pointed on the app server which will contain wekan with above configuration. :) I hope it's useful for you, |
hello@xet7, |
@Lycky-Shi I don't know, just a moment I test. |
Do you mean in general connecting to Wekan Snap MongoDB database? Or do you mean connecting Wekan Snap to some other than snap-included MongoDB database, like MongoDB database that is hosted at some other server IP address, username and password? |
Thanks for your response. In general the bind ip address of Wekan Snap MongoDB database is 127.0.0.1, i want to change it to 0.0.0.0 and make Wekan connecting to Wekan Snap MongoDB database by authenticated. i set the bind ip: but i don't know how to set that: i also don't know how to make Wekan Snap connect some other than snap-included MongoDB database, like MongoDB database that is hosted at some other server IP address, username and password. Looking forward to your answer , thinks. |
Or how Wekan Snap connect MongoDB that isn't from other snaps? Thanks. |
This snap package provides the possibility to bind mongodb to a specific ip address using the parameter "mongodb-bind-ip. It would be great to bind also "nodejs" to a specific ip.
From a security point of view it would be good to have "127.0.0.1" as default in both cases.
The text was updated successfully, but these errors were encountered: