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