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 0fbfa5
type restorecon_t, domain, privlog, privowner, auth_write, change_context;
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 0fbfa5
Chris PeBenito 0fbfa5
allow restorecon_t initrc_devpts_t:chr_file { read write ioctl };
Chris PeBenito 0fbfa5
allow restorecon_t { tty_device_t admin_tty_type }:chr_file { read write ioctl };
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
domain_auto_trans({ initrc_t sysadm_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 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
allow restorecon_t fs_type:dir r_dir_perms;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
allow restorecon_t etc_runtime_t:file read;
Chris PeBenito 0fbfa5
allow restorecon_t etc_t:file 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 0fbfa5