All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Paris <eparis@redhat.com>
To: "Christopher J. PeBenito" <cpebenito@tresys.com>
Cc: selinux <selinux@tycho.nsa.gov>,
	sds@tycho.nsa.gov, jmorris@namei.org,
	Paul Moore <paul.moore@hp.com>
Subject: Re: [PATCH -v2] SELinux: create new open permission
Date: Thu, 28 Feb 2008 14:00:33 -0500	[thread overview]
Message-ID: <1204225233.3206.120.camel@localhost.localdomain> (raw)
In-Reply-To: <1204224606.32061.218.camel@gorn>


On Thu, 2008-02-28 at 13:50 -0500, Christopher J. PeBenito wrote:
> On Thu, 2008-02-28 at 12:58 -0500, Eric Paris wrote:
> > Adds a new open permission inside SELinux when 'opening' a file.  The
> > idea is that opening a file and reading/writing to that file are not the
> > same thing.  Its different if a program had its stdout redirected
> > to /tmp/output than if the program tried to directly open /tmp/output.
> > This should allow policy writers to more liberally give read/write
> > permissions across the policy while still blocking many design and
> > programing flaws SELinux is so good at catching today.
> > 
> > Signed-off-by: Eric Paris <eparis@redhat.com>
> > 
> 
> What does open on a dir mean?  Isn't that the same as the read perm?

Admittedly there is very little distinction and I don't know the
usefulness, but it is possible for a process to pass an open fd to a
directory so I saw little reason to exclude it.  lnk and socket files
were excluded because they could not be 'opened.'  Obvious for a socket,
but lnk files are magically changed in the kernel to an open on the real
file before the security check, so you couldn't ever pass an open lnk
file.

> #============= httpd_t =============
> allow httpd_t user_tmp_t:dir { read open };
> #============= ntpd_t ==============
> allow ntpd_t user_tmp_t:dir read;

-Eric

> > allow httpd_t user_tmp_t:dir { read open };
> [...]
> > + * Convert a file mask to an access vector and include the correct open
> > + * open permission.
> > + */
> > +static inline u32 open_file_mask_to_av(int mode, int mask)
> > +{
> > +	u32 av = file_mask_to_av(mode, mask);
> > +
> > +	if (selinux_policycap_openperm) {
> > +		/*
> > +		 * lnk files and socks do not really have an 'open'
> > +		 */
> > +		if (S_ISREG(mode))
> > +			av |= FILE__OPEN;
> > +		else if (S_ISCHR(mode))
> > +			av |= CHR_FILE__OPEN;
> > +		else if (S_ISBLK(mode))
> > +			av |= BLK_FILE__OPEN;
> > +		else if (S_ISFIFO(mode))
> > +			av |= FIFO_FILE__OPEN;
> > +		else if (S_ISDIR(mode))
> > +			av |= DIR__OPEN;
> > +		else
> > +			printk(KERN_ERR "SELinux: WARNING: inside open_file_to_av "
> > +				"with unknown mode:%x\n", mode);
> > +	}
> > +	return av;
> > +}
> > +
> 


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

  reply	other threads:[~2008-02-28 19:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-28 17:58 [PATCH -v2] SELinux: create new open permission Eric Paris
2008-02-28 18:30 ` Paul Moore
2008-02-28 18:50 ` Christopher J. PeBenito
2008-02-28 19:00   ` Eric Paris [this message]
2008-02-28 20:32     ` James Antill
2008-02-29 12:37       ` Russell Coker
2008-02-29 13:00         ` Stephen Smalley
2008-02-28 19:04   ` Stephen Smalley
2008-02-28 20:50 ` Stephen Smalley
2008-02-28 23:05 ` James Morris

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=1204225233.3206.120.camel@localhost.localdomain \
    --to=eparis@redhat.com \
    --cc=cpebenito@tresys.com \
    --cc=jmorris@namei.org \
    --cc=paul.moore@hp.com \
    --cc=sds@tycho.nsa.gov \
    --cc=selinux@tycho.nsa.gov \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.