subspacecommunity / subspace

A fork of the simple WireGuard VPN server GUI community maintained
MIT License
1.8k stars 131 forks source link

--http-addr won't use ports >1023 #201

Open benrr101 opened 3 years ago

benrr101 commented 3 years ago

Describe the bug When I run subspace from the command line and specify that I'd like it to listen to http messages on ports >1023 (eg 8888), subspace will try to bind to port 80. If I try to do the same thing with a port <=1023, it will try to bind to the port I specified.

To Reproduce Steps to reproduce the behavior:

  1. As a non-root user...
  2. Download the v1.5.0 package, extract, and build
  3. Run subspace --http-host mydomain.com --datadir ~/.subspace --http-addr :8888
  4. Receive error:
    INFO[0000] Subspace version: 1.5.0 https://mydomain.com:1025/
    FATA[0000] http server on port 80 failed: listen tcp :80: bind: permission denied

Expected behavior At this stage, I expect a message to appear telling me that subspace is attempting to bind to port 8888.

Screenshots N/A

Server I'm building the binary to run without docker. CentOS 7.8 x86_64 Go 1.16.6

Desktop (please complete the following information): N/A

Smartphone (please complete the following information): N/A

Additional context My intention was to try to run subspace as a user other than root since I'm used to web servers like apache running as their own user to help isolate the process in case of hacks. This might not be possible anyways since wireguard seems to only like running as root. Nevertheless, this bug seems to preclude me from specifying a port >1023 even if I am running as root.

metalcated commented 3 years ago

Are you using root to perform this command or another account?

On Fri, Jul 16, 2021 at 12:55 AM Benjamin Russell @.***> wrote:

Describe the bug When I run subspace from the command line and specify that I'd like it to listen to http messages on ports >1023 (eg 8888), subspace will try to bind to port 80. If I try to do the same thing with a port <=1023, it will try to bind to the port I specified.

To Reproduce Steps to reproduce the behavior:

  1. As a non-root user...
  2. Download the v1.5.0 package, extract, and build
  3. Run subspace --http-host mydomain.com --datadir ~/.subspace --http-addr :8888
  4. Receive error:

INFO[0000] Subspace version: 1.5.0 https://mydomain.com:1025/ FATA[0000 https://mydomain.com:1025/FATA%5B0000] http server on port 80 failed: listen tcp :80: bind: permission denied

Expected behavior At this stage, I expect a message to appear telling me that subspace is attempting to bind to port 8888.

Screenshots N/A

Server I'm building the binary to run without docker. CentOS 7.8 x86_64 Go 1.16.6

Desktop (please complete the following information): N/A

Smartphone (please complete the following information): N/A

Additional context My intention was to try to run subspace as a user other than root since I'm used to web servers like apache running as their own user to help isolate the process in case of hacks. This might not be possible anyways since wireguard seems to only like running as root. Nevertheless, this bug seems to preclude me from specifying a port >1023 even if I am running as root.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/subspacecommunity/subspace/issues/201, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKRQCVSF4SMLJ4RP4RPIFDTX63UNANCNFSM5AO2YIAQ .

benrr101 commented 3 years ago

I'm not using root to perform this. I created an account named subspace that I intended to use, similar to apache having an apache user. So, yes, that's why I'm getting the permission denied.

But the error indicates that subspace is ignoring any ports >1023. I tried using :8888 and it failed to bind on port :80. This seems like a bug, or should at least be documented somewhere.