Chris PeBenito 0fbfa5
#DESC restorecon - Restore or check the context of a file
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
# Authors:  Russell Coker <russell@coker.com.au>
Chris PeBenito 0fbfa5
# X-Debian-Packages: policycoreutils
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
#################################
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
# Rules for the restorecon_t domain.
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
# restorecon_exec_t is the type of the restorecon executable.
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
# needs auth_write attribute because it has relabelfrom/relabelto
Chris PeBenito 0fbfa5
# access to shadow_t
Chris PeBenito 0907bd
type restorecon_t, domain, privlog, privowner, auth_write, change_context, mlsfileread, mlsfilewrite, mlsfileupgrade, mlsfiledowngrade;
Chris PeBenito 0fbfa5
type restorecon_exec_t, file_type, sysadmfile, exec_type;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
role system_r types restorecon_t;
Chris PeBenito 0fbfa5
role sysadm_r types restorecon_t;
Chris PeBenito cf6a7d
role secadm_r types restorecon_t;
Chris PeBenito 0fbfa5
Chris PeBenito 77f6e2
can_access_pty(restorecon_t, initrc)
Chris PeBenito cf6a7d
allow restorecon_t { tty_device_t admin_tty_type user_tty_type devtty_t }:chr_file { read write ioctl };
Chris PeBenito 0fbfa5
Chris PeBenito cf6a7d
domain_auto_trans({ initrc_t sysadm_t secadm_t }, restorecon_exec_t, restorecon_t)
Chris PeBenito 0fbfa5
allow restorecon_t { userdomain init_t privfd }:fd use;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
uses_shlib(restorecon_t)
Chris PeBenito 0fbfa5
allow restorecon_t self:capability { dac_override dac_read_search fowner };
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# for upgrading glibc and other shared objects - without this the upgrade
Chris PeBenito 0fbfa5
# scripts will put things in a state such that restorecon can not be run!
Chris PeBenito 0fbfa5
allow restorecon_t lib_t:file { read execute };
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# Get security policy decisions.
Chris PeBenito 0fbfa5
can_getsecurity(restorecon_t)
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
r_dir_file(restorecon_t, policy_config_t)
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
allow restorecon_t file_type:dir r_dir_perms;
Chris PeBenito 0fbfa5
allow restorecon_t file_type:{ dir file lnk_file sock_file fifo_file } { getattr relabelfrom relabelto };
Chris PeBenito 0fbfa5
allow restorecon_t unlabeled_t:dir_file_class_set { getattr relabelfrom };
Chris PeBenito 0fbfa5
allow restorecon_t unlabeled_t:dir read;
Chris PeBenito 0fbfa5
allow restorecon_t { device_t device_type }:{ chr_file blk_file } { getattr relabelfrom relabelto };
Chris PeBenito 0fbfa5
ifdef(`distro_redhat', `
Chris PeBenito 0fbfa5
allow restorecon_t tmpfs_t:{ chr_file blk_file } { rw_file_perms relabelfrom relabelto };
Chris PeBenito 0fbfa5
')
Chris PeBenito cf6a7d
ifdef(`dpkg.te', `
Chris PeBenito cf6a7d
domain_auto_trans(dpkg_t, restorecon_exec_t, restorecon_t)
Chris PeBenito cf6a7d
')
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
allow restorecon_t ptyfile:chr_file getattr;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
allow restorecon_t fs_t:filesystem getattr;
Chris PeBenito 0fbfa5
Chris PeBenito 0907bd
allow restorecon_t etc_runtime_t:file { getattr read };
Chris PeBenito 0907bd
allow restorecon_t etc_t:file { getattr read };
Chris PeBenito 0fbfa5
allow restorecon_t proc_t:file { getattr read };
Chris PeBenito 0fbfa5
dontaudit restorecon_t proc_t:lnk_file { getattr read };
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
allow restorecon_t device_t:file { read write };
Chris PeBenito 0fbfa5
allow restorecon_t kernel_t:fd use;
Chris PeBenito 0fbfa5
allow restorecon_t kernel_t:fifo_file { read write };
Chris PeBenito 0fbfa5
allow restorecon_t kernel_t:unix_dgram_socket { read write };
Chris PeBenito 0fbfa5
r_dir_file(restorecon_t, { selinux_config_t file_context_t default_context_t } )
Chris PeBenito 65a252
allow restorecon_t autofs_t:dir search;