util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Karel Zak <kzak@redhat.com>
To: "Pádraig Brady" <P@draigBrady.com>
Cc: Andy Lutomirski <luto@amacapital.net>, util-linux@vger.kernel.org
Subject: Re: [PATCH] Add no_new_privs
Date: Mon, 26 Nov 2012 11:08:22 +0100	[thread overview]
Message-ID: <20121126100822.GA4224@x2.net.home> (raw)
In-Reply-To: <50AFE72B.1010908@draigBrady.com>

On Fri, Nov 23, 2012 at 09:14:19PM +0000, Pádraig Brady wrote:
> On 11/23/2012 08:23 PM, Andy Lutomirski wrote:
> >---
> >
> >I'm not 100% sure this is appropriate for util-linux, but it seems useful.
> >
> >I've never written new programs for util-linux before, and I barely understand
> >autotools.  Feedback is welcome :)
> >
> >+no_new_privs \- run program with new_new_privs set
> 
> >+Sets the \fIno_new_privs\fP bit and then executes specified program.  With
> >+this bit set,
> >+.BR execve (2)
> >+will not grant new privileges.  For example, the setuid
> >+and setgid bits as well as file capabilities will not function.  This bit
> >+is inherited by child processes and cannot be unset.  See
> >+.BR prctl (2)
> >+and
> >+.IR Documentation/prctl/no_new_privs.txt
> >+in the Linux kernel source.
> 
> Seems very useful but a bit low level for a user command.
> How about a prctl(1) command or equivalent, that could
> accept that among other options to set.

 It would be nice to have prctl(1) implemented like prlimit(1), it
 means to support --set as well as --get operations.

  prctl --set-endian=big --set-name=foo

  prctl --pid 123    # return all --get-*

  prctl --get-name --pid 123

> I also notice the similar capsh(1) program for doing
> so with capabilities. Perhaps these could be merged
> to a setpriv(1) command or something for tweaking all
> these knobs before exec?

 hmm.. capsh(1) is libcap baby and it probably makes sense to maintain
 it on the same place like libcap.


 I guess that there will be never one super util to set all the
 possible properties (prlimit, personality, scheduler stuff, ....) and
 I personally don't see problem to type

   setarch x86_64 --addr-no-randomize \
   taskset --cpu-list 1,2 \
   prlimit --nofile=1024:4095 \
   nice -20 \
   <myprog>


   Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

  reply	other threads:[~2012-11-26 10:08 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-23 20:23 [PATCH] Add no_new_privs Andy Lutomirski
2012-11-23 21:14 ` Pádraig Brady
2012-11-26 10:08   ` Karel Zak [this message]
2012-11-26 12:45     ` Ángel González
2012-11-26 19:03     ` Andy Lutomirski
2012-11-27  1:39       ` Andy Lutomirski
2012-11-23 22:52 ` Ángel González
2012-12-08  8:19 ` [PATCH] Add setpriv, a tool to set privileges and such Andy Lutomirski
2012-12-08 16:23   ` Ángel González
2012-12-08 19:04     ` Andy Lutomirski
2012-12-09 22:24   ` Pádraig Brady
2012-12-09 23:12     ` Andy Lutomirski
2013-01-08  8:31   ` Karel Zak
2013-01-14 15:33     ` Andy Lutomirski
2013-01-14 15:58   ` [PATCH v2] " Andy Lutomirski
2013-01-26 14:29     ` [PATCH] setpriv: run a program with different Linux privilege settings Sami Kerola
2013-02-04 20:20       ` Andy Lutomirski
2013-02-05  9:05         ` Karel Zak
2013-02-05 10:51           ` Karel Zak
2013-02-06  1:07             ` [PATCH] setpriv: Fix an error message typo Andy Lutomirski
2013-02-06 11:32               ` Karel Zak

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=20121126100822.GA4224@x2.net.home \
    --to=kzak@redhat.com \
    --cc=P@draigBrady.com \
    --cc=luto@amacapital.net \
    --cc=util-linux@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).