mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Michael Glasgow" <glasgowNOSPAM@beer.net>
To: <linux-kernel@vger.kernel.org>
Subject: posix capabilities inheritance
Date: Tue, 21 Oct 2003 06:26:45 -0500 (CDT)	[thread overview]
Message-ID: <200310211126.h9LBQjx4097592@dark.beer.net> (raw)

I wrote a simple setuid-root wrapper which sets some capabilities, 
gives up all other privs, and and then execs a shell.  I was hoping
to use this wrapper as a login shell so that I could have a user  
log in interactively with a small subset of elevated privileges.

Unfortunately after looking over the capabilities code in the 2.4
kernel, it would appear that this is not currently possible, and
my wrapper cannot work without filesystem support for capabilities.
And even then, I'd have to set each file's inheritable flag for the
capabilities I want on every executable that I am likely to run,
including the shell.  Am I mising something, or is this an accurate
description?

I think I understand the rationale behind this behavior; the draft
posix 1003.1e specification states:

     The purpose of assigning capability states to files is
     to provide the exec() function with information regarding
     the capabilities that any process image created with the
     program in the file is capable of dealing with and have
     been granted by some authority to use.

So, the lack of an inheritable flag on a file can serve to prevent
that file from executing with the corresponding capability enabled.

Fine, but what about my semi-superuser shell situation?  How can
I force the retention of a capability set across exec() for all
executables?  It would seem that neither the spec nor the current
implementation in the 2.4 kernel allow for this, but it strikes
me as a pretty reasonable and useful thing to do in some cases.

As an interim workaround, how about assuming all capabilities are
inheritable in fs/exec.c:prepare_binprm, i.e. instead of
cap_clear(bprm->cap_inheritable), call cap_set_full() ???  I don't
think this would break anything, and it would make capabilities a
lot more useful until we get fs support merged in.

-- 
Michael Glasgow < glasgow at beer dot net >

             reply	other threads:[~2003-10-21 11:26 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-21 11:26 Michael Glasgow [this message]
2003-10-23 16:46 ` Theodore Ts'o
     [not found] <fa.hehull9.10mmngt@ifi.uio.no>
2003-10-21 18:24 ` 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.f9mv0tb.27sf3j@ifi.uio.no>
2003-10-23  1:36 ` Michael Glasgow
2003-10-23  1:57   ` Andy Lutomirski
2003-10-23  1:41 Albert Cahalan
     [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
     [not found] <fa.n4rmmgg.2423pm@ifi.uio.no>
     [not found] ` <fa.l1oevhb.1s5k583@ifi.uio.no>
2003-10-24  8:44   ` Andy Lutomirski
2003-10-24 12:41     ` 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

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=200310211126.h9LBQjx4097592@dark.beer.net \
    --to=glasgownospam@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

all inboxes | Powered by JetHome®