Skip to contentSkip to conversation

gnuTAR support for SELinux context (beta)

DISCUSSION James Antill 3 participants 6 messages Aug 1, 2006 SELinux security module

lore
Share & tools
lore
#0 lore raw

This is just a quick note to let you know that we've got beta
packages[1] for creating/extracting tar archives with SELinux context in them (note that these packages are also based on rawhide, so will have other changes).
This should be able to extract any archives you've previously made with
star.

You can create archives with just selinux context information by using
--selinux, or with full xattr support using --xattrs. In a similar vein you can ignore any selinux context information by using --no-selinux when you extract, or --no-xattrs to ignore all xattr information.

[1] http://people.redhat.com/jantill/

Signature · 1 line
James Antill <[email protected]>
#1 lore raw
Quoted 8 lines · James Antill

This is just a quick note to let you know that we've got beta
packages[1] for creating/extracting tar archives with SELinux context in them (note that these packages are also based on rawhide, so will have other changes).
This should be able to extract any archives you've previously made with
star.

You have made your save against Cthulhu's writing of the gnu-tar source code. [See jwz post from 2+ years ago]. I salute you.. but will stay on the other side of the room just in case you start sprouting wings and mouth tentacles.

Signature · 7 lines
Stephen J Smoogen.
CSIRT/Linux System Administrator

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#2 lore raw
In reply to James Antill
Quoted 7 lines · James Antill

This is just a quick note to let you know that we've got beta
packages[1] for creating/extracting tar archives with SELinux context in them (note that these packages are also based on rawhide, so will have other changes).
This should be able to extract any archives you've previously made with
star.

Quoted 6 lines

You can create archives with just selinux context information by using
--selinux, or with full xattr support using --xattrs. In a similar vein you can ignore any selinux context information by using --no-selinux when you extract, or --no-xattrs to ignore all xattr information.

[1] http://people.redhat.com/jantill/

What about just saving the selinux contexts by default if they are present on the files being archived (and likewise extracting them by default if present in the archive)? Otherwise, users have to take explicit action to save and restore the file contexts and will continue to "lose" them by default.

Signature · 8 lines
Stephen Smalley
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#3 lore raw
Quoted 13 lines · Stephen Smalley
Quoted 12 lines · James Antill

This is just a quick note to let you know that we've got beta
packages[1] for creating/extracting tar archives with SELinux context in them (note that these packages are also based on rawhide, so will have other changes).
This should be able to extract any archives you've previously made with
star.

You can create archives with just selinux context information by using
--selinux, or with full xattr support using --xattrs. In a similar vein you can ignore any selinux context information by using --no-selinux when you extract, or --no-xattrs to ignore all xattr information.

Quoted 7 lines
Quoted 1 line

[1] http://people.redhat.com/jantill/

What about just saving the selinux contexts by default if they are present on the files being archived (and likewise extracting them by default if present in the archive)? Otherwise, users have to take explicit action to save and restore the file contexts and will continue to "lose" them by default.

Doesn't the xattr support use an internally different tar format than the normal one? [From my reading of the star pages.] Would this stop it being readable from say Debian, Solaris etc that didn't know about this format

Signature · 7 lines
Stephen J Smoogen.
CSIRT/Linux System Administrator

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#5 lore raw
In reply to Stephen Smalley
Quoted 10 lines · Stephen Smalley
Quoted 3 lines · James Antill

In a similar vein
you can ignore any selinux context information by using --no-selinux when you extract, or --no-xattrs to ignore all xattr information.

What about just saving the selinux contexts by default if they are present on the files being archived (and likewise extracting them by default if present in the archive)? Otherwise, users have to take explicit action to save and restore the file contexts and will continue to "lose" them by default.

Note that --xattrs is on by default for extracting, you have to use the
--no-* varients to not extract that info. from the archive. So if you pass --selinux or --xattrs on the create command line, it just works.
There are backwards compatibility concerns with enabling even --selinux
by default for creating archives (older versions of GNUtar will spew warnings, and give error exit codes).

It's also not obvious it should happen, consider files created in /tmp
and tar'd ... extracting them with tmp_t is probably not what you want. Dito things like untar'ing an archive of html in /var/www/html (on the other hand, untar'ing php will only ever work if it has the right context in the archive).

Signature · 1 line
James Antill <[email protected]>
#4 lore raw
In reply to Stephen John Smoogen
Quoted 4 lines · Stephen John Smoogen

Doesn't the xattr support use an internally different tar format than the normal one? [From my reading of the star pages.] Would this stop it being readable from say Debian, Solaris etc that didn't know about this format

No, star requires you set the archive format to exustar ... my patches
for GNUtar only require the --xattr/--selinux option(s) and to not be using v7 format.
Note that GNUtar can read exustar format archives, with xattr info. in
them, although I'm guessing all the details in the documentation is still valid wrt. length limits ... and:

tar -cvf foo.tar foo --xattr --format=ustar

...does produce archives that can be extracted from star (including xattr info.).

Saying that, debian/upstream/etc. GNUtar does issue warnings and a
delayed error exit code when it sees the xattr info. in an archive (but it works just as though none of that info. were present). Which _could_ break scripts that expect a happy exit code, and might well confuse users with the warnings.

Signature · 1 line
James Antill <[email protected]>