|
Chris PeBenito |
e181fe |
|
|
Chris PeBenito |
be4a80 |
policy_module(selinuxutil,1.0)
|
|
Chris PeBenito |
960373 |
|
|
Chris PeBenito |
ee5772 |
########################################
|
|
Chris PeBenito |
b4cd15 |
#
|
|
Chris PeBenito |
ee5772 |
# Declarations
|
|
Chris PeBenito |
b4cd15 |
#
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
attribute can_write_binary_policy;
|
|
Chris PeBenito |
ee5772 |
attribute can_relabelto_binary_policy;
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
type checkpolicy_t, can_write_binary_policy;
|
|
Chris PeBenito |
c9428d |
domain_type(checkpolicy_t)
|
|
Chris PeBenito |
ee5772 |
role system_r types checkpolicy_t;
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
type checkpolicy_exec_t;
|
|
Chris PeBenito |
c9428d |
domain_entry_file(checkpolicy_t,checkpolicy_exec_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
#
|
|
Chris PeBenito |
ee5772 |
# default_context_t is the type applied to
|
|
Chris PeBenito |
ee5772 |
# /etc/selinux/*/contexts/*
|
|
Chris PeBenito |
ee5772 |
#
|
|
Chris PeBenito |
ee5772 |
type default_context_t;
|
|
Chris PeBenito |
c9428d |
files_file_type(default_context_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
#
|
|
Chris PeBenito |
ee5772 |
# file_context_t is the type applied to
|
|
Chris PeBenito |
ee5772 |
# /etc/selinux/*/contexts/files
|
|
Chris PeBenito |
ee5772 |
#
|
|
Chris PeBenito |
ee5772 |
type file_context_t;
|
|
Chris PeBenito |
c9428d |
files_file_type(file_context_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
type load_policy_t;
|
|
Chris PeBenito |
c9428d |
domain_type(load_policy_t)
|
|
Chris PeBenito |
ee5772 |
role system_r types load_policy_t;
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
type load_policy_exec_t;
|
|
Chris PeBenito |
c9428d |
domain_entry_file(load_policy_t,load_policy_exec_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
a1f94a |
type newrole_t; # nscd_client_domain, mlsfileread, mlsfilewrite, mlsfileupgrade, mlsfiledowngrade, mlsprocsetsl;
|
|
Chris PeBenito |
8bd678 |
domain_role_change_exempt(newrole_t)
|
|
Chris PeBenito |
8bd678 |
domain_obj_id_change_exempt(newrole_t)
|
|
Chris PeBenito |
c9428d |
domain_type(newrole_t)
|
|
Chris PeBenito |
c9428d |
domain_wide_inherit_fd(newrole_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
type newrole_exec_t;
|
|
Chris PeBenito |
c9428d |
domain_entry_file(newrole_t,newrole_exec_t)
|
|
Chris PeBenito |
b4cd15 |
|
|
Chris PeBenito |
b4cd15 |
#
|
|
Chris PeBenito |
b4cd15 |
# policy_config_t is the type of /etc/security/selinux/*
|
|
Chris PeBenito |
b4cd15 |
# the security server policy configuration.
|
|
Chris PeBenito |
b4cd15 |
#
|
|
Chris PeBenito |
b4cd15 |
type policy_config_t;
|
|
Chris PeBenito |
c9428d |
files_file_type(policy_config_t)
|
|
Chris PeBenito |
b4cd15 |
|
|
Chris PeBenito |
b4cd15 |
neverallow ~can_relabelto_binary_policy policy_config_t:file relabelto;
|
|
Chris PeBenito |
b4cd15 |
neverallow ~can_write_binary_policy policy_config_t:file { write append };
|
|
Chris PeBenito |
b4cd15 |
|
|
Chris PeBenito |
b4cd15 |
#
|
|
Chris PeBenito |
b4cd15 |
# policy_src_t is the type of the policy source
|
|
Chris PeBenito |
b4cd15 |
# files.
|
|
Chris PeBenito |
b4cd15 |
#
|
|
Chris PeBenito |
b4cd15 |
type policy_src_t;
|
|
Chris PeBenito |
c9428d |
files_file_type(policy_src_t)
|
|
Chris PeBenito |
b4cd15 |
|
|
Chris PeBenito |
a1f94a |
type restorecon_t, can_relabelto_binary_policy;
|
|
Chris PeBenito |
a1f94a |
type restorecon_exec_t;
|
|
Chris PeBenito |
8bd678 |
domain_obj_id_change_exempt(restorecon_t)
|
|
Chris PeBenito |
c9428d |
init_system_domain(restorecon_t,restorecon_exec_t)
|
|
Chris PeBenito |
ee5772 |
role system_r types restorecon_t;
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
8623d5 |
type run_init_t;
|
|
Chris PeBenito |
c9428d |
domain_type(run_init_t)
|
|
Chris PeBenito |
8623d5 |
|
|
Chris PeBenito |
8623d5 |
type run_init_exec_t;
|
|
Chris PeBenito |
c9428d |
domain_entry_file(run_init_t,run_init_exec_t)
|
|
Chris PeBenito |
8623d5 |
|
|
Chris PeBenito |
b4cd15 |
#
|
|
Chris PeBenito |
ee5772 |
# selinux_config_t is the type applied to
|
|
Chris PeBenito |
ee5772 |
# /etc/selinux/config
|
|
Chris PeBenito |
b4cd15 |
#
|
|
Chris PeBenito |
ee5772 |
type selinux_config_t;
|
|
Chris PeBenito |
c9428d |
files_file_type(selinux_config_t)
|
|
Chris PeBenito |
b4cd15 |
|
|
Chris PeBenito |
a1f94a |
type setfiles_t, can_relabelto_binary_policy;
|
|
Chris PeBenito |
8bd678 |
domain_obj_id_change_exempt(setfiles_t)
|
|
Chris PeBenito |
c9428d |
domain_type(setfiles_t)
|
|
Chris PeBenito |
ee5772 |
role system_r types setfiles_t;
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
type setfiles_exec_t;
|
|
Chris PeBenito |
c9428d |
domain_entry_file(setfiles_t,setfiles_exec_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
########################################
|
|
Chris PeBenito |
b4cd15 |
#
|
|
Chris PeBenito |
ee5772 |
# Checkpolicy local policy
|
|
Chris PeBenito |
b4cd15 |
#
|
|
Chris PeBenito |
b4cd15 |
|
|
Chris PeBenito |
ee5772 |
allow checkpolicy_t self:capability dac_override;
|
|
Chris PeBenito |
b4cd15 |
|
|
Chris PeBenito |
ee5772 |
# able to create and modify binary policy files
|
|
Chris PeBenito |
cc41a9 |
allow checkpolicy_t policy_config_t:dir rw_dir_perms;
|
|
Chris PeBenito |
cc41a9 |
allow checkpolicy_t policy_config_t:file create_file_perms;
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
a1f94a |
# allow test policies to be created in src directories
|
|
Chris PeBenito |
cc41a9 |
allow checkpolicy_t policy_src_t:dir rw_dir_perms;
|
|
Chris PeBenito |
a1f94a |
type_transition checkpolicy_t policy_src_t:file policy_config_t;
|
|
Chris PeBenito |
a1f94a |
|
|
Chris PeBenito |
ee5772 |
# only allow read of policy source files
|
|
Chris PeBenito |
cc41a9 |
allow checkpolicy_t policy_src_t:dir r_dir_perms;
|
|
Chris PeBenito |
cc41a9 |
allow checkpolicy_t policy_src_t:file r_file_perms;
|
|
Chris PeBenito |
cc41a9 |
allow checkpolicy_t policy_src_t:lnk_file r_file_perms;
|
|
Chris PeBenito |
ee5772 |
allow checkpolicy_t selinux_config_t:dir search;
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
0fd9dc |
fs_getattr_xattr_fs(checkpolicy_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
0fd9dc |
term_use_console(checkpolicy_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
c9428d |
domain_use_wide_inherit_fd(checkpolicy_t)
|
|
Chris PeBenito |
26c87e |
|
|
Chris PeBenito |
daa0e0 |
# directory search permissions for path to source and binary policy files
|
|
Chris PeBenito |
c9428d |
files_search_etc(checkpolicy_t)
|
|
Chris PeBenito |
daa0e0 |
|
|
Chris PeBenito |
c9428d |
init_use_fd(checkpolicy_t)
|
|
Chris PeBenito |
c9428d |
init_use_script_pty(checkpolicy_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
c9428d |
libs_use_ld_so(checkpolicy_t)
|
|
Chris PeBenito |
c9428d |
libs_use_shared_libs(checkpolicy_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
c9428d |
userdom_use_all_user_fd(checkpolicy_t)
|
|
Chris PeBenito |
26c87e |
|
|
Chris PeBenito |
ee5772 |
ifdef(`TODO',`
|
|
Chris PeBenito |
ee5772 |
# Read the devpts root directory.
|
|
Chris PeBenito |
ee5772 |
ifdef(`sshd.te',`allow checkpolicy_t sshd_devpts_t:dir r_dir_perms;')
|
|
Chris PeBenito |
ee5772 |
') dnl endif TODO
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
########################################
|
|
Chris PeBenito |
ee5772 |
#
|
|
Chris PeBenito |
ee5772 |
# Load_policy local policy
|
|
Chris PeBenito |
ee5772 |
#
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
allow load_policy_t self:capability dac_override;
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
# only allow read of policy config files
|
|
Chris PeBenito |
ee5772 |
allow load_policy_t policy_src_t:dir search;
|
|
Chris PeBenito |
cc41a9 |
allow load_policy_t policy_config_t:dir r_dir_perms;
|
|
Chris PeBenito |
cc41a9 |
allow load_policy_t policy_config_t:notdevfile_class_set r_file_perms;
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
cc41a9 |
allow load_policy_t selinux_config_t:dir r_dir_perms;
|
|
Chris PeBenito |
cc41a9 |
allow load_policy_t selinux_config_t:file r_file_perms;
|
|
Chris PeBenito |
cc41a9 |
allow load_policy_t selinux_config_t:lnk_file r_file_perms;
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
5e0da6 |
selinux_get_fs_mount(load_policy_t)
|
|
Chris PeBenito |
5e0da6 |
selinux_load_policy(load_policy_t)
|
|
Chris PeBenito |
5e0da6 |
selinux_set_boolean(load_policy_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
0fd9dc |
fs_getattr_xattr_fs(load_policy_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
0fd9dc |
term_use_console(load_policy_t)
|
|
Chris PeBenito |
0fd9dc |
term_list_ptys(load_policy_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
c9428d |
init_use_script_fd(load_policy_t)
|
|
Chris PeBenito |
c9428d |
init_use_script_pty(load_policy_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
c9428d |
domain_use_wide_inherit_fd(load_policy_t)
|
|
Chris PeBenito |
1e5c2a |
|
|
Chris PeBenito |
c9428d |
files_search_etc(load_policy_t)
|
|
Chris PeBenito |
efd8ed |
|
|
Chris PeBenito |
c9428d |
libs_use_ld_so(load_policy_t)
|
|
Chris PeBenito |
c9428d |
libs_use_shared_libs(load_policy_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
miscfiles_read_localization(load_policy_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
c9428d |
userdom_use_all_user_fd(load_policy_t)
|
|
Chris PeBenito |
26c87e |
|
|
Chris PeBenito |
ee5772 |
########################################
|
|
Chris PeBenito |
ee5772 |
#
|
|
Chris PeBenito |
ee5772 |
# Newrole local policy
|
|
Chris PeBenito |
ee5772 |
#
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
allow newrole_t self:capability { setuid setgid net_bind_service dac_override };
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
allow newrole_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem dyntransition };
|
|
Chris PeBenito |
ee5772 |
allow newrole_t self:process setexec;
|
|
Chris PeBenito |
ee5772 |
allow newrole_t self:fd use;
|
|
Chris PeBenito |
cc41a9 |
allow newrole_t self:fifo_file rw_file_perms;
|
|
Chris PeBenito |
ee5772 |
allow newrole_t self:unix_dgram_socket sendto;
|
|
Chris PeBenito |
ee5772 |
allow newrole_t self:unix_stream_socket connectto;
|
|
Chris PeBenito |
cc41a9 |
allow newrole_t self:shm create_shm_perms;
|
|
Chris PeBenito |
cc41a9 |
allow newrole_t self:sem create_sem_perms;
|
|
Chris PeBenito |
cc41a9 |
allow newrole_t self:msgq create_msgq_perms;
|
|
Chris PeBenito |
ee5772 |
allow newrole_t self:msg { send receive };
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
cc41a9 |
allow newrole_t { selinux_config_t default_context_t }:dir r_dir_perms;
|
|
Chris PeBenito |
cc41a9 |
allow newrole_t { selinux_config_t default_context_t }:file r_file_perms;
|
|
Chris PeBenito |
cc41a9 |
allow newrole_t { selinux_config_t default_context_t }:lnk_file r_file_perms;
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
kernel_read_system_state(newrole_t)
|
|
Chris PeBenito |
ee5772 |
kernel_read_kernel_sysctl(newrole_t)
|
|
Chris PeBenito |
5e0da6 |
selinux_get_fs_mount(newrole_t)
|
|
Chris PeBenito |
5e0da6 |
selinux_validate_context(newrole_t)
|
|
Chris PeBenito |
5e0da6 |
selinux_compute_access_vector(newrole_t)
|
|
Chris PeBenito |
5e0da6 |
selinux_compute_create_context(newrole_t)
|
|
Chris PeBenito |
5e0da6 |
selinux_compute_relabel_context(newrole_t)
|
|
Chris PeBenito |
5e0da6 |
selinux_compute_user_contexts(newrole_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Karl MacMillan |
f0c985 |
dev_read_urand(newrole_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
0fd9dc |
fs_getattr_xattr_fs(newrole_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
0fd9dc |
term_use_all_user_ttys(newrole_t)
|
|
Chris PeBenito |
0fd9dc |
term_use_all_user_ptys(newrole_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
c9428d |
auth_domtrans_chk_passwd(newrole_t)
|
|
Chris PeBenito |
1e5c2a |
|
|
Chris PeBenito |
c9428d |
domain_use_wide_inherit_fd(newrole_t)
|
|
Chris PeBenito |
1e5c2a |
|
|
Chris PeBenito |
daa0e0 |
# Write to utmp.
|
|
Chris PeBenito |
c9428d |
init_rw_script_pid(newrole_t)
|
|
Chris PeBenito |
daa0e0 |
|
|
Chris PeBenito |
c9428d |
files_read_generic_etc_files(newrole_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
c9428d |
libs_use_ld_so(newrole_t)
|
|
Chris PeBenito |
c9428d |
libs_use_shared_libs(newrole_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
c9428d |
logging_send_syslog_msg(newrole_t)
|
|
Chris PeBenito |
a1f94a |
|
|
Chris PeBenito |
ee5772 |
miscfiles_read_localization(newrole_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
c9428d |
userdom_use_unpriv_users_fd(newrole_t)
|
|
Chris PeBenito |
a1f94a |
|
|
Chris PeBenito |
ee5772 |
ifdef(`TODO',`
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
can_ypbind(newrole)
|
|
Chris PeBenito |
ee5772 |
ifdef(`automount.te', `
|
|
Chris PeBenito |
ee5772 |
allow newrole_t autofs_t:dir { search getattr };
|
|
Chris PeBenito |
ee5772 |
')
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
# for when the user types "exec newrole" at the command line
|
|
Chris PeBenito |
ee5772 |
allow newrole_t privfd:process sigchld;
|
|
Chris PeBenito |
a9a20d |
|
|
Chris PeBenito |
ee5772 |
# Execute /sbin/pwdb_chkpwd to check the password.
|
|
Chris PeBenito |
ee5772 |
allow newrole_t sbin_t:dir r_dir_perms;
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
# Execute shells
|
|
Chris PeBenito |
ee5772 |
allow newrole_t bin_t:dir r_dir_perms;
|
|
Chris PeBenito |
ee5772 |
allow newrole_t bin_t:lnk_file read;
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
# Allow newrole_t to transition to user domains.
|
|
Chris PeBenito |
ee5772 |
bool secure_mode false;
|
|
Chris PeBenito |
ee5772 |
domain_trans(newrole_t, shell_exec_t, unpriv_userdomain)
|
|
Chris PeBenito |
ee5772 |
if(!secure_mode)
|
|
Chris PeBenito |
ee5772 |
{
|
|
Chris PeBenito |
ee5772 |
# if we are not in secure mode then we can transition to sysadm_t
|
|
Chris PeBenito |
ee5772 |
domain_trans(newrole_t, shell_exec_t, sysadm_t)
|
|
Chris PeBenito |
ee5772 |
}
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
# Read /var.
|
|
Chris PeBenito |
ee5772 |
allow newrole_t var_t:dir r_dir_perms;
|
|
Chris PeBenito |
ee5772 |
allow newrole_t var_t:notdevfile_class_set r_file_perms;
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
# Relabel terminals.
|
|
Chris PeBenito |
ee5772 |
allow newrole_t { ttyfile ptyfile }:chr_file { relabelfrom relabelto };
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
ifdef(`gnome-pty-helper.te', `allow newrole_t gphdomain:fd use;')
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
# for some PAM modules and for cwd
|
|
Chris PeBenito |
ee5772 |
dontaudit newrole_t { home_root_t home_type }:dir search;
|
|
Chris PeBenito |
ee5772 |
') dnl ifdef TODO
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
########################################
|
|
Chris PeBenito |
ee5772 |
#
|
|
Chris PeBenito |
ee5772 |
# Restorecon local policy
|
|
Chris PeBenito |
ee5772 |
#
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
allow restorecon_t self:capability { dac_override dac_read_search fowner };
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
cc41a9 |
allow restorecon_t { policy_src_t policy_config_t file_context_t selinux_config_t default_context_t }:dir r_dir_perms;
|
|
Chris PeBenito |
cc41a9 |
allow restorecon_t { policy_src_t policy_config_t file_context_t selinux_config_t default_context_t }:file r_file_perms;
|
|
Chris PeBenito |
cc41a9 |
allow restorecon_t { policy_src_t policy_config_t file_context_t selinux_config_t default_context_t }:lnk_file r_file_perms;
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
0fd9dc |
kernel_use_fd(restorecon_t)
|
|
Chris PeBenito |
ee5772 |
kernel_read_system_state(restorecon_t)
|
|
Chris PeBenito |
5e0da6 |
selinux_get_fs_mount(restorecon_t)
|
|
Chris PeBenito |
5e0da6 |
selinux_validate_context(restorecon_t)
|
|
Chris PeBenito |
5e0da6 |
selinux_compute_access_vector(restorecon_t)
|
|
Chris PeBenito |
5e0da6 |
selinux_compute_create_context(restorecon_t)
|
|
Chris PeBenito |
5e0da6 |
selinux_compute_relabel_context(restorecon_t)
|
|
Chris PeBenito |
5e0da6 |
selinux_compute_user_contexts(restorecon_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
0fd9dc |
fs_getattr_xattr_fs(restorecon_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
0fd9dc |
term_use_unallocated_tty(restorecon_t)
|
|
Chris PeBenito |
1e5c2a |
|
|
Chris PeBenito |
c9428d |
init_use_fd(restorecon_t)
|
|
Chris PeBenito |
c9428d |
init_use_script_pty(restorecon_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
c9428d |
domain_use_wide_inherit_fd(restorecon_t)
|
|
Chris PeBenito |
1e5c2a |
|
|
Chris PeBenito |
c9428d |
files_read_etc_runtime_files(restorecon_t)
|
|
Chris PeBenito |
c9428d |
files_read_generic_etc_files(restorecon_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
c9428d |
libs_use_ld_so(restorecon_t)
|
|
Chris PeBenito |
c9428d |
libs_use_shared_libs(restorecon_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
c9428d |
logging_send_syslog_msg(restorecon_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
c9428d |
userdom_use_all_user_fd(restorecon_t)
|
|
Chris PeBenito |
26c87e |
|
|
Chris PeBenito |
c3c58c |
optional_policy(`hotplug.te',`
|
|
Chris PeBenito |
c9428d |
hotplug_use_fd(restorecon_t)
|
|
Chris PeBenito |
c3c58c |
')
|
|
Chris PeBenito |
c3c58c |
|
|
Chris PeBenito |
ee5772 |
# relabeling rules
|
|
Chris PeBenito |
0fd9dc |
kernel_relabel_unlabeled(restorecon_t)
|
|
Karl MacMillan |
f0c985 |
dev_relabel_all_dev_nodes(restorecon_t)
|
|
Karl MacMillan |
f0c985 |
|
|
Chris PeBenito |
efd8ed |
files_relabel_all_files(restorecon_t)
|
|
Chris PeBenito |
c9428d |
files_list_all_dirs(restorecon_t)
|
|
Chris PeBenito |
a1f94a |
# this is to satisfy the assertion:
|
|
Chris PeBenito |
c9428d |
auth_relabelto_shadow(restorecon_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
254bbc |
ifdef(`distro_redhat', `
|
|
Chris PeBenito |
763c44 |
fs_use_tmpfs_character_devices(restorecon_t)
|
|
Chris PeBenito |
763c44 |
fs_use_tmpfs_block_devices(restorecon_t)
|
|
Chris PeBenito |
763c44 |
fs_relabel_tmpfs_block_devices(restorecon_t)
|
|
Chris PeBenito |
763c44 |
fs_relabel_tmpfs_character_devices(restorecon_t)
|
|
Chris PeBenito |
daa0e0 |
')
|
|
Chris PeBenito |
daa0e0 |
|
|
Chris PeBenito |
ee5772 |
ifdef(`TODO',`
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
# for upgrading glibc and other shared objects - without this the upgrade
|
|
Chris PeBenito |
ee5772 |
# scripts will put things in a state such that restorecon can not be run!
|
|
Chris PeBenito |
ee5772 |
allow restorecon_t lib_t:file { read execute };
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
allow restorecon_t fs_type:dir r_dir_perms;
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
allow restorecon_t device_t:file { read write };
|
|
Chris PeBenito |
ee5772 |
allow restorecon_t kernel_t:fifo_file { read write };
|
|
Chris PeBenito |
ee5772 |
') dnl endif TODO
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
8623d5 |
#################################
|
|
Chris PeBenito |
8623d5 |
#
|
|
Chris PeBenito |
8623d5 |
# Run_init local policy
|
|
Chris PeBenito |
8623d5 |
#
|
|
Chris PeBenito |
8623d5 |
|
|
Chris PeBenito |
5e0da6 |
selinux_get_fs_mount(run_init_t)
|
|
Chris PeBenito |
5e0da6 |
selinux_validate_context(run_init_t)
|
|
Chris PeBenito |
5e0da6 |
selinux_compute_access_vector(run_init_t)
|
|
Chris PeBenito |
5e0da6 |
selinux_compute_create_context(run_init_t)
|
|
Chris PeBenito |
5e0da6 |
selinux_compute_relabel_context(run_init_t)
|
|
Chris PeBenito |
5e0da6 |
selinux_compute_user_contexts(run_init_t)
|
|
Chris PeBenito |
8623d5 |
|
|
Chris PeBenito |
254bbc |
ifdef(`targeted_policy',`',`
|
|
Chris PeBenito |
0c73cd |
allow run_init_t self:process setexec;
|
|
Chris PeBenito |
0c73cd |
allow run_init_t self:capability setuid;
|
|
Chris PeBenito |
8623d5 |
|
|
Chris PeBenito |
cc41a9 |
allow run_init_t self:fifo_file rw_file_perms;
|
|
Chris PeBenito |
8623d5 |
|
|
Chris PeBenito |
0c73cd |
# often the administrator runs such programs from a directory that is owned
|
|
Chris PeBenito |
0c73cd |
# by a different user or has restrictive SE permissions, do not want to audit
|
|
Chris PeBenito |
0c73cd |
# the failed access to the current directory
|
|
Chris PeBenito |
0c73cd |
dontaudit run_init_t self:capability { dac_override dac_read_search };
|
|
Chris PeBenito |
8623d5 |
|
|
Chris PeBenito |
0fd9dc |
fs_getattr_xattr_fs(run_init_t)
|
|
Chris PeBenito |
8623d5 |
|
|
Chris PeBenito |
c9428d |
dev_dontaudit_list_all_dev_nodes(run_init_t)
|
|
Chris PeBenito |
8623d5 |
|
|
Chris PeBenito |
0fd9dc |
term_dontaudit_list_ptys(run_init_t)
|
|
Chris PeBenito |
8623d5 |
|
|
Chris PeBenito |
c9428d |
auth_domtrans_chk_passwd(run_init_t)
|
|
Chris PeBenito |
c9428d |
auth_dontaudit_read_shadow(run_init_t)
|
|
Chris PeBenito |
8623d5 |
|
|
Chris PeBenito |
c9428d |
corecmd_exec_bin(run_init_t)
|
|
Chris PeBenito |
c9428d |
corecmd_exec_shell(run_init_t)
|
|
Chris PeBenito |
8623d5 |
|
|
Chris PeBenito |
c9428d |
domain_use_wide_inherit_fd(run_init_t)
|
|
Chris PeBenito |
8623d5 |
|
|
Chris PeBenito |
c9428d |
files_read_generic_etc_files(run_init_t)
|
|
Chris PeBenito |
c9428d |
files_dontaudit_search_all_dirs(run_init_t)
|
|
Chris PeBenito |
8623d5 |
|
|
Chris PeBenito |
c9428d |
init_domtrans_script(run_init_t)
|
|
Chris PeBenito |
0c73cd |
# for utmp
|
|
Chris PeBenito |
c9428d |
init_rw_script_pid(run_init_t)
|
|
Chris PeBenito |
8623d5 |
|
|
Chris PeBenito |
c9428d |
libs_use_ld_so(run_init_t)
|
|
Chris PeBenito |
c9428d |
libs_use_shared_libs(run_init_t)
|
|
Chris PeBenito |
8623d5 |
|
|
Chris PeBenito |
5e0da6 |
seutil_read_config(run_init_t)
|
|
Chris PeBenito |
5e0da6 |
seutil_read_default_contexts(run_init_t)
|
|
Chris PeBenito |
8623d5 |
|
|
Chris PeBenito |
0c73cd |
miscfiles_read_localization(run_init_t)
|
|
Chris PeBenito |
8623d5 |
|
|
Chris PeBenito |
c9428d |
logging_send_syslog_msg(run_init_t)
|
|
Chris PeBenito |
8623d5 |
') dnl end ifdef targeted policy
|
|
Chris PeBenito |
8623d5 |
|
|
Chris PeBenito |
8623d5 |
ifdef(`TODO',`
|
|
Chris PeBenito |
8623d5 |
|
|
Chris PeBenito |
254bbc |
ifdef(`distro_gentoo', `
|
|
Chris PeBenito |
0c73cd |
# Gentoo integrated run_init+open_init_pty-runscript:
|
|
Chris PeBenito |
0c73cd |
domain_auto_trans(sysadm_t,initrc_exec_t,run_init_t)
|
|
Chris PeBenito |
c9428d |
domain_entry_file(run_init_t,initrc_exec_t)
|
|
Chris PeBenito |
8623d5 |
')
|
|
Chris PeBenito |
8623d5 |
') dnl end TODO
|
|
Chris PeBenito |
8623d5 |
|
|
Chris PeBenito |
ee5772 |
########################################
|
|
Chris PeBenito |
ee5772 |
#
|
|
Chris PeBenito |
ee5772 |
# Setfiles local policy
|
|
Chris PeBenito |
ee5772 |
#
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
allow setfiles_t self:capability { dac_override dac_read_search fowner };
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
cc41a9 |
allow setfiles_t { policy_src_t policy_config_t file_context_t selinux_config_t default_context_t }:dir r_dir_perms;
|
|
Chris PeBenito |
cc41a9 |
allow setfiles_t { policy_src_t policy_config_t file_context_t selinux_config_t default_context_t }:file r_file_perms;
|
|
Chris PeBenito |
cc41a9 |
allow setfiles_t { policy_src_t policy_config_t file_context_t selinux_config_t default_context_t }:lnk_file r_file_perms;
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
kernel_read_system_state(setfiles_t)
|
|
Chris PeBenito |
5e0da6 |
selinux_get_fs_mount(setfiles_t)
|
|
Chris PeBenito |
5e0da6 |
selinux_validate_context(setfiles_t)
|
|
Chris PeBenito |
5e0da6 |
selinux_compute_access_vector(setfiles_t)
|
|
Chris PeBenito |
5e0da6 |
selinux_compute_create_context(setfiles_t)
|
|
Chris PeBenito |
5e0da6 |
selinux_compute_relabel_context(setfiles_t)
|
|
Chris PeBenito |
5e0da6 |
selinux_compute_user_contexts(setfiles_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
0fd9dc |
fs_getattr_xattr_fs(setfiles_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
0fd9dc |
term_use_all_user_ttys(setfiles_t)
|
|
Chris PeBenito |
0fd9dc |
term_use_all_user_ptys(setfiles_t)
|
|
Chris PeBenito |
0fd9dc |
term_use_unallocated_tty(setfiles_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
c9428d |
init_use_fd(setfiles_t)
|
|
Chris PeBenito |
c9428d |
init_use_script_fd(setfiles_t)
|
|
Chris PeBenito |
c9428d |
init_use_script_pty(setfiles_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
c9428d |
domain_use_wide_inherit_fd(setfiles_t)
|
|
Chris PeBenito |
1e5c2a |
|
|
Chris PeBenito |
c9428d |
libs_use_ld_so(setfiles_t)
|
|
Chris PeBenito |
c9428d |
libs_use_shared_libs(setfiles_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
c9428d |
files_read_etc_runtime_files(setfiles_t)
|
|
Chris PeBenito |
c9428d |
files_read_generic_etc_files(setfiles_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
c9428d |
logging_send_syslog_msg(setfiles_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
miscfiles_read_localization(setfiles_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
c9428d |
userdom_use_all_user_fd(setfiles_t)
|
|
Chris PeBenito |
daa0e0 |
# for config files in a home directory
|
|
Chris PeBenito |
c9428d |
userdom_read_all_user_data(setfiles_t)
|
|
Chris PeBenito |
26c87e |
|
|
Chris PeBenito |
ee5772 |
# relabeling rules
|
|
Chris PeBenito |
0fd9dc |
kernel_relabel_unlabeled(setfiles_t)
|
|
Karl MacMillan |
f0c985 |
dev_relabel_all_dev_nodes(setfiles_t)
|
|
Chris PeBenito |
c9428d |
files_list_all_dirs(setfiles_t)
|
|
Chris PeBenito |
efd8ed |
files_relabel_all_files(setfiles_t)
|
|
Chris PeBenito |
a1f94a |
# this is to satisfy the assertion:
|
|
Chris PeBenito |
c9428d |
auth_relabelto_shadow(setfiles_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
ifdef(`TODO',`
|
|
Chris PeBenito |
ee5772 |
# for upgrading glibc and other shared objects - without this the upgrade
|
|
Chris PeBenito |
ee5772 |
# scripts will put things in a state such that setfiles can not be run!
|
|
Chris PeBenito |
ee5772 |
allow setfiles_t lib_t:file { read execute };
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
allow setfiles_t unlabeled_t:dir read;
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
allow setfiles_t fs_type:dir r_dir_perms;
|
|
Chris PeBenito |
b4cd15 |
|
|
Chris PeBenito |
ee5772 |
') dnl endif TODO
|