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:
Output:
socket
and not get EPERMchmod +s
or setcap
access elevations or connecting to external helpers), e.g. with capsetp
we can finally allow ourselves to open the raw socket.As I currently understand it is something like this:
How is it in reality?
Read the docs a bit more, now it seems like it is this:
x = c
can_regain_caps_without_execve = (a || b) && !NO_NEW_PRIVS && (!SECBIT_NO_SETUID_FIXUP || ( CAP_SETPCAP && !SECBIT_NO_SETUID_FIXUP_LOCKED))
y = c || e || can_regain_caps_without_execve
I.e.