Skip to content
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

Cannot use privileged ports (e.g. 80 and 443) #288

Open
hanjo opened this issue Aug 13, 2023 · 0 comments
Open

Cannot use privileged ports (e.g. 80 and 443) #288

hanjo opened this issue Aug 13, 2023 · 0 comments

Comments

@hanjo
Copy link

hanjo commented Aug 13, 2023

Hi,

I noticed that it is not possible to use privileged ports such as 80 and 443, since the app is not started as root (which is good).

An error message such as this will be created:

Error: listen EACCES: permission denied 0.0.0.0:443
    at Server.setupListenHandle [as _listen2] (node:net:1855:21)
    at listenInCluster (node:net:1920:12)
    at doListen (node:net:2069:7)
    at process.processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on Server instance at:
    at emitErrorNT (node:net:1899:8)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  code: 'EACCES',
  errno: -13,
  syscall: 'listen',
  address: '0.0.0.0',
  port: 443

It is possible to add the capability by doing this as root within the container:

apk --no-cache add libcap
setcap 'cap_net_bind_service=+ep' `which node`
apk del libcap

I'd like to suggest to add the capability to the node binary in the docker container by default.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant