netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "C. Scott Ananian" <cscott@laptop.org>
To: "Evgeniy Polyakov" <zbr@ioremap.net>
Cc: "Michael Stone" <michael@laptop.org>,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH] Security: Implement and document RLIMIT_NETWORK.
Date: Wed, 7 Jan 2009 13:35:13 -0500	[thread overview]
Message-ID: <c6d9bea0901071035p1b8b4fc1u49bc7bb7c89782a@mail.gmail.com> (raw)
In-Reply-To: <20090107114703.GB28161@ioremap.net>

On Wed, Jan 7, 2009 at 6:47 AM, Evgeniy Polyakov <zbr@ioremap.net> wrote:
>> +This facility is particularly attractive to security platforms like OLPC
>> +Bitfrost [2] and to isolation programs like Rainbow [3] and Plash [4] because:
>> +  * it integrates well with standard techniques for writing privilege-separated
>> +    Unix programs
>> +  * it's available to unprivileged programs

> It isn't, since it can not set rlimit, and if it can, it still can drop it.

Privilege dropping is voluntary, in the same way that a setuid root
program can voluntarily drop root permissions after it has finished
using them.  (Standard example: apache starts as root to open port 80,
and then drops root by changing uid to www or nobody before it
actually processes requests.)

If I understand correctly, rlimit has both 'hard' and 'soft' limits.
An unpriviledged process can change its soft limit at will, up to the
hard limit, but can only *irrevocably lower* its hard limit. (man 2
setrlimit)

I haven't reviewed the patch to confirm this, but this is how I would
expect RLIMIT_NETWORK functions.  A trusted process like inetd (say)
would accept a network connection and create a file handle.  It would
then fork, drop the hard and soft RLIMIT_NETWORK to 0, and then exec
the untrusted client program.  This would allow the untrusted program
to use the 'trusted' network resource via the open file handle, but
prevent it from (say) leaking sensitive transaction data by making
further connections to some other network resource.  (There are better
use cases than inetd, of course.)

According to man 2 setrlimit, "A child process created via fork(2)
inherits its parent's resource limits.  Resource limits are preserved
across execve(2).".
 --scott

-- 
                         ( http://cscott.net/ )

  parent reply	other threads:[~2009-01-07 18:35 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-07  5:48 RFC: Network privilege separation Michael Stone
2009-01-07  5:48 ` [PATCH] Security: Implement and document RLIMIT_NETWORK Michael Stone
2009-01-07 11:47   ` Evgeniy Polyakov
2009-01-07 16:52     ` Rémi Denis-Courmont
2009-01-07 17:48       ` Evgeniy Polyakov
2009-01-07 20:54         ` Rémi Denis-Courmont
2009-01-07 21:42           ` Evgeniy Polyakov
2009-01-07 18:35     ` C. Scott Ananian [this message]
2009-01-07 19:02       ` Evgeniy Polyakov
2009-01-07 19:39         ` Evgeniy Polyakov
2009-01-07 21:07     ` Michael Stone
2009-01-07 21:59       ` Evgeniy Polyakov
2009-01-08  0:56         ` Michael Stone
2009-01-08  4:27           ` Evgeniy Polyakov
2009-01-08  1:22       ` James Morris
2009-01-08  3:34         ` Michael Stone
2009-01-07 21:10 ` RFC: Network privilege separation Andi Kleen
2009-01-08  2:31   ` Michael Stone
2009-01-08  3:10     ` Andi Kleen
2009-01-08  4:51       ` Michael Stone
2009-01-08  5:41         ` Andi Kleen
2009-01-08  7:05       ` Oliver Hartkopp
2009-01-08  7:52       ` david
2009-01-08 10:43     ` Alan Cox
2009-01-12 18:44       ` Valdis.Kletnieks
2009-01-12 19:09         ` Bryan Donlan
2009-01-12 19:43         ` Andi Kleen
2009-01-12 19:47           ` Rémi Denis-Courmont
2009-01-12 20:14             ` Andi Kleen
2009-01-12 20:15               ` Rémi Denis-Courmont
2009-01-12 20:27                 ` Evgeniy Polyakov
2009-01-12 20:39                 ` Andi Kleen
2009-01-12 20:30                   ` Rémi Denis-Courmont
2009-01-12 20:55                     ` Andi Kleen
2009-01-12 20:47                       ` Rémi Denis-Courmont
2009-01-12 21:50                         ` Andi Kleen

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=c6d9bea0901071035p1b8b4fc1u49bc7bb7c89782a@mail.gmail.com \
    --to=cscott@laptop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael@laptop.org \
    --cc=netdev@vger.kernel.org \
    --cc=zbr@ioremap.net \
    /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).