The capabilities manpage is rather long and I do not fully understand some things.
How would look, for example, a function that decides whether we have access to CAP_NET_RAW?
Input:
- a = Effective uid is 0
- b = There are some real/saved/whatever uid that is 0
- c = CAP_NET_RAW is +e
- d = CAP_NET_RAW is +i
- e = CAP_NET_RAW is +p
- f = CAP_NET_RAW is excluded from the "bounding set"
Output:
- x = we can now call
socket
and not get EPERM - y = after some trickery (not involving filesystem-based
chmod +s
orsetcap
access elevations or connecting to external helpers), e.g. withcapsetp
we can finally allow ourselves to open the raw socket.
As I currently understand it is something like this:
- x = !f && (a || c)
- y = !f && (b || a || c || e)
How is it in reality?