Ylianst / MeshCentral

A complete web-based remote monitoring and management web site. Once setup you can install agents and perform remote desktop session to devices on the local network or over the Internet.
https://meshcentral.com
Apache License 2.0
3.96k stars 536 forks source link

Different port and redirection-port #204

Closed motapek closed 5 years ago

motapek commented 5 years ago

After update to 0.3.3-a when I try start my server by meshcentral.service I gets a different port than in configuration file config.json

$>sudo systemctl start meshcentral.service syslog Apr 26 21:52:14 XXXXXX systemd[1]: Started MeshCentral Server. Apr 26 21:52:16 XXXXXX node[4296]: MeshCentral HTTP redirection server running on port 1024. Apr 26 21:52:16 XXXXXX node[4296]: ERROR: Redirection web server must be active on port 80 for Let's Encrypt to work. Apr 26 21:52:16 XXXXXX node[4296]: MeshCentral v0.3.3-a, Hybrid (LAN + WAN) mode, Production mode. Apr 26 21:52:16 XXXXXX node[4296]: MeshCentral Intel(R) AMT server running aaa.bbb.pl:4433. Apr 26 21:52:16 XXXXXX node[4296]: MeshCentral HTTPS server running on aaa.bbb.pl:1025. Apr 26 21:52:17 XXXXXX node[4296]: SMTP mail server smtp.gmail.com working as expected.

But when I stop meshcentral and run it by: sudo node ./node_modules/meshcentral all it's OK

MeshCentral HTTP redirection server running on port 80. MeshCentral v0.3.3-a, Hybrid (LAN + WAN) mode. MeshCentral Intel(R) AMT server running on aaa.bbb.pl:4433. MeshCentral HTTPS server running on aaa.bbb.pl:443. SMTP mail server smtp.gmail.com working as expected.

My meshcentral.service [Unit] Description=MeshCentral Server [Service] Type=simple LimitNOFILE=1000000 ExecStart=/usr/bin/node /opt/meshcentral/node_modules/meshcentral WorkingDirectory=/opt/meshcentral User=meshcentral Group=meshcentral Restart=always Environment=NODE_ENV=production

Restart service after 10 seconds if node service crashes

RestartSec=10 [Install] WantedBy=multi-user.target

jsastriawan commented 5 years ago

User meshcentral may not have the right to listen to port 80.

motapek commented 5 years ago

After sudo setcap cap_net_bind_service=+ep /usr/bin/node it's ok. Thanks !

Ylianst commented 5 years ago

This problem is talked about in the MeshCentral2 Install Guide. If MeshCentral is run in a way that does not allow binding to ports below 1024, you get this. To fix, you need to grant "node" access to lower ports. Start by figuring out where is the executable for now and run the "setcap" command. For example:

whereis node
node: /home/ec2-user/.nvm/versions/node/v8.11.3/bin/node

sudo setcap cap_net_bind_service=+ep /home/ec2-user/.nvm/versions/node/v8.11.3/bin/node

Hope it helps, Ylian

Ylianst commented 5 years ago

Your fast, closed the issue before I could hit send.