2019-07-13 18:07:11 +00:00
|
|
|
policy_module(selinux, 1.16.1)
|
2005-06-14 20:40:09 +00:00
|
|
|
|
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Declarations
|
|
|
|
#
|
|
|
|
|
2011-09-26 13:53:23 +00:00
|
|
|
## <desc>
|
|
|
|
## <p>
|
|
|
|
## Boolean to determine whether the system permits loading policy, setting
|
|
|
|
## enforcing mode, and changing boolean values. Set this to true and you
|
|
|
|
## have to reboot to set it back.
|
|
|
|
## </p>
|
|
|
|
## </desc>
|
|
|
|
gen_bool(secure_mode_policyload,false)
|
|
|
|
|
2009-01-13 13:01:48 +00:00
|
|
|
attribute boolean_type;
|
2005-07-05 20:59:51 +00:00
|
|
|
attribute can_load_policy;
|
|
|
|
attribute can_setenforce;
|
|
|
|
attribute can_setsecparam;
|
2006-05-19 15:15:45 +00:00
|
|
|
attribute selinux_unconfined_type;
|
2005-07-05 20:59:51 +00:00
|
|
|
|
2011-09-26 14:44:27 +00:00
|
|
|
type secure_mode_policyload_t;
|
|
|
|
selinux_labeled_boolean(secure_mode_policyload_t, secure_mode_policyload)
|
|
|
|
|
2016-12-06 12:28:10 +00:00
|
|
|
#
|
2005-06-14 20:40:09 +00:00
|
|
|
# security_t is the target type when checking
|
|
|
|
# the permissions in the security class. It is also
|
|
|
|
# applied to selinuxfs inodes.
|
|
|
|
#
|
2009-01-13 13:01:48 +00:00
|
|
|
type security_t, boolean_type;
|
2012-03-25 12:42:37 +00:00
|
|
|
files_mountpoint(security_t)
|
2005-06-28 17:48:59 +00:00
|
|
|
fs_type(security_t)
|
2005-09-26 20:26:32 +00:00
|
|
|
mls_trusted_object(security_t)
|
2006-10-04 17:25:34 +00:00
|
|
|
sid security gen_context(system_u:object_r:security_t,mls_systemhigh)
|
2005-10-06 19:33:06 +00:00
|
|
|
genfscon selinuxfs / gen_context(system_u:object_r:security_t,s0)
|
2008-03-14 14:55:34 +00:00
|
|
|
genfscon securityfs / gen_context(system_u:object_r:security_t,s0)
|
2005-07-05 20:59:51 +00:00
|
|
|
|
2015-11-04 20:10:29 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Controlled setenforce access
|
|
|
|
#
|
|
|
|
|
2006-05-19 15:15:45 +00:00
|
|
|
neverallow ~{ selinux_unconfined_type can_setenforce } security_t:security setenforce;
|
2015-11-04 20:10:29 +00:00
|
|
|
|
|
|
|
allow can_setenforce security_t:dir list_dir_perms;
|
|
|
|
allow can_setenforce security_t:file rw_file_perms;
|
|
|
|
|
|
|
|
dev_search_sysfs(can_setenforce)
|
|
|
|
|
|
|
|
if(!secure_mode_policyload) {
|
|
|
|
allow can_setenforce security_t:security setenforce;
|
|
|
|
}
|
|
|
|
|
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Controlled load_policy access
|
|
|
|
#
|
|
|
|
|
|
|
|
neverallow ~{ selinux_unconfined_type can_load_policy } security_t:security load_policy;
|
|
|
|
|
|
|
|
allow can_load_policy security_t:dir list_dir_perms;
|
|
|
|
allow can_load_policy security_t:file rw_file_perms;
|
|
|
|
|
|
|
|
dev_search_sysfs(can_load_policy)
|
|
|
|
|
|
|
|
if(!secure_mode_policyload) {
|
|
|
|
allow can_load_policy security_t:security load_policy;
|
|
|
|
}
|
|
|
|
|
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Controlled security parameters access
|
|
|
|
#
|
|
|
|
|
2006-05-19 15:15:45 +00:00
|
|
|
neverallow ~{ selinux_unconfined_type can_setsecparam } security_t:security setsecparam;
|
|
|
|
|
2015-11-04 20:10:29 +00:00
|
|
|
allow can_setsecparam security_t:dir list_dir_perms;
|
|
|
|
allow can_setsecparam security_t:file rw_file_perms;
|
|
|
|
allow can_setsecparam security_t:security setsecparam;
|
|
|
|
auditallow can_setsecparam security_t:security setsecparam;
|
|
|
|
|
|
|
|
dev_search_sysfs(can_setsecparam)
|
|
|
|
|
2006-05-19 15:15:45 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Unconfined access to this module
|
|
|
|
#
|
|
|
|
|
|
|
|
# use SELinuxfs
|
2008-10-16 16:09:20 +00:00
|
|
|
allow selinux_unconfined_type security_t:dir list_dir_perms;
|
|
|
|
allow selinux_unconfined_type security_t:file rw_file_perms;
|
2009-01-13 13:01:48 +00:00
|
|
|
allow selinux_unconfined_type boolean_type:file read_file_perms;
|
2011-09-26 14:44:27 +00:00
|
|
|
allow selinux_unconfined_type { boolean_type -secure_mode_policyload_t }:file write_file_perms;
|
2006-05-19 15:15:45 +00:00
|
|
|
|
|
|
|
# Access the security API.
|
2017-08-13 20:21:44 +00:00
|
|
|
allow selinux_unconfined_type security_t:security { compute_av compute_create compute_member check_context compute_relabel compute_user setbool setsecparam setcheckreqprot read_policy validate_trans };
|
2011-09-26 14:44:27 +00:00
|
|
|
|
2006-05-19 15:15:45 +00:00
|
|
|
if(!secure_mode_policyload) {
|
2011-09-26 14:44:27 +00:00
|
|
|
allow selinux_unconfined_type security_t:security { load_policy setenforce };
|
|
|
|
allow selinux_unconfined_type secure_mode_policyload_t:file write_file_perms;
|
2006-05-19 15:15:45 +00:00
|
|
|
}
|