From: James Antill <james.antill@redhat.com>
To: Stephen Smalley <sds@tycho.nsa.gov>
Cc: Daniel J Walsh <dwalsh@redhat.com>,
SE Linux <selinux@tycho.nsa.gov>,
Karl MacMillan <kmacmillan@mentalrootkit.com>,
Jim Meyering <meyering@redhat.com>
Subject: Re: We currently have a problem with cp -a /media/cdrom /etc
Date: Fri, 12 Jan 2007 15:10:26 -0500 [thread overview]
Message-ID: <1168632626.13080.212.camel@code.and.org> (raw)
In-Reply-To: <1168628100.7993.525.camel@moss-spartans.epoch.ncsc.mil>
[-- Attachment #1: Type: text/plain, Size: 2643 bytes --]
kOn Fri, 2007-01-12 at 13:55 -0500, Stephen Smalley wrote:
> On Fri, 2007-01-12 at 13:46 -0500, Daniel J Walsh wrote:
> > Currently in policy we do NOT have the following rule
> >
> > allow iso9660_t fs_t:filesystem associate;
> >
[...]
> > Maybe a fix would be to allow cp to ask the kernel what to do if it can
> > not setfscreatecon a particular context on a file system.
Note that copy.c uses fsetfilecon() on the open fd of the new file, but
it saves the context of the old file in setfscreatecon() (and so does
open+getfscreatecon+fsetfilecon). Fixing this to just store in a local
variable would mean we'd see the error at setfilecon() time.
> > Thoughts?
>
> First, I seem to recall debates about whether -p (and thus -a) should
> automatically enable preservation of SELinux context or whether that
> should remain a separate option only. Pros and cons to both sides.
I never saw the original discussion, but I'm 99% sure I complained to
Jim and/or Dan that cp -a/-p should do "the right thing" and preserve
everything, when I was adding the xattr support.
Note that the changes in question are not really consistent:
FC-5 FC-6 rawhide
mode = acls[1] yes yes no
-p trad. trad. trad.+acls+xattrs
-a -dpPR -dpPRc -dpPR
--preserve=all trad.+context trad.+context trad.+context+acls+xattrs
...and in FC-6 -Z also does the open+getfscreatecon+fsetfilecon dance.
> I agree that allowing the association isn't the right thing to do. Part
> of the problem here is that setfscreatecon() doesn't know where you are
> going to put the file, so it cannot report an error at that time, and
> the open/mkdir failure could happen for a variety of reasons, not just
> this one.
So if we moved coreutils to just using fsetfilecon() for -p/-a, could
we do something?
> cp could fall back to resetting fscreate to NULL and try again in that
> case (as long as the user didn't explicitly request preservation via
> --preserve=context).
I'm not sure that's the right behaviour, I think the behaviour should
be like if you copy an ACL to an FS that doesn't support them (Ie. it
knows what failed, and why ... and so "does the right thing").
[1] This means that preserving the "unix permission mode bits" implies
preserving any ACLs.
--
James Antill - <james.antill@redhat.com>
setsockopt(fd, IPPROTO_TCP, TCP_CONGESTION, ...);
setsockopt(fd, IPPROTO_TCP, TCP_DEFER_ACCEPT, ...);
setsockopt(fd, SOL_SOCKET, SO_ATTACH_FILTER, ...);
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2007-01-12 20:10 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-12 18:46 We currently have a problem with cp -a /media/cdrom /etc Daniel J Walsh
2007-01-12 18:55 ` Stephen Smalley
2007-01-12 20:10 ` James Antill [this message]
2007-01-12 20:24 ` Stephen Smalley
2007-01-12 20:29 ` Stephen Smalley
2007-01-12 22:29 ` Casey Schaufler
2007-01-13 9:13 ` Russell Coker
2007-01-13 20:01 ` Casey Schaufler
2007-01-12 21:15 ` James Antill
2007-01-12 21:19 ` Stephen Smalley
2007-01-13 10:05 ` Jim Meyering
2007-01-15 5:16 ` James Antill
2007-01-15 7:54 ` Jim Meyering
2007-01-16 13:33 ` Stephen Smalley
2007-01-13 10:55 ` Russell Coker
2007-01-12 21:01 ` Stephen Smalley
2007-01-12 21:29 ` Jim Meyering
2007-01-12 21:19 ` Jim Meyering
2007-01-12 21:21 ` Stephen Smalley
2007-01-12 21:47 ` Jim Meyering
2007-01-12 21:56 ` Stephen Smalley
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=1168632626.13080.212.camel@code.and.org \
--to=james.antill@redhat.com \
--cc=dwalsh@redhat.com \
--cc=kmacmillan@mentalrootkit.com \
--cc=meyering@redhat.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.