netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Crispin Cowan <crispin@crispincowan.com>
To: "Serge E. Hallyn" <serue@us.ibm.com>
Cc: Matthew Wilcox <matthew@wil.cx>,
	Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
	paul.moore@hp.com, akpm@linux-foundation.org,
	linux-kernel@vger.kernel.org,
	linux-security-module@vger.kernel.org, takedakn@nttdata.co.jp,
	linux-fsdevel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [TOMOYO #7 30/30] Hooks for SAKURA and TOMOYO.
Date: Sun, 13 Apr 2008 19:05:16 -0700	[thread overview]
Message-ID: <4802BBDC.1030707@crispincowan.com> (raw)
In-Reply-To: <20080413163658.GC7010@sergelap.austin.ibm.com>

Serge E. Hallyn wrote:
> Quoting Matthew Wilcox (matthew@wil.cx):
>   
>> On Fri, Apr 11, 2008 at 11:12:27PM +0900, Tetsuo Handa wrote:
>>     
>>> Matthew Wilcox wrote:
>>>       
>>>> When the rule is put in place, say "No modifications to /etc/passwd",
>>>> look up the inode and major:minor of /etc/passwd.  If there's a rename,
>>>> look up the new inode number.  If it's mounted elsewhere, it doesn't
>>>> matter, they still can't modify it because it has the same
>>>> major:minor:inode.
>>>>         
>>> If write access is denied because of a rule "No modifications to /etc/passwd",
>>> a rule "Allow modifications to /tmp/passwd" can no longer be enforced after
>>> "mount --bind /etc/ /tmp/" or "mount --bind /etc/passwd /tmp/passwd" or
>>> "mv /etc/passwd /tmp/passwd" or "ln /etc/passwd /tmp/passwd" is done.
>>>       
>> That's a fundamental limitation of pathname-based security though.
>> If the same file exists in two places, you have to resolve the question
>> of which rule overrides the other.
>>     
> In the past, Crispin has given clear, concise explanations of a few of
> the things pathname based access control in fact excels at.  Crispin,
> can you recite those again so we can think constructively about which
> (if any) of the currently considered options are or are not sufficient?
>
> I.e. what would be a motivation for a rule like 'no modifications to
> /etc/passwd', and what precisely would and would not be accepted ways to
> get around it (and why)?
>   
As I just posted, a rule of "no mods to /some/pathname" is broken, which 
is why AppArmor has no such construct.

Things that pathname-based access control is good at:

    * *System Integrity:* Many of the vital components of a UNIX system
      are stored in files with Well Known Names such as /etc/shadow,
      /var/www/htdocs/index.html and /home/crispin/.ssh/known_hosts. The
      contents of the actual data blocks is less important than the
      integrity of what some random process gets when it asks for these
      resources by name. Preserving the integrity of what responds to
      the Well Known Name is thus easier if you restrict access based on
      the name.
    * *Dynamic Access Control:* A special case of the above pertains to
      files that may or may not exist. If you don't *have* a /etc/hosts
      file, it is still important to have a rule that controls whether
      it can be created. This is hard to do in label-based systems,
      because the file does not exist to put a label on, so you have to
      kludge it by either creating the file with zero length and
      labeling it, or by creating more complex policy for the parent
      /etc directory, and that's hard given the number of uses for /etc
      such as /etc/motd. In a name based scheme, you simply don't
      provide write permission to "/etc/hosts" unless you mean it, and
      it can be enforced even if such a file does not exist.
    * *Ad Hoc Generalization:* Label-based access control generalizes
      policy in that the policy treats all files and resources that
      share a label the same. If you want to make a new generalization
      that encompasses *part* of the files that share a label, but *not
      all* of those files, then you have to "split the label", relabel
      the file system, and revise the policy accordingly. Name-based
      access control lets you create ad hoc generalizations, so that
      *my* policy can grant access to "/var/www/*.pl" without regard to
      whatever labels or rules some other policy has applied to the same
      directory tree.
    * *Familiar Interface:* Administrators are accustomed to
      administering the box in terms of the names of the files that
      matter. A name-based policy is therefore somewhat more familiar
      than a policy with label abstractions, where they then have to go
      look at the restorecon file to discover what files will/should
      have what labels.
    * *Practical Concerns:* Not all file systems support labels, and so
      label-based schemes become coarse grained when they run into them.
      Name based schemes remain granular when specifying access down
      into the internals of such file systems. Legacy Linux file systems
      like ext2 don't matter much any more, but persistent file systems
      that will never have label support include NFSv3 file systems
      (nearly every Network Appliance NAS server out there) and FAT32
      file system (most every USB storage device).

A lot of what's going on is the duality of the one:many relationships 
between labels and names:

    * Labels: one label represents many files
          o this property is why ad hoc generalization fails in label
            based systems
    * Names: many names can represent a single file
          o This property is why deny rules fail in name based systems

Therefore, I am not claiming name-based access controls to be the 
ultimate. Rather, there are duals for all of the above that induce 
circumstances where label-based systems are superior. Each class of 
system has strengths and weaknesses. These are name-based strengths.

Crispin

-- 
Crispin Cowan, Ph.D.               http://crispincowan.com/~crispin
The Olympic Games: Symbolizing oppression and corruption for over a hundred years


  reply	other threads:[~2008-04-14  2:08 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20080404122242.867070732@I-love.SAKURA.ne.jp>
2008-04-04 12:22 ` [TOMOYO #7 07/30] Some wrapper functions for socket operation Tetsuo Handa
2008-04-04 12:23 ` [TOMOYO #7 30/30] Hooks for SAKURA and TOMOYO Tetsuo Handa
2008-04-04 16:29   ` Daniel Walker
2008-04-07 13:56     ` Tetsuo Handa
2008-04-07 15:39       ` Daniel Walker
2008-04-07 15:40   ` Paul Moore
2008-04-07 22:57     ` Casey Schaufler
2008-04-09  8:37     ` Toshiharu Harada
2008-04-09 12:49       ` Stephen Smalley
2008-04-10  5:57         ` Toshiharu Harada
2008-04-10 12:51           ` Stephen Smalley
2008-04-11 11:48             ` Toshiharu Harada
2008-04-09 13:11       ` Matthew Wilcox
2008-04-09 13:26         ` Stephen Smalley
2008-04-11 14:12         ` Tetsuo Handa
2008-04-11 14:30           ` Matthew Wilcox
2008-04-12 11:33             ` Tetsuo Handa
2008-04-13 16:36             ` Serge E. Hallyn
2008-04-14  2:05               ` Crispin Cowan [this message]
2008-04-14 14:17                 ` Stephen Smalley
2008-04-14 17:05                   ` Casey Schaufler
2008-04-15  4:59                   ` Crispin Cowan
2008-04-16 16:31                     ` Stephen Smalley
2008-04-17  7:49                       ` Crispin Cowan
2008-04-17  8:45                         ` Jamie Lokier
2008-04-17 12:42                         ` Stephen Smalley
2008-04-15 13:00                 ` Toshiharu Harada
2008-04-14  1:41             ` Crispin Cowan
2008-04-14 13:48               ` Matthew Wilcox
2008-04-15  3:21                 ` Crispin Cowan
2008-04-15  4:57                   ` Al Viro
2008-04-09 13:22       ` Serge E. Hallyn
2008-04-11  3:57         ` Toshiharu Harada

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=4802BBDC.1030707@crispincowan.com \
    --to=crispin@crispincowan.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=matthew@wil.cx \
    --cc=netdev@vger.kernel.org \
    --cc=paul.moore@hp.com \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    --cc=serue@us.ibm.com \
    --cc=takedakn@nttdata.co.jp \
    /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).