Chris PeBenito 0fbfa5
#DESC Setfiles - SELinux filesystem labeling utilities
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 setfiles_t domain.
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
# setfiles_exec_t is the type of the setfiles 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 77f6e2
type setfiles_t, domain, privlog, privowner, auth_write, change_context, mlsfileread, mlsfilewrite, mlsfileupgrade, mlsfiledowngrade;
Chris PeBenito 0fbfa5
type setfiles_exec_t, file_type, sysadmfile, exec_type;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
role system_r types setfiles_t;
Chris PeBenito 0fbfa5
role sysadm_r types setfiles_t;
Chris PeBenito a08248
role secadm_r types setfiles_t;
Chris PeBenito 0fbfa5
Chris PeBenito 2705f9
ifdef(`distro_redhat', `
Chris PeBenito 2705f9
domain_auto_trans(initrc_t, setfiles_exec_t, setfiles_t)
Chris PeBenito 2705f9
')
Chris PeBenito 77f6e2
can_access_pty(hostname_t, initrc)
Chris PeBenito 0fbfa5
allow setfiles_t { ttyfile ptyfile tty_device_t admin_tty_type devtty_t }:chr_file { read write ioctl };
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
allow setfiles_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 0fbfa5
Chris PeBenito a08248
domain_auto_trans(secadmin, setfiles_exec_t, setfiles_t)
Chris PeBenito 0fbfa5
allow setfiles_t { userdomain privfd initrc_t init_t }:fd use;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
uses_shlib(setfiles_t)
Chris PeBenito 0fbfa5
allow setfiles_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 setfiles can not be run!
Chris PeBenito 0fbfa5
allow setfiles_t lib_t:file { read execute };
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# Get security policy decisions.
Chris PeBenito 0fbfa5
can_getsecurity(setfiles_t)
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
r_dir_file(setfiles_t, { policy_src_t policy_config_t file_context_t selinux_config_t default_context_t })
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
allow setfiles_t file_type:dir r_dir_perms;
Chris PeBenito 0fbfa5
allow setfiles_t { file_type unlabeled_t device_type }:dir_file_class_set { getattr relabelfrom };
Chris PeBenito 0fbfa5
allow setfiles_t file_type:{ dir file lnk_file sock_file fifo_file } relabelto;
Chris PeBenito 0fbfa5
allow setfiles_t unlabeled_t:dir read;
Chris PeBenito 0fbfa5
allow setfiles_t { device_type device_t }:{ chr_file blk_file } { getattr relabelfrom relabelto };
Chris PeBenito 0fbfa5
allow setfiles_t { ttyfile ptyfile }:chr_file getattr;
Chris PeBenito 0fbfa5
# dontaudit access to ttyfile - we do not want setfiles to relabel our terminal
Chris PeBenito 0fbfa5
dontaudit setfiles_t ttyfile:chr_file relabelfrom;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
allow setfiles_t fs_t:filesystem getattr;
Chris PeBenito 0fbfa5
allow setfiles_t fs_type:dir r_dir_perms;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
read_locale(setfiles_t)
Chris PeBenito 0fbfa5
Chris PeBenito 2705f9
allow setfiles_t etc_runtime_t:file { getattr read };
Chris PeBenito 2705f9
allow setfiles_t etc_t:file { getattr read };
Chris PeBenito 0fbfa5
allow setfiles_t proc_t:file { getattr read };
Chris PeBenito 0fbfa5
dontaudit setfiles_t proc_t:lnk_file { getattr read };
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# for config files in a home directory
Chris PeBenito 0fbfa5
allow setfiles_t home_type:file r_file_perms;
Chris PeBenito 0fbfa5
dontaudit setfiles_t sysadm_tty_device_t:chr_file relabelfrom;