]> git.ipfire.org Git - thirdparty/mtr.git/commit
Fix Capability Management, Retain CAP_NET_ADMIN
authorflu0r1ne <flu0r1ne@flu0r1ne.net>
Fri, 29 Sep 2023 08:07:54 +0000 (03:07 -0500)
committerflu0r1ne <flu0r1ne@flu0r1ne.net>
Fri, 29 Sep 2023 23:36:37 +0000 (18:36 -0500)
commit1b519cde3e1e23b11a2ab94c43b0d10ae5a9e588
tree2061615f879b5601aeee18db14d17cc545a14289
parent74d312d7e67d002e184b37c7f278597ab06bf8e7
Fix Capability Management, Retain CAP_NET_ADMIN

Modify the capability-dropping logic to specifically retain CAP_NET_ADMIN if it
is initially provided, in adherence to least-privilege principles.

Details:
1. Update the `drop_excess_capabilities` function to only drop capabilities that
   are unnecessary, retaining CAP_NET_ADMIN when needed for setting the socket
   mark.
2. Introduce logic in `set_socket_mark` to temporarily elevate CAP_NET_ADMIN
   into the effective set for the duration of the packet mark setting
   operation.
packet/construct_unix.c
packet/packet.c