Re: [PATCH] 2.6.15: Filesystem capabilities 0.16

From: Olaf Dietsche
Date: Sat Jan 21 2006 - 17:46:23 EST


Sorry for the late response, I've been away for the week.

Horst von Brand <vonbrand@xxxxxxxxxxxx> writes:

> Olaf Dietsche <olaf+list.linux-kernel@xxxxxxxxxxxxxxx> wrote:
>> + For example, you may drop the SUID bit from ping and grant the
>> + CAP_NET_RAW capability:
>> + # chmod u-s /bin/ping
>> + # chcap cap_net_raw=ep /bin/ping
>
> Why the cap_ part? It should be enough to say, e.g.
>
> chcap net-raw=ep /bin/ping
>
> ('_' has SHIFT, normally... '-' is easier to type)

This is the way libcap expects the capabilities string. I never
questioned the format of this string. But it isn't hard to do a simple
mapping.

>> +
>> + Another use would be to run system daemons with their own uid:
>> + # chcap cap_net_bind_service=ei /usr/sbin/named
>> + This sets the effective and inheritable capabilities of named.
>> +
>> + In your startup script:
>> + inhcaps cap_net_bind_service=i bind:bind /usr/sbin/named
>
> AFAIU, the =i implies inherited, why another command to set that?

Look for keep_capabilities in security/commoncap.c. If you do a
setuid() away from root, Linux drops all privileges. Inhcaps does a
setuid() and arranges for keeping the needed capabilities.

Regards, Olaf.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/