|
|
|
|
|
by jolmg
7 days ago
|
|
What kind of use-case do you have for that? I suppose whatever it is, you could also e.g. write a privileged service that checks those files with whatever security policy you need. Your client wouldn't have direct access to /proc. Another option may be to set up a container or PID namespace and give your tool direct access to that /proc. Regarding SELinux, looking at https://unix.stackexchange.com/questions/767564/selinux-deni... > the entries under /proc/<pidnr>/ are running under the respective pid's domain It also seems doable, since you can differentiate which PID directory belongs to what by the domain. |
|
So I want to follow the principle of minimal privileges and only grant access to files needed for running a program. Sadly many programs cannot run without /proc. For example, poorly coded Apple's Grand Central Dispatch library crashes the application (for example, Telegram) if it cannot enumerate the information about threads or processes. It needs this information to calculate how many additional worker threads need to be created, and if it cannot calculate the number, it terminates the application for reasons I do not understand.
There is also a catch that the program can create a new unprivileged user namespace and mount /proc there thus bypassing my daemon completely. Anyone can create a user namespace nowadays.
> Another option may be to set up a container or PID namespace and give your tool direct access to that /proc.
/proc contains information not only about processes, but a lot of extra information.