All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel J Walsh <dwalsh@redhat.com>
To: selinux@tycho.nsa.gov
Subject: Re: how to cope with file renames?
Date: Thu, 11 Mar 2010 08:32:24 -0500	[thread overview]
Message-ID: <4B98F0E8.2090107@redhat.com> (raw)
In-Reply-To: <20100311081913.GC24034@myhost.felk.cvut.cz>

On 03/11/2010 03:19 AM, Michal Svoboda wrote:
> Hello,
>
> I'm struggling with the problem seemingly as old as filesystems - if you
> rename() a file, it retains all its permissions, incl. the context,
> because its inode stays the same.
>
> My particular problem is moving stuff from /tmp using PHP's
> move_uploaded_file function. I'm aware of the copy/delete workaround,
> but that just isn't the same (performance, atomicity, etc.) Also there
> is the way of post-relabeling the moved file but that requires more
> permissions plus there are no selinux bindings in PHP that i'm aware of.
>
>    
I think this is your best option.  Or write your own version.  Maybe 
open a bugzilla on coreutils asking for
an option to either allow you to state the file context of the 
destination or just do not preserve file context.

> In short, I was wondering if there was a way for a rename()d file to be
> subjected to a type transition as if a new file was created? (I tried a
> type_trans rule but to no avail.) Or any other way to deal with renaming
> files between variously contexted dirs?
>
> Michal Svoboda
>
>    


--
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:[~2010-03-11 13:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-11  8:19 how to cope with file renames? Michal Svoboda
2010-03-11 13:32 ` Daniel J Walsh [this message]
2010-03-11 13:46 ` Stephen Smalley
2010-03-11 14:45   ` Richard Bullington-McGuire
2010-03-11 17:00   ` Michal Svoboda
2010-03-11 17:27     ` Stephen Smalley
2010-03-11 18:28       ` Michal Svoboda
2010-03-11 19:08         ` Stephen Smalley
2010-03-11 17:42     ` Daniel J Walsh

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=4B98F0E8.2090107@redhat.com \
    --to=dwalsh@redhat.com \
    --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.