Bug 801823

Summary: rlFileRestore breaks security context of /etc directory tree
Product: [Fedora] Fedora Reporter: Lukas Pramuk <lpramuk>
Component: beakerlibAssignee: Petr Muller <pmuller>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 16CC: ohudlick, pmuller, psplicha
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-03-13 01:31:14 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Lukas Pramuk 2012-03-09 15:20:25 UTC
Description of problem:
Using rlFileBackUp/rlFileRestore functions doesn't preserve original security context of the directory tree. By using function rlFileRestore you break original context of the directory trees for all backuped files.
(restoring of file "/etc/sysconfig/network" breaks contexts of /etc and etc/sysconfig directory) 

Version-Release number of selected component (if applicable):
beakerlib-1.4-1.fc16.noarch

How reproducible:
always

Steps to Reproduce:
1. . /usr/lib/beakerlib/beakerlib.sh && rlJournalStart
2. rlFileBackup /etc/sysconfig/network
3. rlFileRestore 
4. restorecon -rv /etc
restorecon reset /etc context unconfined_u:object_r:user_tmp_t:s0->unconfined_u:object_r:etc_t:s0
restorecon reset /etc/sysconfig context unconfined_u:object_r:user_tmp_t:s0->unconfined_u:object_r:etc_t:s0

  
Actual results:
ls -dZ /etc /etc/sysconfig (after rlFileRestore)
drwxr-xr-x. root root unconfined_u:object_r:user_tmp_t:s0 /etc
drwxr-xr-x. root root unconfined_u:object_r:user_tmp_t:s0 /etc/sysconfig

Expected results:
ls -dZ /etc /etc/sysconfig
drwxr-xr-x. root root unconfined_u:object_r:etc_t:s0   /etc
drwxr-xr-x. root root unconfined_u:object_r:etc_t:s0   /etc/sysconfig

Additional info:

Comment 1 Petr Muller 2012-03-13 01:31:14 UTC

*** This bug has been marked as a duplicate of bug 800906 ***