I'm working on a setup for a Linux based system in which user applications are executed in Linux Containers to provide confinement and limited capabilities. Each application is launched under in a container with a specific user ID.
Now, given that some of these applications are going to have server roles, I would like to be able to control which ports a specific user can bind (both TCP and UDP). One solution is manually polling /proc/net/(tcp|udp)6
? but this is very inefficient for obvious reasons. So, I was wondering if there is a better way to do this?
AppArmor and SELinux can be used to restrict network access by processes.
There is also iptables user match.