From: Andy Lutomirski <luto@stanford.edu>
To: linux-kernel@vger.kernel.org, glasgow@beer.net,
albert@users.sourceforge.net
Subject: Re: posix capabilities inheritance
Date: Fri, 24 Oct 2003 01:44:36 -0700 [thread overview]
Message-ID: <3F98E674.6090104@stanford.edu> (raw)
In-Reply-To: <fa.l1oevhb.1s5k583@ifi.uio.no>
Thanks to everyone for making me realize just how complex / screwed up all of
this is. I think it's fair to say that something should be fixed/changed, but I
don't think that a quick patch is a good idea -- currently capabilities are so
limited that there is little userspace use, and the use that exists is pretty
much limited to Ernie's example. Witness the fact that my patch, as well as
others, appear to break _nothing_. That means that we have the opportunity (2.7
timeframe here) to overhaul the system _once_.
At the risk of premature discussion, here are some thoughts:
1. pI is currently almost useless. If a process really wants a capability to be
dropped after exec, it can drop it itself. So redefine pI to mean "these are
the only capabilities that this process or its children may _ever_ hold."
2. fE is useless. It doesn't seem to have much of a point, and it just adds
complexity. (e.g. look at Windows privileges. they start unenabled, and
programs have to jump through hoops to use them. I see no security benefit.)
So remove fE entirely.
3. The current use of the capability bits is not as fine-grained as it could be,
and lacks the ability to restrict normal users. Redefine it as:
Capability range Function
---------------- -----------------
<0 On by default
0-31 Legacy bounds (see below)
>=32 Off by default
All of the current capabilities retain their current values. New capabilities
above 32 can have a "legacy bound" associated with them, like this:
_u32 legacy_bounds[] = {...};
bool capable(int cap)
{
if(x<32) return (cap in effective set);
else return ( (legacy_bounds[cap] & (bits 0-31 of effective set))
&& (cap in effective set) );
}
This ensures that existing programs that think they have dropped capabilities
(using the old numbering) really have dropped those capabilities. New programs
can do whatever they want, using the new numbering. Some random thoughts of
what the "new" capabilities might look like (where CAP_USER_ means <0 and
CAP_ADM_ means >=32):
Completely new things:
CAP_USER_FSUID /* permission checks can use fsuid */
CAP_USER_FSGID /* permission checks can use fsgid */
CAP_USER_FSWRITE /* can write files */
Saner version of existing features (CAP_SYS_ADMIN, anyone?)
CAP_ADM_MOUNT_BLOCK /* can mount block devices */
CAP_ADM_MOUNT_NONE /* can mount things that are not block devices */
This could be very nice for administrators. Maybe a large block of capability
space could be reserved for userspace use. (Make capabilities 64 bits? Fun!)
Albert -- this fixes one of your complaints.
Capability evolution might look like this:
pI' = pI & fI
pP' = ((fP & X) | pP) & pI'
pE' = pP' & (pE|fP) & (only caps <0 if uid==0 and setuid nonroot)
By the way, even if people are scared of programs mishandling fP!=0, this still
seems very useful just to adjust "per-user" rights.
If there's enough interest, I might try to implement this in the next few weeks
and get it ready for 2.7. There's the risk that if any new scheme goes into a
mainline development kernel, then people will start using it, and it will be
impossible to change it, which is why I'm floating this around now. I don't see
any reason to keep the current system, and, given that there is no de-facto *nix
capability standard, Linux might as well have the best capability system out there.
Any thoughts/suggestions/flames?
Andy
next parent reply other threads:[~2003-10-24 8:46 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <fa.n4rmmgg.2423pm@ifi.uio.no>
[not found] ` <fa.l1oevhb.1s5k583@ifi.uio.no>
2003-10-24 8:44 ` Andy Lutomirski [this message]
2003-10-24 12:41 ` posix capabilities inheritance Theodore Ts'o
2003-10-24 16:44 ` Andy Lutomirski
2003-10-24 20:58 ` David Wagner
[not found] <fa.f26d55g.1qgijbi@ifi.uio.no>
[not found] ` <fa.hq0dft9.9i0obd@ifi.uio.no>
2003-10-24 21:24 ` Andy Lutomirski
[not found] <fa.f4bs2b4.fhub0m@ifi.uio.no>
2003-10-23 22:05 ` Michael Glasgow
2003-10-23 22:59 ` Theodore Ts'o
2003-10-24 1:36 ` Ernie Petrides
2003-10-24 2:19 ` Bernd Eckenfels
2003-10-24 5:10 ` Ernie Petrides
2003-10-25 19:51 ` Pavel Machek
2003-10-23 1:41 Albert Cahalan
[not found] <fa.f9mv0tb.27sf3j@ifi.uio.no>
2003-10-23 1:36 ` Michael Glasgow
2003-10-23 1:57 ` Andy Lutomirski
[not found] <fa.f36f4t9.1rg8j3v@ifi.uio.no>
2003-10-22 7:11 ` Michael Glasgow
2003-10-22 19:40 ` Andy Lutomirski
[not found] <fa.hehull9.10mmngt@ifi.uio.no>
2003-10-21 18:24 ` Andy Lutomirski
-- strict thread matches above, loose matches on Subject: below --
2003-10-21 11:26 Michael Glasgow
2003-10-23 16:46 ` Theodore Ts'o
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3F98E674.6090104@stanford.edu \
--to=luto@stanford.edu \
--cc=albert@users.sourceforge.net \
--cc=glasgow@beer.net \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).