|
Chris PeBenito |
e181fe |
# Copyright (C) 2005 Tresys Technology, LLC
|
|
Chris PeBenito |
e181fe |
|
|
Chris PeBenito |
960373 |
policy_module(selinux,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 |
ee5772 |
domain_make_domain(checkpolicy_t)
|
|
Chris PeBenito |
ee5772 |
role system_r types checkpolicy_t;
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
type checkpolicy_exec_t;
|
|
Chris PeBenito |
ee5772 |
domain_make_entrypoint_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 |
ee5772 |
files_make_file(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 |
ee5772 |
files_make_file(file_context_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
type load_policy_t;
|
|
Chris PeBenito |
ee5772 |
domain_make_domain(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 |
ee5772 |
domain_make_entrypoint_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 |
18f25a |
kernel_make_role_change_constraint_exception(newrole_t)
|
|
Chris PeBenito |
18f25a |
kernel_make_object_identity_change_constraint_exception(newrole_t)
|
|
Chris PeBenito |
ee5772 |
domain_make_domain(newrole_t)
|
|
Chris PeBenito |
a1f94a |
domain_make_file_descriptors_widely_inheritable(newrole_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
type newrole_exec_t;
|
|
Chris PeBenito |
ee5772 |
domain_make_entrypoint_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 |
b4cd15 |
files_make_file(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 |
b4cd15 |
files_make_file(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 |
18f25a |
kernel_make_object_identity_change_constraint_exception(restorecon_t)
|
|
Chris PeBenito |
ff3138 |
init_make_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 |
8623d5 |
domain_make_domain(run_init_t)
|
|
Chris PeBenito |
8623d5 |
|
|
Chris PeBenito |
8623d5 |
type run_init_exec_t;
|
|
Chris PeBenito |
8623d5 |
domain_make_entrypoint_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 |
ee5772 |
files_make_file(selinux_config_t)
|
|
Chris PeBenito |
b4cd15 |
|
|
Chris PeBenito |
a1f94a |
type setfiles_t, can_relabelto_binary_policy;
|
|
Chris PeBenito |
18f25a |
kernel_make_object_identity_change_constraint_exception(setfiles_t)
|
|
Chris PeBenito |
ee5772 |
domain_make_domain(setfiles_t)
|
|
Chris PeBenito |
ee5772 |
role system_r types setfiles_t;
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
type setfiles_exec_t;
|
|
Chris PeBenito |
ee5772 |
domain_make_entrypoint_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 |
ee5772 |
allow checkpolicy_t policy_config_t:dir { read getattr lock search ioctl add_name remove_name write };
|
|
Chris PeBenito |
ee5772 |
allow checkpolicy_t policy_config_t:file { create ioctl read getattr lock write setattr append link unlink rename };
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
a1f94a |
# allow test policies to be created in src directories
|
|
Chris PeBenito |
a1f94a |
allow checkpolicy_t policy_src_t:dir { getattr search read write add_name remove_name };
|
|
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 |
ee5772 |
allow checkpolicy_t policy_src_t:dir { getattr search read };
|
|
Chris PeBenito |
efd8ed |
allow checkpolicy_t policy_src_t:file { getattr read ioctl };
|
|
Chris PeBenito |
efd8ed |
allow checkpolicy_t policy_src_t:lnk_file { getattr read };
|
|
Chris PeBenito |
ee5772 |
allow checkpolicy_t selinux_config_t:dir search;
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
filesystem_get_persistent_filesystem_attributes(checkpolicy_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
terminal_use_console(checkpolicy_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
26c87e |
domain_use_widely_inheritable_file_descriptors(checkpolicy_t)
|
|
Chris PeBenito |
26c87e |
|
|
Chris PeBenito |
daa0e0 |
# directory search permissions for path to source and binary policy files
|
|
Chris PeBenito |
daa0e0 |
files_search_general_system_config_directory(checkpolicy_t)
|
|
Chris PeBenito |
daa0e0 |
|
|
Chris PeBenito |
ee5772 |
init_use_file_descriptors(checkpolicy_t)
|
|
Chris PeBenito |
ee5772 |
init_script_use_pseudoterminal(checkpolicy_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
libraries_use_dynamic_loader(checkpolicy_t)
|
|
Chris PeBenito |
dd14d0 |
libraries_use_shared_libraries(checkpolicy_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
26c87e |
userdomain_use_all_users_file_descriptors(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 |
ee5772 |
allow load_policy_t policy_config_t:dir { getattr search read };
|
|
Chris PeBenito |
ee5772 |
allow load_policy_t policy_config_t:{ file lnk_file sock_file fifo_file } { getattr read };
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
efd8ed |
allow load_policy_t selinux_config_t:dir { getattr read search };
|
|
Chris PeBenito |
efd8ed |
allow load_policy_t selinux_config_t:file { read getattr };
|
|
Chris PeBenito |
efd8ed |
allow load_policy_t selinux_config_t:lnk_file { getattr read };
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
kernel_get_selinuxfs_mount_point(load_policy_t)
|
|
Chris PeBenito |
ee5772 |
kernel_load_selinux_policy(load_policy_t)
|
|
Chris PeBenito |
ee5772 |
kernel_set_selinux_boolean(load_policy_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
filesystem_get_persistent_filesystem_attributes(load_policy_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
terminal_use_console(load_policy_t)
|
|
Chris PeBenito |
ee5772 |
terminal_list_pseudoterminals(load_policy_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
init_script_use_file_descriptors(load_policy_t)
|
|
Chris PeBenito |
ee5772 |
init_script_use_pseudoterminal(load_policy_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
1e5c2a |
domain_use_widely_inheritable_file_descriptors(load_policy_t)
|
|
Chris PeBenito |
1e5c2a |
|
|
Chris PeBenito |
efd8ed |
files_search_general_system_config_directory(load_policy_t)
|
|
Chris PeBenito |
efd8ed |
|
|
Chris PeBenito |
ee5772 |
libraries_use_dynamic_loader(load_policy_t)
|
|
Chris PeBenito |
dd14d0 |
libraries_use_shared_libraries(load_policy_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
miscfiles_read_localization(load_policy_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
26c87e |
userdomain_use_all_users_file_descriptors(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 |
ee5772 |
allow newrole_t self:fifo_file { read getattr lock ioctl write append };
|
|
Chris PeBenito |
ee5772 |
allow newrole_t self:unix_dgram_socket sendto;
|
|
Chris PeBenito |
ee5772 |
allow newrole_t self:unix_stream_socket connectto;
|
|
Chris PeBenito |
ee5772 |
allow newrole_t self:shm { associate getattr setattr create destroy read write lock unix_read unix_write };
|
|
Chris PeBenito |
ee5772 |
allow newrole_t self:sem { associate getattr setattr create destroy read write unix_read unix_write };
|
|
Chris PeBenito |
ee5772 |
allow newrole_t self:msgq { associate getattr setattr create destroy read write enqueue unix_read unix_write };
|
|
Chris PeBenito |
ee5772 |
allow newrole_t self:msg { send receive };
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
allow newrole_t { selinux_config_t default_context_t }:dir { getattr read search };
|
|
Chris PeBenito |
ee5772 |
allow newrole_t { selinux_config_t default_context_t }:file { read getattr };
|
|
Chris PeBenito |
ee5772 |
allow newrole_t { selinux_config_t default_context_t }:lnk_file { getattr read };
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
kernel_read_system_state(newrole_t)
|
|
Chris PeBenito |
ee5772 |
kernel_read_kernel_sysctl(newrole_t)
|
|
Chris PeBenito |
ee5772 |
kernel_get_selinuxfs_mount_point(newrole_t)
|
|
Chris PeBenito |
ee5772 |
kernel_validate_selinux_context(newrole_t)
|
|
Chris PeBenito |
178607 |
kernel_compute_selinux_access_vector(newrole_t)
|
|
Chris PeBenito |
178607 |
kernel_compute_selinux_create_context(newrole_t)
|
|
Chris PeBenito |
178607 |
kernel_compute_selinux_relabel_context(newrole_t)
|
|
Chris PeBenito |
178607 |
kernel_compute_selinux_reachable_user_contexts(newrole_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
devices_get_pseudorandom_data(newrole_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
filesystem_get_persistent_filesystem_attributes(newrole_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
b16c6b |
terminal_use_all_private_physical_terminals(newrole_t)
|
|
Chris PeBenito |
b16c6b |
terminal_use_all_private_pseudoterminals(newrole_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
daa0e0 |
authlogin_check_password_transition(newrole_t)
|
|
Chris PeBenito |
1e5c2a |
|
|
Chris PeBenito |
1e5c2a |
domain_use_widely_inheritable_file_descriptors(newrole_t)
|
|
Chris PeBenito |
1e5c2a |
|
|
Chris PeBenito |
daa0e0 |
# Write to utmp.
|
|
Chris PeBenito |
daa0e0 |
init_script_modify_runtime_data(newrole_t)
|
|
Chris PeBenito |
daa0e0 |
|
|
Chris PeBenito |
ee5772 |
files_read_general_system_config(newrole_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
libraries_use_dynamic_loader(newrole_t)
|
|
Chris PeBenito |
dd14d0 |
libraries_use_shared_libraries(newrole_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
a1f94a |
logging_send_system_log_message(newrole_t)
|
|
Chris PeBenito |
a1f94a |
|
|
Chris PeBenito |
ee5772 |
miscfiles_read_localization(newrole_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
daa0e0 |
userdomain_use_all_unprivileged_users_file_descriptors(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 |
ee5772 |
allow restorecon_t { policy_src_t policy_config_t file_context_t selinux_config_t default_context_t }:dir { getattr read search };
|
|
Chris PeBenito |
ee5772 |
allow restorecon_t { policy_src_t policy_config_t file_context_t selinux_config_t default_context_t }:file { read getattr };
|
|
Chris PeBenito |
ee5772 |
allow restorecon_t { policy_src_t policy_config_t file_context_t selinux_config_t default_context_t }:lnk_file { getattr read };
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
kernel_use_file_descriptors(restorecon_t)
|
|
Chris PeBenito |
ee5772 |
kernel_read_system_state(restorecon_t)
|
|
Chris PeBenito |
ee5772 |
kernel_get_selinuxfs_mount_point(restorecon_t)
|
|
Chris PeBenito |
ee5772 |
kernel_validate_selinux_context(restorecon_t)
|
|
Chris PeBenito |
178607 |
kernel_compute_selinux_access_vector(restorecon_t)
|
|
Chris PeBenito |
178607 |
kernel_compute_selinux_create_context(restorecon_t)
|
|
Chris PeBenito |
178607 |
kernel_compute_selinux_relabel_context(restorecon_t)
|
|
Chris PeBenito |
178607 |
kernel_compute_selinux_reachable_user_contexts(restorecon_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
filesystem_get_persistent_filesystem_attributes(restorecon_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
1e5c2a |
terminal_use_general_physical_terminal(restorecon_t)
|
|
Chris PeBenito |
1e5c2a |
|
|
Chris PeBenito |
ee5772 |
init_use_file_descriptors(restorecon_t)
|
|
Chris PeBenito |
ee5772 |
init_script_use_pseudoterminal(restorecon_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
1e5c2a |
domain_use_widely_inheritable_file_descriptors(restorecon_t)
|
|
Chris PeBenito |
1e5c2a |
|
|
Chris PeBenito |
ee5772 |
files_read_runtime_system_config(restorecon_t)
|
|
Chris PeBenito |
ee5772 |
files_read_general_system_config(restorecon_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
libraries_use_dynamic_loader(restorecon_t)
|
|
Chris PeBenito |
dd14d0 |
libraries_use_shared_libraries(restorecon_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
logging_send_system_log_message(restorecon_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
26c87e |
userdomain_use_all_users_file_descriptors(restorecon_t)
|
|
Chris PeBenito |
26c87e |
|
|
Chris PeBenito |
c3c58c |
optional_policy(`hotplug.te',`
|
|
Chris PeBenito |
c3c58c |
hotplug_use_file_descriptors(restorecon_t)
|
|
Chris PeBenito |
c3c58c |
')
|
|
Chris PeBenito |
c3c58c |
|
|
Chris PeBenito |
ee5772 |
# relabeling rules
|
|
Chris PeBenito |
ee5772 |
kernel_relabel_unlabeled_object(restorecon_t)
|
|
Chris PeBenito |
ee5772 |
devices_manage_all_devices_labels(restorecon_t)
|
|
Chris PeBenito |
efd8ed |
files_relabel_all_files(restorecon_t)
|
|
Chris PeBenito |
e843cc |
files_read_all_directories(restorecon_t)
|
|
Chris PeBenito |
a1f94a |
# this is to satisfy the assertion:
|
|
Chris PeBenito |
a1f94a |
authlogin_relabel_to_shadow_passwords(restorecon_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
daa0e0 |
tunable_policy(`distro_redhat', `
|
|
Chris PeBenito |
daa0e0 |
filesystem_use_tmpfs_character_devices(restorecon_t)
|
|
Chris PeBenito |
daa0e0 |
filesystem_use_tmpfs_block_devices(restorecon_t)
|
|
Chris PeBenito |
efd8ed |
filesystem_relabel_tmpfs_block_devices(restorecon_t)
|
|
Chris PeBenito |
efd8ed |
filesystem_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 |
8623d5 |
kernel_get_selinuxfs_mount_point(run_init_t)
|
|
Chris PeBenito |
8623d5 |
kernel_validate_selinux_context(run_init_t)
|
|
Chris PeBenito |
8623d5 |
kernel_compute_selinux_access_vector(run_init_t)
|
|
Chris PeBenito |
8623d5 |
kernel_compute_selinux_create_context(run_init_t)
|
|
Chris PeBenito |
8623d5 |
kernel_compute_selinux_relabel_context(run_init_t)
|
|
Chris PeBenito |
8623d5 |
kernel_compute_selinux_reachable_user_contexts(run_init_t)
|
|
Chris PeBenito |
8623d5 |
|
|
Chris PeBenito |
8623d5 |
tunable_policy(`targeted_policy',`
|
|
Chris PeBenito |
8623d5 |
# targeted/unconfined stuff
|
|
Chris PeBenito |
8623d5 |
',`
|
|
Chris PeBenito |
8623d5 |
|
|
Chris PeBenito |
8623d5 |
allow run_init_t self:process setexec;
|
|
Chris PeBenito |
8623d5 |
allow run_init_t self:capability setuid;
|
|
Chris PeBenito |
8623d5 |
|
|
Chris PeBenito |
8623d5 |
allow run_init_t self:fifo_file { getattr read write };
|
|
Chris PeBenito |
8623d5 |
|
|
Chris PeBenito |
8623d5 |
# often the administrator runs such programs from a directory that is owned
|
|
Chris PeBenito |
8623d5 |
# by a different user or has restrictive SE permissions, do not want to audit
|
|
Chris PeBenito |
8623d5 |
# the failed access to the current directory
|
|
Chris PeBenito |
8623d5 |
dontaudit run_init_t self:capability { dac_override dac_read_search };
|
|
Chris PeBenito |
8623d5 |
|
|
Chris PeBenito |
8623d5 |
filesystem_get_persistent_filesystem_attributes(run_init_t)
|
|
Chris PeBenito |
8623d5 |
|
|
Chris PeBenito |
8623d5 |
devices_ignore_list_device_nodes(run_init_t)
|
|
Chris PeBenito |
8623d5 |
|
|
Chris PeBenito |
8623d5 |
terminal_ignore_list_pseudoterminals(run_init_t)
|
|
Chris PeBenito |
8623d5 |
|
|
Chris PeBenito |
daa0e0 |
authlogin_check_password_transition(run_init_t)
|
|
Chris PeBenito |
8623d5 |
authlogin_ignore_read_shadow_passwords(run_init_t)
|
|
Chris PeBenito |
8623d5 |
|
|
Chris PeBenito |
8623d5 |
corecommands_execute_general_programs(run_init_t)
|
|
Chris PeBenito |
8623d5 |
corecommands_execute_shell(run_init_t)
|
|
Chris PeBenito |
8623d5 |
|
|
Chris PeBenito |
8623d5 |
domain_use_widely_inheritable_file_descriptors(run_init_t)
|
|
Chris PeBenito |
8623d5 |
|
|
Chris PeBenito |
8623d5 |
files_read_general_system_config(run_init_t)
|
|
Chris PeBenito |
8623d5 |
files_ignore_search_all_directories(run_init_t)
|
|
Chris PeBenito |
8623d5 |
|
|
Chris PeBenito |
8623d5 |
init_script_transition(run_init_t)
|
|
Chris PeBenito |
8623d5 |
# for utmp
|
|
Chris PeBenito |
8623d5 |
init_script_modify_runtime_data(run_init_t)
|
|
Chris PeBenito |
8623d5 |
|
|
Chris PeBenito |
8623d5 |
libraries_use_dynamic_loader(run_init_t)
|
|
Chris PeBenito |
8623d5 |
libraries_use_shared_libraries(run_init_t)
|
|
Chris PeBenito |
8623d5 |
|
|
Chris PeBenito |
8623d5 |
selinux_read_config(run_init_t)
|
|
Chris PeBenito |
8623d5 |
selinux_read_default_contexts(run_init_t)
|
|
Chris PeBenito |
8623d5 |
|
|
Chris PeBenito |
8623d5 |
miscfiles_read_localization(run_init_t)
|
|
Chris PeBenito |
8623d5 |
|
|
Chris PeBenito |
8623d5 |
logging_send_system_log_message(run_init_t)
|
|
Chris PeBenito |
8623d5 |
') dnl end ifdef targeted policy
|
|
Chris PeBenito |
8623d5 |
|
|
Chris PeBenito |
8623d5 |
ifdef(`TODO',`
|
|
Chris PeBenito |
8623d5 |
|
|
Chris PeBenito |
8623d5 |
tunable_policy(`targeted_policy', `
|
|
Chris PeBenito |
8623d5 |
domain_auto_trans(unconfined_t, initrc_exec_t, initrc_t)
|
|
Chris PeBenito |
8623d5 |
allow unconfined_t initrc_t:dbus { acquire_svc send_msg };
|
|
Chris PeBenito |
8623d5 |
allow initrc_t unconfined_t:dbus { acquire_svc send_msg };
|
|
Chris PeBenito |
8623d5 |
domain_trans(initrc_t, shell_exec_t, unconfined_t)
|
|
Chris PeBenito |
8623d5 |
') dnl endif targeted policy
|
|
Chris PeBenito |
8623d5 |
|
|
Chris PeBenito |
8623d5 |
tunable_policy(`distro_gentoo', `
|
|
Chris PeBenito |
8623d5 |
# Gentoo integrated run_init+open_init_pty-runscript:
|
|
Chris PeBenito |
8623d5 |
domain_auto_trans(sysadm_t,initrc_exec_t,run_init_t)
|
|
Chris PeBenito |
8623d5 |
domain_make_entrypoint_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 |
ee5772 |
allow setfiles_t { policy_src_t policy_config_t file_context_t selinux_config_t default_context_t }:dir { getattr read search };
|
|
Chris PeBenito |
ee5772 |
allow setfiles_t { policy_src_t policy_config_t file_context_t selinux_config_t default_context_t }:file { read getattr };
|
|
Chris PeBenito |
ee5772 |
allow setfiles_t { policy_src_t policy_config_t file_context_t selinux_config_t default_context_t }:lnk_file { getattr read };
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
kernel_read_system_state(setfiles_t)
|
|
Chris PeBenito |
ee5772 |
kernel_get_selinuxfs_mount_point(setfiles_t)
|
|
Chris PeBenito |
ee5772 |
kernel_validate_selinux_context(setfiles_t)
|
|
Chris PeBenito |
178607 |
kernel_compute_selinux_access_vector(setfiles_t)
|
|
Chris PeBenito |
178607 |
kernel_compute_selinux_create_context(setfiles_t)
|
|
Chris PeBenito |
178607 |
kernel_compute_selinux_relabel_context(setfiles_t)
|
|
Chris PeBenito |
178607 |
kernel_compute_selinux_reachable_user_contexts(setfiles_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
filesystem_get_persistent_filesystem_attributes(setfiles_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
b16c6b |
terminal_use_all_private_physical_terminals(setfiles_t)
|
|
Chris PeBenito |
b16c6b |
terminal_use_all_private_pseudoterminals(setfiles_t)
|
|
Chris PeBenito |
1e5c2a |
terminal_use_general_physical_terminal(setfiles_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
init_use_file_descriptors(setfiles_t)
|
|
Chris PeBenito |
ee5772 |
init_script_use_file_descriptors(setfiles_t)
|
|
Chris PeBenito |
ee5772 |
init_script_use_pseudoterminal(setfiles_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
1e5c2a |
domain_use_widely_inheritable_file_descriptors(setfiles_t)
|
|
Chris PeBenito |
1e5c2a |
|
|
Chris PeBenito |
ee5772 |
libraries_use_dynamic_loader(setfiles_t)
|
|
Chris PeBenito |
dd14d0 |
libraries_use_shared_libraries(setfiles_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
files_read_runtime_system_config(setfiles_t)
|
|
Chris PeBenito |
ee5772 |
files_read_general_system_config(setfiles_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
logging_send_system_log_message(setfiles_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
ee5772 |
miscfiles_read_localization(setfiles_t)
|
|
Chris PeBenito |
ee5772 |
|
|
Chris PeBenito |
26c87e |
userdomain_use_all_users_file_descriptors(setfiles_t)
|
|
Chris PeBenito |
daa0e0 |
# for config files in a home directory
|
|
Chris PeBenito |
daa0e0 |
userdomain_read_all_users_data(setfiles_t)
|
|
Chris PeBenito |
26c87e |
|
|
Chris PeBenito |
ee5772 |
# relabeling rules
|
|
Chris PeBenito |
ee5772 |
kernel_relabel_unlabeled_object(setfiles_t)
|
|
Chris PeBenito |
ee5772 |
devices_manage_all_devices_labels(setfiles_t)
|
|
Chris PeBenito |
e843cc |
files_read_all_directories(setfiles_t)
|
|
Chris PeBenito |
efd8ed |
files_relabel_all_files(setfiles_t)
|
|
Chris PeBenito |
a1f94a |
# this is to satisfy the assertion:
|
|
Chris PeBenito |
a1f94a |
authlogin_relabel_to_shadow_passwords(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
|