Red Hat ENTERPRISE LINUX 4 - SELINUX GUIDE Manual page 74

Selinux guide
Hide thumbs Also See for ENTERPRISE LINUX 4 - SELINUX GUIDE:
Table of Contents

Advertisement

60
-rw-rw-r--
auser
-rw-rw-r--
auser
-rw-rw-r--
auser
index.html
5.1.4. Make Backups or Archives That Retain Security Contexts
The
utility does not yet support archiving and restoring extended attributes in Red Hat Enterprise
tar
Linux 4. Instead, you can do this using the
. This ensures that extra attributes are captured and the header for the
-H=exustar
a type that fully supports xattrs:
# Note how the two directories have different labels.
# The ellipses '...' cover the unimportant part of the
# file context for printing purposes:
ls -Z public_html/ web_files/
public_html/:
-rw-rw-r--
auser
-rw-rw-r--
auser
-rw-rw-r--
auser
-rw-rw-r--
auser
-rw-rw-r--
auser
-rw-rw-r--
auser
web_files/:
-rw-rw-r--
auser
-rw-rw-r--
auser
-rw-rw-r--
auser
-rw-rw-r--
auser
-rw-rw-r--
auser
-rw-rw-r--
auser
star -xattr -H=exustar -c -f all_web.star public_html/ web_files/
star: 11 blocks + 0 bytes (total of 112640 bytes = 110.00k).
ls -Z all_web.star
-rw-rw-r--
auser
all_web.star
cp all_web.star /tmp/
cd /tmp/
# Here in /tmp, if there is no specific policy to make a derivative
# temporary type, the default behavior is to acquire the tmp_t type
# for new files, such as the newly copied file all_web.star,
ls -Z all_web.star
-rw-rw-r--
auser
# *.star files are usable by tar, but tar does not know how to
# extract extended attributes.
# the creation of new files in /tmp again chooses the default file
# type of tmp_t:
tar -xvf all_web.star
...
ls -Z /tmp/public_html/ /tmp/web_files/
/tmp/public_html/:
-rw-rw-r--
auser
-rw-rw-r--
auser
auser
system_u:object_r:user_home_t
auser
system_u:object_r:user_home_t
auser
system_u:object_r:user_home_t
star
auser
...httpd_user_content_t 1.html
auser
...httpd_user_content_t 2.html
auser
...httpd_user_content_t 3.html
auser
...httpd_user_content_t 4.html
auser
...httpd_user_content_t 5.html
auser
...httpd_user_content_t index.html
auser
user_u:object_r:user_home_t
auser
user_u:object_r:user_home_t
auser
user_u:object_r:user_home_t
auser
user_u:object_r:user_home_t
auser
user_u:object_r:user_home_t
auser
user_u:object_r:user_home_t
auser
user_u:object_r:user_home_t \
auser
user_u:object_r:tmp_t
Without a label on the file,
auser
user_u:object_r:tmp_t
auser
user_u:object_r:tmp_t
Chapter 5. Controlling and Maintaining SELinux
utility, with the appropriate options
all_web.star
1.html
2.html
4.html
5.html
\
-xattr
file is of
*.star
1.html
2.html
3.html
4.html
5.html
index.html
and

Advertisement

Table of Contents
loading

Table of Contents