From: Daniel J Walsh <dwalsh@redhat.com>
To: Murray McAllister <mmcallis@redhat.com>
Cc: Stephen Smalley <sds@tycho.nsa.gov>,
russell@coker.com.au, SE Linux <selinux@tycho.nsa.gov>
Subject: Re: user guide drafts: Archiving Files with tar/star
Date: Mon, 13 Oct 2008 14:07:00 -0400 [thread overview]
Message-ID: <48F38E44.4040406@redhat.com> (raw)
In-Reply-To: <48F04409.10903@redhat.com>
Murray McAllister wrote:
> Stephen Smalley wrote:
>> On Fri, 2008-10-10 at 12:08 +1000, Murray McAllister wrote:
>>> Russell Coker wrote:
>>>> On Friday 10 October 2008 10:30, Murray McAllister
>>>> <mmcallis@redhat.com> wrote:
>>>>>> tar xvf file.tgz | restorecon -f -
>>>>>>
>>>>>> Would reset the file context on disk after the extraction.
>>>>> Does this only apply to the tar file itself, not the files in it? On
>>>>> rawhide the extracted files (that have extended attributes) inherit
>>>>> the
>>>>> type of the directory they are being extracted in.
>>>> The "v" option of tar causes it to list on stdout all the files it
>>>> extracts.
>>>>
>>>> The -f- option of restorecon makes it take a list of files to
>>>> relabel on stdin. So it relabels all files extracted from the tar
>>>> file.
>>>>
>>>> The inheriting of file contexts from a directory (in the absence of
>>>> policy rules specifying otherwise) has AFAIK always been the design
>>>> of SE Linux.
>>> When would "tar | restorecon -f -" be used if files inherit contexts
>>> from parent directories (if policy has not be changed)? Sorry, I am a
>>> bit slow :)
>>
>> restorecon consults the file_contexts configuration, which maps pathname
>> regular expressions to the appropriate security context to assign to a
>> file when it is installed. tar xf foo.tar by itself will merely apply
>> the usual runtime creation logic for file labeling, i.e. compute the
>> context of the new files from the combination of the creating process
>> context (user, level) and the parent directory (type) or type_transition
>> rule. tar xvf foo.tar | restorecon -f - should reset the file contexts
>> to the original install-time file contexts defined by the file contexts
>> configuration.
>>
> How about:
>
> If a Tar archive contains files without extended attributes, or if you
> want the extended attributes to match the original, install-time file
want the extended attributes to match the system defaults, ...
> contexts defined by SELinux policy, run the archive through restorecon:
>
> tar xvf file.tgz | restorecon -f -
>
> Would it be better to always recommend using tar with restorecon?
>
> Cheers.
>
> --
> 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.
--
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.
prev parent reply other threads:[~2008-10-13 18:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-09 7:08 user guide drafts: Archiving Files with tar/star Murray McAllister
2008-10-09 11:49 ` Daniel J Walsh
2008-10-09 23:30 ` Murray McAllister
2008-10-10 1:51 ` Russell Coker
2008-10-10 2:08 ` Murray McAllister
2008-10-10 2:36 ` Russell Coker
2008-10-10 12:57 ` Stephen Smalley
2008-10-11 6:13 ` Murray McAllister
2008-10-13 18:07 ` Daniel J Walsh [this message]
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=48F38E44.4040406@redhat.com \
--to=dwalsh@redhat.com \
--cc=mmcallis@redhat.com \
--cc=russell@coker.com.au \
--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.