3 ms·
This is missing the whole point of privileged ports. The problem is that I tell you "connect to my webserver on port 80" you want to connect to the actual webse
by kevincox 4y ago
This is missing the whole point of privileged ports. The problem is that I tell you "connect to my webserver on port 80" you want to connect to the actual webserver that I expect to be there. If port 80 isn't privileged any user on the system can bind that port before the webserver starts or if it crashes. Even with TLS this is a DoS attack.
What I really want is to be able to delegate specific ports to different processes. CAP_NET_BIND_SERVICE can be used to allow a process to bind any port but I want to be able to allow it to bind just a single port. My webserver can bind 80 and 443 but not 25. The MTA can bind 25 but not 80.
Currently there are two main approaches to this.
1. Socket activation/passing. This has a huge number of other benefits as well. The service manager can keep the socket open across restarts, crashes or even do on-demand startup to save resources without losing a single connection.
2. A proxy that binds the privileged ports and then proxies to UNIX sockets or other things. This is fairly similar to 1 expect that it doesn't necessarily have to spawn the program. This way only a single process has the permission to bind all of these ports, every other service just creates a UNIX socket which is bound by filesystems privileges.
The real model I want isn't privileged and unprivileged, it is "assigned" and "ephemeral" ports. Assigned ports can only be bound by services that were explicitly granted access to that port. ephemeral ports are always random addresses and never collide with assigned ports. But the privileged/unprivileged split is close enough.
- fbhabbed 4y ago> allow a process to bind any port but I want to be able to allow it to bind just a single port 3. SELinux