|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
0251df |
policy_module(domain,1.3.0)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
########################################
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
# Declarations
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# Mark process types as domains
|
|
Chris PeBenito |
17de1b |
attribute domain;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# Transitions only allowed from domains to other domains
|
|
Chris PeBenito |
17de1b |
neverallow domain ~domain:process { transition dyntransition };
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# Domains that are unconfined
|
|
Chris PeBenito |
17de1b |
attribute unconfined_domain_type;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# Domains that can set their current context
|
|
Chris PeBenito |
17de1b |
# (perform dynamic transitions)
|
|
Chris PeBenito |
17de1b |
attribute set_curr_context;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# enabling setcurrent breaks process tranquility. If you do not
|
|
Chris PeBenito |
17de1b |
# know what this means or do not understand the implications of a
|
|
Chris PeBenito |
17de1b |
# dynamic transition, you should not be using it!!!
|
|
Chris PeBenito |
17de1b |
neverallow { domain -set_curr_context } self:process setcurrent;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# entrypoint executables
|
|
Chris PeBenito |
17de1b |
attribute entry_type;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# widely-inheritable file descriptors
|
|
Chris PeBenito |
17de1b |
attribute privfd;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
# constraint related attributes
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# [1] types that can change SELinux identity on transition
|
|
Chris PeBenito |
17de1b |
attribute can_change_process_identity;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# [2] types that can change SELinux role on transition
|
|
Chris PeBenito |
17de1b |
attribute can_change_process_role;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# [3] types that can change the SELinux identity on a filesystem
|
|
Chris PeBenito |
17de1b |
# object or a socket object on a create or relabel
|
|
Chris PeBenito |
17de1b |
attribute can_change_object_identity;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# [3] types that can change to system_u:system_r
|
|
Chris PeBenito |
17de1b |
attribute can_system_change;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# [4] types that have attribute 1 can change the SELinux
|
|
Chris PeBenito |
17de1b |
# identity only if the target domain has this attribute.
|
|
Chris PeBenito |
17de1b |
# Types that have attribute 2 can change the SELinux role
|
|
Chris PeBenito |
17de1b |
# only if the target domain has this attribute.
|
|
Chris PeBenito |
17de1b |
attribute process_user_target;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# For cron jobs
|
|
Chris PeBenito |
17de1b |
# [5] types used for cron daemons
|
|
Chris PeBenito |
17de1b |
attribute cron_source_domain;
|
|
Chris PeBenito |
17de1b |
# [6] types used for cron jobs
|
|
Chris PeBenito |
17de1b |
attribute cron_job_domain;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# [7] types that are unconditionally exempt from
|
|
Chris PeBenito |
17de1b |
# SELinux identity and role change constraints
|
|
Chris PeBenito |
17de1b |
attribute process_uncond_exempt; # add userhelperdomain to this one
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
neverallow { domain unlabeled_t } ~{ domain unlabeled_t }:process *;
|
|
Chris PeBenito |
17de1b |
neverallow ~{ domain unlabeled_t } *:process *;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
########################################
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
# Rules applied to all domains
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# read /proc/(pid|self) entries
|
|
Chris PeBenito |
17de1b |
allow domain self:dir r_dir_perms;
|
|
Chris PeBenito |
17de1b |
allow domain self:lnk_file r_file_perms;
|
|
Chris PeBenito |
17de1b |
allow domain self:file rw_file_perms;
|
|
Chris PeBenito |
17de1b |
kernel_read_proc_symlinks(domain)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# create child processes in the domain
|
|
Chris PeBenito |
17de1b |
allow domain self:process { fork sigchld };
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# Use trusted objects in /dev
|
|
Chris PeBenito |
17de1b |
dev_rw_null(domain)
|
|
Chris PeBenito |
17de1b |
dev_rw_zero(domain)
|
|
Chris PeBenito |
17de1b |
term_use_controlling_term(domain)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# list the root directory
|
|
Chris PeBenito |
17de1b |
files_list_root(domain)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
ifdef(`targeted_policy',`
|
|
Chris PeBenito |
17de1b |
# RBAC is disabled in the targeted policy,
|
|
Chris PeBenito |
17de1b |
# as only one role is used, system_r.
|
|
Chris PeBenito |
17de1b |
role system_r types domain;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# FIXME:
|
|
Chris PeBenito |
17de1b |
# workaround until role dominance is fixed in
|
|
Chris PeBenito |
17de1b |
# the module compiler
|
|
Chris PeBenito |
17de1b |
role secadm_r types domain;
|
|
Chris PeBenito |
17de1b |
role sysadm_r types domain;
|
|
Chris PeBenito |
17de1b |
role user_r types domain;
|
|
Chris PeBenito |
17de1b |
role staff_r types domain;
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
tunable_policy(`global_ssp',`
|
|
Chris PeBenito |
17de1b |
# enable reading of urandom for all domains:
|
|
Chris PeBenito |
17de1b |
# this should be enabled when all programs
|
|
Chris PeBenito |
17de1b |
# are compiled with ProPolice/SSP
|
|
Chris PeBenito |
17de1b |
# stack smashing protection.
|
|
Chris PeBenito |
17de1b |
dev_read_urand(domain)
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
optional_policy(`
|
|
Chris PeBenito |
17de1b |
setrans_translate_context(domain)
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
########################################
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
# Unconfined access to this module
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# unconfined access also allows constraints, but this
|
|
Chris PeBenito |
17de1b |
# is handled in the interface as typeattribute cannot
|
|
Chris PeBenito |
17de1b |
# be used on an attribute.
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# Use/sendto/connectto sockets created by any domain.
|
|
Chris PeBenito |
17de1b |
allow unconfined_domain_type domain:{ socket_class_set socket key_socket } *;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# Use descriptors and pipes created by any domain.
|
|
Chris PeBenito |
17de1b |
allow unconfined_domain_type domain:fd use;
|
|
Chris PeBenito |
17de1b |
allow unconfined_domain_type domain:fifo_file rw_file_perms;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# Act upon any other process.
|
|
Chris PeBenito |
17de1b |
allow unconfined_domain_type domain:process ~{ transition dyntransition execmem execstack execheap };
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# Create/access any System V IPC objects.
|
|
Chris PeBenito |
17de1b |
allow unconfined_domain_type domain:{ sem msgq shm } *;
|
|
Chris PeBenito |
17de1b |
allow unconfined_domain_type domain:msg { send receive };
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# For /proc/pid
|
|
Chris PeBenito |
17de1b |
allow unconfined_domain_type domain:dir r_dir_perms;
|
|
Chris PeBenito |
17de1b |
allow unconfined_domain_type domain:file r_file_perms;
|
|
Chris PeBenito |
17de1b |
allow unconfined_domain_type domain:lnk_file r_file_perms;
|
|
Chris PeBenito |
d82267 |
|
|
Chris PeBenito |
d82267 |
# act on all domains keys
|
|
Chris PeBenito |
d82267 |
allow unconfined_domain_type domain:key *;
|