2020-05-04 12:55:09 +00:00
|
|
|
policy_module(domain, 1.16.2)
|
2005-04-26 17:00:25 +00:00
|
|
|
|
2005-06-30 18:54:08 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Declarations
|
|
|
|
#
|
|
|
|
|
2010-09-01 13:32:55 +00:00
|
|
|
## <desc>
|
|
|
|
## <p>
|
|
|
|
## Control the ability to mmap a low area of the address space,
|
|
|
|
## as configured by /proc/sys/kernel/mmap_min_addr.
|
|
|
|
## </p>
|
|
|
|
## </desc>
|
|
|
|
gen_tunable(mmap_low_allowed, false)
|
|
|
|
|
2005-04-14 20:18:17 +00:00
|
|
|
# Mark process types as domains
|
|
|
|
attribute domain;
|
|
|
|
|
2005-09-09 20:51:54 +00:00
|
|
|
# Transitions only allowed from domains to other domains
|
|
|
|
neverallow domain ~domain:process { transition dyntransition };
|
|
|
|
|
2005-09-15 15:34:31 +00:00
|
|
|
# Domains that are unconfined
|
2006-02-06 22:47:46 +00:00
|
|
|
attribute unconfined_domain_type;
|
2005-09-15 15:34:31 +00:00
|
|
|
|
2007-06-19 13:02:26 +00:00
|
|
|
# Domains that can mmap low memory.
|
|
|
|
attribute mmap_low_domain_type;
|
|
|
|
neverallow { domain -mmap_low_domain_type } self:memprotect mmap_zero;
|
|
|
|
|
2005-09-09 20:51:54 +00:00
|
|
|
# Domains that can set their current context
|
|
|
|
# (perform dynamic transitions)
|
|
|
|
attribute set_curr_context;
|
|
|
|
|
|
|
|
# enabling setcurrent breaks process tranquility. If you do not
|
|
|
|
# know what this means or do not understand the implications of a
|
|
|
|
# dynamic transition, you should not be using it!!!
|
|
|
|
neverallow { domain -set_curr_context } self:process setcurrent;
|
|
|
|
|
2016-01-06 14:09:36 +00:00
|
|
|
# No domain needs mac_override as it is unused by SELinux.
|
|
|
|
neverallow domain self:capability2 mac_override;
|
|
|
|
|
2005-04-26 17:00:25 +00:00
|
|
|
# entrypoint executables
|
|
|
|
attribute entry_type;
|
|
|
|
|
2005-04-22 19:31:32 +00:00
|
|
|
# widely-inheritable file descriptors
|
|
|
|
attribute privfd;
|
|
|
|
|
2005-09-09 20:51:54 +00:00
|
|
|
#
|
2005-06-14 19:56:46 +00:00
|
|
|
# constraint related attributes
|
2005-09-09 20:51:54 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
# [1] types that can change SELinux identity on transition
|
2005-06-14 19:56:46 +00:00
|
|
|
attribute can_change_process_identity;
|
2005-09-09 20:51:54 +00:00
|
|
|
|
|
|
|
# [2] types that can change SELinux role on transition
|
2005-06-14 19:56:46 +00:00
|
|
|
attribute can_change_process_role;
|
2005-09-09 20:51:54 +00:00
|
|
|
|
|
|
|
# [3] types that can change the SELinux identity on a filesystem
|
|
|
|
# object or a socket object on a create or relabel
|
2005-06-14 19:56:46 +00:00
|
|
|
attribute can_change_object_identity;
|
|
|
|
|
2005-09-09 20:51:54 +00:00
|
|
|
# [3] types that can change to system_u:system_r
|
|
|
|
attribute can_system_change;
|
2005-06-09 21:07:58 +00:00
|
|
|
|
2005-09-09 20:51:54 +00:00
|
|
|
# [4] types that have attribute 1 can change the SELinux
|
|
|
|
# identity only if the target domain has this attribute.
|
|
|
|
# Types that have attribute 2 can change the SELinux role
|
|
|
|
# only if the target domain has this attribute.
|
|
|
|
attribute process_user_target;
|
|
|
|
|
|
|
|
# For cron jobs
|
|
|
|
# [5] types used for cron daemons
|
|
|
|
attribute cron_source_domain;
|
|
|
|
# [6] types used for cron jobs
|
|
|
|
attribute cron_job_domain;
|
|
|
|
|
|
|
|
# [7] types that are unconditionally exempt from
|
|
|
|
# SELinux identity and role change constraints
|
|
|
|
attribute process_uncond_exempt; # add userhelperdomain to this one
|
2005-06-23 14:19:56 +00:00
|
|
|
|
2006-02-10 14:21:16 +00:00
|
|
|
neverallow { domain unlabeled_t } ~{ domain unlabeled_t }:process *;
|
2005-09-09 20:51:54 +00:00
|
|
|
neverallow ~{ domain unlabeled_t } *:process *;
|
2006-03-14 19:13:59 +00:00
|
|
|
|
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Rules applied to all domains
|
|
|
|
#
|
|
|
|
|
2006-07-06 17:00:29 +00:00
|
|
|
# read /proc/(pid|self) entries
|
2007-10-09 17:29:48 +00:00
|
|
|
allow domain self:dir list_dir_perms;
|
|
|
|
allow domain self:lnk_file { read_lnk_file_perms lock ioctl };
|
2006-03-14 19:13:59 +00:00
|
|
|
allow domain self:file rw_file_perms;
|
2006-07-06 17:00:29 +00:00
|
|
|
kernel_read_proc_symlinks(domain)
|
2007-10-29 18:35:32 +00:00
|
|
|
# Every domain gets the key ring, so we should default
|
|
|
|
# to no one allowed to look at it; afs kernel support creates
|
|
|
|
# a keyring
|
|
|
|
kernel_dontaudit_search_key(domain)
|
|
|
|
kernel_dontaudit_link_key(domain)
|
2006-03-14 19:13:59 +00:00
|
|
|
|
|
|
|
# create child processes in the domain
|
|
|
|
allow domain self:process { fork sigchld };
|
|
|
|
|
2014-03-25 20:30:06 +00:00
|
|
|
# glibc get_nprocs requires read access to /sys/devices/system/cpu/online
|
|
|
|
dev_read_cpu_online(domain)
|
|
|
|
|
2006-03-14 19:13:59 +00:00
|
|
|
# Use trusted objects in /dev
|
|
|
|
dev_rw_null(domain)
|
|
|
|
dev_rw_zero(domain)
|
|
|
|
term_use_controlling_term(domain)
|
|
|
|
|
|
|
|
# list the root directory
|
|
|
|
files_list_root(domain)
|
|
|
|
|
2011-08-22 16:49:25 +00:00
|
|
|
ifdef(`hide_broken_symptoms',`
|
|
|
|
# This check is in the general socket
|
|
|
|
# listen code, before protocol-specific
|
|
|
|
# listen function is called, so bad calls
|
|
|
|
# to listen on UDP sockets should be silenced
|
|
|
|
dontaudit domain self:udp_socket listen;
|
|
|
|
')
|
|
|
|
|
2015-10-23 14:16:59 +00:00
|
|
|
ifdef(`init_systemd',`
|
|
|
|
optional_policy(`
|
|
|
|
shutdown_sigchld(domain)
|
|
|
|
')
|
|
|
|
')
|
|
|
|
|
2006-03-14 19:13:59 +00:00
|
|
|
tunable_policy(`global_ssp',`
|
|
|
|
# enable reading of urandom for all domains:
|
|
|
|
# this should be enabled when all programs
|
|
|
|
# are compiled with ProPolice/SSP
|
|
|
|
# stack smashing protection.
|
|
|
|
dev_read_urand(domain)
|
|
|
|
')
|
2006-04-10 21:04:51 +00:00
|
|
|
|
2008-10-17 17:36:56 +00:00
|
|
|
optional_policy(`
|
|
|
|
libs_use_ld_so(domain)
|
|
|
|
libs_use_shared_libs(domain)
|
|
|
|
')
|
|
|
|
|
2007-10-29 18:35:32 +00:00
|
|
|
# xdm passes an open file descriptor to xsession-errors.log which is then audited by all confined domains.
|
|
|
|
optional_policy(`
|
|
|
|
xserver_dontaudit_use_xdm_fds(domain)
|
|
|
|
xserver_dontaudit_rw_xdm_pipes(domain)
|
|
|
|
')
|
|
|
|
|
2006-04-10 21:04:51 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Unconfined access to this module
|
|
|
|
#
|
|
|
|
|
|
|
|
# unconfined access also allows constraints, but this
|
|
|
|
# is handled in the interface as typeattribute cannot
|
|
|
|
# be used on an attribute.
|
|
|
|
|
2019-09-03 16:53:15 +00:00
|
|
|
# unconfined access to bpf
|
|
|
|
allow unconfined_domain_type domain:bpf { map_create map_read map_write prog_load prog_run };
|
|
|
|
|
2006-04-10 21:04:51 +00:00
|
|
|
# Use/sendto/connectto sockets created by any domain.
|
2017-05-18 20:00:39 +00:00
|
|
|
allow unconfined_domain_type domain:{ socket_class_set socket key_socket } { create_stream_socket_perms lock relabelto name_bind map sendto recvfrom relabelfrom };
|
2017-08-13 20:21:44 +00:00
|
|
|
allow unconfined_domain_type domain:rawip_socket node_bind;
|
|
|
|
allow unconfined_domain_type domain:sctp_socket node_bind;
|
|
|
|
allow unconfined_domain_type domain:icmp_socket node_bind;
|
|
|
|
allow unconfined_domain_type domain:udp_socket node_bind;
|
2017-05-18 20:00:39 +00:00
|
|
|
allow unconfined_domain_type domain:tcp_socket { node_bind name_connect };
|
2017-08-13 20:21:44 +00:00
|
|
|
allow unconfined_domain_type domain:tun_socket attach_queue;
|
2017-05-18 20:00:39 +00:00
|
|
|
allow unconfined_domain_type domain:unix_stream_socket connectto;
|
2017-08-13 20:21:44 +00:00
|
|
|
allow unconfined_domain_type domain:netlink_audit_socket { nlmsg_write nlmsg_relay nlmsg_readpriv nlmsg_read nlmsg_tty_audit };
|
|
|
|
allow unconfined_domain_type domain:netlink_route_socket { nlmsg_write nlmsg_read };
|
|
|
|
allow unconfined_domain_type domain:netlink_tcpdiag_socket { nlmsg_write nlmsg_read };
|
|
|
|
allow unconfined_domain_type domain:netlink_xfrm_socket { nlmsg_write nlmsg_read };
|
2006-04-10 21:04:51 +00:00
|
|
|
|
|
|
|
# Use descriptors and pipes created by any domain.
|
|
|
|
allow unconfined_domain_type domain:fd use;
|
2020-04-14 21:47:06 +00:00
|
|
|
allow unconfined_domain_type domain:fifo_file rw_fifo_file_perms;
|
2006-04-10 21:04:51 +00:00
|
|
|
|
|
|
|
# Act upon any other process.
|
2017-08-13 20:21:44 +00:00
|
|
|
allow unconfined_domain_type domain:process { fork signal_perms ptrace getsched setsched getsession getpgid setpgid getcap setcap share getattr setexec setfscreate noatsecure siginh setrlimit rlimitinh setcurrent setkeycreate setsockcreate getrlimit };
|
2006-04-10 21:04:51 +00:00
|
|
|
|
|
|
|
# Create/access any System V IPC objects.
|
2017-08-13 20:21:44 +00:00
|
|
|
allow unconfined_domain_type domain:sem create_sem_perms;
|
|
|
|
allow unconfined_domain_type domain:msgq create_msgq_perms;
|
|
|
|
allow unconfined_domain_type domain:shm create_shm_perms;
|
2006-04-10 21:04:51 +00:00
|
|
|
allow unconfined_domain_type domain:msg { send receive };
|
|
|
|
|
|
|
|
# For /proc/pid
|
2007-10-09 17:29:48 +00:00
|
|
|
allow unconfined_domain_type domain:dir list_dir_perms;
|
2009-06-11 15:00:48 +00:00
|
|
|
allow unconfined_domain_type domain:file rw_file_perms;
|
2007-10-09 17:29:48 +00:00
|
|
|
allow unconfined_domain_type domain:lnk_file { read_lnk_file_perms ioctl lock };
|
2006-07-14 13:11:42 +00:00
|
|
|
|
|
|
|
# act on all domains keys
|
2017-08-13 20:21:44 +00:00
|
|
|
allow unconfined_domain_type domain:key manage_key_perms;
|
2007-11-14 14:38:45 +00:00
|
|
|
|
|
|
|
# receive from all domains over labeled networking
|
|
|
|
domain_all_recvfrom_all_domains(unconfined_domain_type)
|