bugGNU tar - Bugs: bug #56421, security.capability extended...

 
 

bug #56421: security.capability extended attributes not restored upon extraction with --xattrs

Submitter:  None
Submitted:  Thu 30 May 2019 08:57:16 PM UTC
   
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open
* Mandatory Fields

Post a Comment

Add a New Comment Rich Markup
   

Discussion

Thu 06 Jun 2019 06:34:47 PM UTC, comment #3: 

Come to find that it is a deliberate decision to only extract the "user.*" extended attributes by default.

https://lists.gnu ... -06/msg00001.html

Brian Murray <bdmurray>
Mon 03 Jun 2019 10:19:08 PM UTC, comment #2: 

I've came across this bug a few years back (https://stackover ... 44753270#44753270) - It's important to note that when using (upon extraction) --xattrs --xattrs-include=* the security attributes does get extracted, only you need sudo privileges to set it

Jordan Cohen <ymec>
Sat 01 Jun 2019 12:08:39 AM UTC, comment #1: 

I'm the original reporter of this bug and I've tested this a bit more and discovered that actually only user.* extended attributes are extracted. Reading xattrs_kw_included() in xattrs.c this seems deliberate but I could find no indication why in the git history.

Brian Murray <bdmurray>
Thu 30 May 2019 08:57:16 PM UTC, original submission:  

The following page indicates that "By default, when `--xattr' is used, all names are stored in the archive (or extracted, if using `--extract')." However, this only seems to be true for create and not for extract as one must use "--xattrs-include=*" for the security capabilities to be restored.

https://www.gnu.o ... al/tar.html#SEC70

Here's a test case:

mkdir orig restore
touch orig/file_with_capability_and_user_xattr
setcap cap_net_raw=p orig/file_with_capability_and_user_xattr
(eoan-amd64)root@impulse:/tmp# getfattr -m . -d orig/file_with_capability_and_user_xattr
# file: orig/file_with_capability_and_user_xattr
security.capability=0sAAAAAgAgAAAAAAAAAAAAAAAAAAA=
user.testkey="testvalue"
(eoan-amd64)root@impulse:/tmp# tar c --xattrs --acls --directory orig/ . | tar x --xattrs --acls --directory restore/
(eoan-amd64)root@impulse:/tmp# getfattr -m . -d restore/file_with_capability_and_user_xattr
# file: restore/file_with_capability_and_user_xattr
user.testkey="testvalue"
(eoan-amd64)root@impulse:/tmp# tar c --xattrs --directory orig/ . | tar x --xattrs --xattrs-include=* --directory restore/
(eoan-amd64)root@impulse:/tmp# getfattr -m . -d restore/file_with_capability_and_user_xattr
# file: restore/file_with_capability_and_user_xattr
security.capability=0sAAAAAgAgAAAAAAAAAAAAAAAAAAA=
user.testkey="testvalue"

This was tested using tar version 1.30+dfsg-6 on Ubuntu 19.10 but the source code for extract.c looks the same so I believe the same issue exists with the upstream version of tar.

Anonymous

 

Attached Files

This item currently has no attached files.

(Note: upload size limit is set to 4.0MiB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

 

Dependencies

This item does not depend on any other items.

No items depend on this one.

 

Mail Notification Carbon-Copy List

Carbon-Copy List
  • -email is unavailable- added by ymec (Posted a comment)
  • -email is unavailable- added by bdmurray (Posted a comment)
  •  

    Votes

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

    History

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.16-598c.
    Corresponding source code