Chris PeBenito 488ec7
Chris PeBenito 0f27d9
policy_module(xserver,1.0.4)
Chris PeBenito 488ec7
Chris PeBenito 488ec7
########################################
Chris PeBenito 488ec7
#
Chris PeBenito 488ec7
# Declarations
Chris PeBenito 488ec7
#
Chris PeBenito 488ec7
Chris PeBenito acd87c
type ice_tmp_t;
Chris PeBenito acd87c
files_tmp_file(ice_tmp_t)
Chris PeBenito acd87c
Chris PeBenito acd87c
type iceauth_exec_t;
Chris PeBenito acd87c
files_type(iceauth_exec_t)
Chris PeBenito acd87c
Chris PeBenito acd87c
type xauth_exec_t;
Chris PeBenito acd87c
files_type(xauth_exec_t)
Chris PeBenito acd87c
Chris PeBenito 0f5d13
type xdm_t;
Chris PeBenito 0f5d13
# real declaration moved to mls until
Chris PeBenito 0f5d13
# range_transition works in loadable modules
Chris PeBenito 0f5d13
gen_require(`
Chris PeBenito 0f5d13
	type xdm_exec_t;
Chris PeBenito 0f5d13
')
Chris PeBenito 0f5d13
init_domain(xdm_t,xdm_exec_t)
Chris PeBenito 0f5d13
init_daemon_domain(xdm_t,xdm_exec_t)
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
type xdm_lock_t;
Chris PeBenito 0f5d13
files_lock_file(xdm_lock_t)
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
type xdm_rw_etc_t;
Chris PeBenito 0f5d13
files_type(xdm_rw_etc_t)
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
type xdm_var_lib_t;
Chris PeBenito 0f5d13
files_type(xdm_var_lib_t)
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
type xdm_var_run_t;
Chris PeBenito 0f5d13
files_pid_file(xdm_var_run_t)
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
type xdm_tmp_t;
Chris PeBenito 0f5d13
files_tmp_file(xdm_tmp_t)
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
type xdm_tmpfs_t;
Chris PeBenito 0f5d13
files_tmpfs_file(xdm_tmpfs_t)
Chris PeBenito 0f5d13
Chris PeBenito 488ec7
# type for /var/lib/xkb
Chris PeBenito 488ec7
type xkb_var_lib_t;
Chris PeBenito 488ec7
files_config_file(xkb_var_lib_t)
Chris PeBenito 488ec7
Chris PeBenito 488ec7
# Type for the executable used to start the X server, e.g. Xwrapper.
Chris PeBenito 488ec7
type xserver_exec_t;
Chris PeBenito 488ec7
files_type(xserver_exec_t)
Chris PeBenito 488ec7
Chris PeBenito 0f5d13
type xsession_exec_t;
Chris PeBenito 0f5d13
files_type(xsession_exec_t)
Chris PeBenito 0f5d13
Chris PeBenito 488ec7
# Type for the X server log file.
Chris PeBenito 488ec7
type xserver_log_t;
Chris PeBenito 488ec7
logging_log_file(xserver_log_t)
Chris PeBenito 07620c
Chris PeBenito 955019
xserver_common_domain_template(xdm)
Chris PeBenito 955019
init_system_domain(xdm_xserver_t,xserver_exec_t)
Chris PeBenito 0f5d13
Chris PeBenito 07620c
optional_policy(`prelink',`
Chris PeBenito 07620c
	prelink_object_file(xkb_var_lib_t)
Chris PeBenito 07620c
')
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
########################################
Chris PeBenito 0f5d13
#
Chris PeBenito 0f5d13
# XDM Local policy
Chris PeBenito 0f5d13
#
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
allow xdm_t self:capability { setgid setuid sys_resource kill sys_tty_config mknod chown dac_override dac_read_search fowner fsetid ipc_owner sys_nice sys_rawio net_bind_service };
Chris PeBenito 0f5d13
allow xdm_t self:process { setexec setpgid setsched setrlimit signal_perms };
Chris PeBenito 0f5d13
allow xdm_t self:fifo_file rw_file_perms;
Chris PeBenito 0f5d13
allow xdm_t self:shm create_shm_perms;
Chris PeBenito 0f5d13
allow xdm_t self:sem create_sem_perms;
Chris PeBenito 0f5d13
allow xdm_t self:unix_stream_socket { connectto create_stream_socket_perms };
Chris PeBenito 0f5d13
allow xdm_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 0f5d13
allow xdm_t self:tcp_socket create_stream_socket_perms;
Chris PeBenito 0f5d13
allow xdm_t self:udp_socket create_socket_perms;
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
# Supress permission check on .ICE-unix
Chris PeBenito 0f5d13
dontaudit xdm_t ice_tmp_t:dir { getattr setattr };
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
# Allow gdm to run gdm-binary
Chris PeBenito 0f5d13
can_exec(xdm_t, xdm_exec_t)
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
# wdm has its own config dir /etc/X11/wdm
Chris PeBenito 0f5d13
# this is ugly, daemons should not create files under /etc!
Chris PeBenito 0f5d13
allow xdm_t xdm_rw_etc_t:dir rw_dir_perms;
Chris PeBenito 0f5d13
allow xdm_t xdm_rw_etc_t:file create_file_perms;
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
kernel_read_system_state(xdm_t)
Chris PeBenito 445522
kernel_read_kernel_sysctls(xdm_t)
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
corecmd_exec_shell(xdm_t)
Chris PeBenito 0f5d13
corecmd_exec_bin(xdm_t)
Chris PeBenito 0f5d13
corecmd_exec_sbin(xdm_t)
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
corenet_tcp_sendrecv_generic_if(xdm_t)
Chris PeBenito 0f5d13
corenet_udp_sendrecv_generic_if(xdm_t)
Chris PeBenito 0f5d13
corenet_raw_sendrecv_generic_if(xdm_t)
Chris PeBenito 0f5d13
corenet_tcp_sendrecv_all_nodes(xdm_t)
Chris PeBenito 0f5d13
corenet_udp_sendrecv_all_nodes(xdm_t)
Chris PeBenito 0f5d13
corenet_raw_sendrecv_all_nodes(xdm_t)
Chris PeBenito 0f5d13
corenet_tcp_sendrecv_all_ports(xdm_t)
Chris PeBenito 0f5d13
corenet_udp_sendrecv_all_ports(xdm_t)
Chris PeBenito 0f5d13
corenet_non_ipsec_sendrecv(xdm_t)
Chris PeBenito 0f5d13
corenet_tcp_bind_all_nodes(xdm_t)
Chris PeBenito 0f5d13
corenet_udp_bind_all_nodes(xdm_t)
Chris PeBenito 0f5d13
corenet_tcp_connect_all_ports(xdm_t)
Chris PeBenito 0f5d13
# xdm tries to bind to biff_port_t
Chris PeBenito 0f5d13
corenet_dontaudit_tcp_bind_all_ports(xdm_t)
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
dev_read_rand(xdm_t)
Chris PeBenito 0f5d13
dev_read_urand(xdm_t)
Chris PeBenito 0f5d13
dev_read_sysfs(xdm_t)
Chris PeBenito 207c47
dev_getattr_framebuffer_dev(xdm_t)
Chris PeBenito 207c47
dev_setattr_framebuffer_dev(xdm_t)
Chris PeBenito 207c47
dev_getattr_mouse_dev(xdm_t)
Chris PeBenito 207c47
dev_setattr_mouse_dev(xdm_t)
Chris PeBenito 0f5d13
dev_rw_apm_bios(xdm_t)
Chris PeBenito 207c47
dev_setattr_apm_bios_dev(xdm_t)
Chris PeBenito 207c47
dev_rw_dri(xdm_t)
Chris PeBenito 207c47
dev_rw_agp(xdm_t)
Chris PeBenito 0f5d13
dev_getattr_xserver_misc_dev(xdm_t)
Chris PeBenito 0f5d13
dev_setattr_xserver_misc_dev(xdm_t)
Chris PeBenito 207c47
dev_getattr_misc_dev(xdm_t)
Chris PeBenito 207c47
dev_setattr_misc_dev(xdm_t)
Chris PeBenito 0f5d13
dev_dontaudit_rw_misc(xdm_t)
Chris PeBenito 0f5d13
dev_getattr_video_dev(xdm_t)
Chris PeBenito 0f5d13
dev_setattr_video_dev(xdm_t)
Chris PeBenito 207c47
dev_getattr_scanner_dev(xdm_t)
Chris PeBenito 207c47
dev_setattr_scanner_dev(xdm_t)
Chris PeBenito 207c47
dev_getattr_sound_dev(xdm_t)
Chris PeBenito 207c47
dev_setattr_sound_dev(xdm_t)
Chris PeBenito 207c47
dev_getattr_power_mgmt_dev(xdm_t)
Chris PeBenito 207c47
dev_setattr_power_mgmt_dev(xdm_t)
Chris PeBenito 0f5d13
Chris PeBenito 15722e
domain_use_interactive_fds(xdm_t)
Chris PeBenito 0f5d13
# Do not audit denied probes of /proc.
Chris PeBenito 0f5d13
domain_dontaudit_read_all_domains_state(xdm_t)
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
files_read_etc_files(xdm_t)
Chris PeBenito 0f5d13
files_read_etc_runtime_files(xdm_t)
Chris PeBenito 0f5d13
files_exec_etc_files(xdm_t)
Chris PeBenito 0f5d13
files_list_mnt(xdm_t)
Chris PeBenito 0f5d13
# Read /usr/share/terminfo/l/linux and /usr/share/icons/default/index.theme...
Chris PeBenito 0f5d13
files_read_usr_files(xdm_t)
Chris PeBenito 0f5d13
# Poweroff wants to create the /poweroff file when run from xdm
Chris PeBenito 0f5d13
files_create_boot_flag(xdm_t)
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
fs_getattr_all_fs(xdm_t)
Chris PeBenito 0f5d13
fs_search_auto_mountpoints(xdm_t)
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
selinux_get_fs_mount(xdm_t)
Chris PeBenito 0f5d13
selinux_validate_context(xdm_t)
Chris PeBenito 0f5d13
selinux_compute_access_vector(xdm_t)
Chris PeBenito 0f5d13
selinux_compute_create_context(xdm_t)
Chris PeBenito 0f5d13
selinux_compute_relabel_context(xdm_t)
Chris PeBenito 0f5d13
selinux_compute_user_contexts(xdm_t)
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
storage_dontaudit_read_fixed_disk(xdm_t)
Chris PeBenito 0f5d13
storage_dontaudit_write_fixed_disk(xdm_t)
Chris PeBenito 1815ba
storage_dontaudit_setattr_fixed_disk_dev(xdm_t)
Chris PeBenito 0f5d13
storage_dontaudit_raw_read_removable_device(xdm_t)
Chris PeBenito 0f5d13
storage_dontaudit_raw_write_removable_device(xdm_t)
Chris PeBenito 1815ba
storage_dontaudit_setattr_removable_dev(xdm_t)
Chris PeBenito 0f5d13
storage_dontaudit_rw_scsi_generic(xdm_t)
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
term_setattr_console(xdm_t)
Chris PeBenito 0f5d13
term_dontaudit_use_console(xdm_t)
Chris PeBenito 1815ba
term_use_unallocated_ttys(xdm_t)
Chris PeBenito 0f5d13
term_setattr_unallocated_ttys(xdm_t)
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
auth_rw_lastlog(xdm_t)
Chris PeBenito 0f5d13
auth_read_login_records(xdm_t)
Chris PeBenito 0f5d13
auth_append_login_records(xdm_t)
Chris PeBenito 0f5d13
auth_manage_pam_pid(xdm_t)
Chris PeBenito 0f5d13
auth_exec_pam(xdm_t)
Chris PeBenito 0f5d13
auth_manage_pam_console_data(xdm_t)
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
init_rw_utmp(xdm_t)
Chris PeBenito 1815ba
init_use_script_ptys(xdm_t)
Chris PeBenito 0f5d13
# Run telinit->init to shutdown.
Chris PeBenito 0f5d13
init_exec(xdm_t)
Chris PeBenito 0f5d13
init_write_initctl(xdm_t)
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
libs_use_ld_so(xdm_t)
Chris PeBenito 0f5d13
libs_use_shared_libs(xdm_t)
Chris PeBenito 0f5d13
libs_exec_lib_files(xdm_t)
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
logging_send_syslog_msg(xdm_t)
Chris PeBenito 0f5d13
logging_read_generic_logs(xdm_t)
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
miscfiles_read_localization(xdm_t)
Chris PeBenito 0f5d13
miscfiles_read_fonts(xdm_t)
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
seutil_read_config(xdm_t)
Chris PeBenito 0f5d13
seutil_read_default_contexts(xdm_t)
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
sysnet_read_config(xdm_t)
Chris PeBenito 0f5d13
Chris PeBenito 15722e
userdom_dontaudit_use_unpriv_user_fds(xdm_t)
Chris PeBenito 103fe2
userdom_dontaudit_search_sysadm_home_dirs(xdm_t)
Chris PeBenito 0f5d13
# for .dmrc
Chris PeBenito 103fe2
userdom_read_unpriv_users_home_content_files(xdm_t)
Chris PeBenito 0f5d13
# Search /proc for any user domain processes.
Chris PeBenito 1815ba
userdom_read_all_users_state(xdm_t)
Chris PeBenito 0f5d13
userdom_signal_all_users(xdm_t)
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
ifdef(`enable_polyinstantiation',`
Chris PeBenito 0f5d13
	# xdm_t can polyinstantiate
Chris PeBenito 0f5d13
	files_polyinstantiate_all(xdm_t)
Chris PeBenito 0f5d13
')
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
ifdef(`strict_policy',`
Chris PeBenito 0f5d13
	allow xdm_t xdm_lock_t:file create_file_perms;
Chris PeBenito 103fe2
	files_lock_filetrans(xdm_t,xdm_lock_t)
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
	allow xdm_t xdm_tmp_t:dir create_dir_perms;
Chris PeBenito 0f5d13
	allow xdm_t xdm_tmp_t:file create_file_perms;
Chris PeBenito 0f5d13
	allow xdm_t xdm_tmp_t:file create_file_perms;
Chris PeBenito 103fe2
	files_tmp_filetrans(xdm_t, xdm_tmp_t, { file dir sock_file })
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
	allow xdm_t xdm_tmpfs_t:dir { read getattr lock search ioctl add_name remove_name write };
Chris PeBenito 0f5d13
	allow xdm_t xdm_tmpfs_t:file { create ioctl read getattr lock write setattr append link unlink rename };
Chris PeBenito 0f5d13
	allow xdm_t xdm_tmpfs_t:lnk_file { create read getattr setattr link unlink rename };
Chris PeBenito 0f5d13
	allow xdm_t xdm_tmpfs_t:sock_file { create ioctl read getattr lock write setattr append link unlink rename };
Chris PeBenito 0f5d13
	allow xdm_t xdm_tmpfs_t:fifo_file { create ioctl read getattr lock write setattr append link unlink rename };
Chris PeBenito 103fe2
	fs_tmpfs_filetrans(xdm_t,xdm_tmpfs_t,{ dir file lnk_file sock_file fifo_file })
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
	allow xdm_t xdm_var_lib_t:file create_file_perms;
Chris PeBenito 0f5d13
	allow xdm_t xdm_var_lib_t:dir create_dir_perms;
Chris PeBenito 103fe2
	files_var_lib_filetrans(xdm_t,xdm_var_lib_t)
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
	allow xdm_t xdm_var_run_t:dir manage_dir_perms;
Chris PeBenito 0f5d13
	allow xdm_t xdm_var_run_t:fifo_file manage_file_perms;
Chris PeBenito 103fe2
	files_pid_filetrans(xdm_t,xdm_var_run_t,{ dir fifo_file })
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
	allow xdm_t xdm_xserver_t:process signal;
Chris PeBenito 0f5d13
	allow xdm_t xdm_xserver_t:unix_stream_socket connectto;
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
	allow xdm_t xdm_xserver_tmp_t:sock_file rw_file_perms;
Chris PeBenito 0f5d13
	allow xdm_t xdm_xserver_tmp_t:dir { setattr r_dir_perms };
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
	# transition to the xdm xserver
Chris PeBenito 0f5d13
	domain_auto_trans(xdm_t, xserver_exec_t, xdm_xserver_t)
Chris PeBenito 0f5d13
	allow xdm_t xdm_xserver_t:fd use;
Chris PeBenito 0f5d13
	allow xdm_xserver_t xdm_t:fd use;
Chris PeBenito 0f5d13
	allow xdm_xserver_t xdm_t:fifo_file rw_file_perms;
Chris PeBenito 0f5d13
	allow xdm_xserver_t xdm_t:process { signal sigchld };
Chris PeBenito 0f5d13
	allow xdm_t xdm_xserver_t:process { noatsecure siginh rlimitinh signal sigkill };
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
	allow xdm_t xdm_xserver_t:shm rw_shm_perms;
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
	# connect to xdm xserver over stream socket
Chris PeBenito 0f5d13
	allow xdm_t xdm_xserver_tmp_t:dir r_dir_perms;
Chris PeBenito 0f5d13
	allow xdm_t xdm_xserver_tmp_t:sock_file rw_file_perms;
Chris PeBenito 0f5d13
	allow xdm_t xdm_xserver_t:unix_stream_socket connectto;
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
	# Remove /tmp/.X11-unix/X0.
Chris PeBenito 0f5d13
	allow xdm_t xdm_xserver_tmp_t:dir { remove_name write };
Chris PeBenito 0f5d13
	allow xdm_t xdm_xserver_tmp_t:sock_file unlink;
Chris PeBenito 0f5d13
	allow xdm_t xdm_xserver_tmp_t:file unlink;
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
	allow xdm_t xserver_log_t:dir { rw_dir_perms setattr };
Chris PeBenito 0f5d13
	allow xdm_t xserver_log_t:file manage_file_perms;
Chris PeBenito 0f5d13
	allow xdm_t xserver_log_t:fifo_file manage_file_perms;
Chris PeBenito 103fe2
	logging_log_filetrans(xdm_t,xserver_log_t,file)
Chris PeBenito 0f5d13
Chris PeBenito 1815ba
	domain_subj_id_change_exemption(xdm_t)
Chris PeBenito 1815ba
	domain_role_change_exemption(xdm_t)
Chris PeBenito 1815ba
	domain_obj_id_change_exemption(xdm_t)
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
	auth_domtrans_chk_passwd(xdm_t)
Chris PeBenito 0f5d13
	auth_domtrans_pam_console(xdm_t)	
Chris PeBenito 0f5d13
Chris PeBenito 24a637
	xserver_rw_session_template(xdm,xdm_t,xdm_tmpfs_t)
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
	tunable_policy(`xdm_sysadm_login',`
Chris PeBenito 0f5d13
		userdom_xsession_spec_domtrans_all_users(xdm_t)
Chris PeBenito 0f5d13
		# FIXME:
Chris PeBenito 0f5d13
#		xserver_rw_session_template(xdm,userdomain)
Chris PeBenito 0f5d13
	',`
Chris PeBenito 0f5d13
		userdom_xsession_spec_domtrans_unpriv_users(xdm_t)
Chris PeBenito 0f5d13
		# FIXME:
Chris PeBenito 0f5d13
#		xserver_rw_session_template(xdm,unpriv_userdomain)
Chris PeBenito 0f5d13
#		dontaudit xdm_xserver_t sysadm_t:shm { unix_read unix_write };
Chris PeBenito 0f5d13
#		allow xdm_xserver_t xdm_tmpfs_t:file rw_file_perms;
Chris PeBenito 0f5d13
	')
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
	optional_policy(`alsa',`
Chris PeBenito 0f5d13
		alsa_domtrans(xdm_t)
Chris PeBenito 0f5d13
	')
Chris PeBenito 0f5d13
')
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
ifdef(`targeted_policy',`
Chris PeBenito 0f5d13
	allow xdm_t self:process { execheap execmem };
Chris PeBenito 955019
	unconfined_domain(xdm_t)
Chris PeBenito 0f5d13
	unconfined_domtrans(xdm_t)
Chris PeBenito 0f5d13
')
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
tunable_policy(`use_nfs_home_dirs',`
Chris PeBenito 0f5d13
	fs_manage_nfs_dirs(xdm_t)
Chris PeBenito 0f5d13
	fs_manage_nfs_files(xdm_t)
Chris PeBenito 0f5d13
	fs_manage_nfs_symlinks(xdm_t)
Chris PeBenito 4d851f
	fs_exec_nfs_files(xdm_t)
Chris PeBenito 0f5d13
')
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
tunable_policy(`use_samba_home_dirs',`
Chris PeBenito 0f5d13
	fs_manage_cifs_dirs(xdm_t)
Chris PeBenito 0f5d13
	fs_manage_cifs_files(xdm_t)
Chris PeBenito 0f5d13
	fs_manage_cifs_symlinks(xdm_t)
Chris PeBenito 4d851f
	fs_exec_cifs_files(xdm_t)
Chris PeBenito 0f5d13
')
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
optional_policy(`gpm',`
Chris PeBenito 0f5d13
	# Talk to the console mouse server.
Chris PeBenito 0f5d13
	gpm_stream_connect(xdm_t)
Chris PeBenito 0f5d13
	gpm_setattr_gpmctl(xdm_t)
Chris PeBenito 0f5d13
')
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
optional_policy(`hostname',`
Chris PeBenito 0f5d13
	hostname_exec(xdm_t)
Chris PeBenito 0f5d13
')
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
optional_policy(`loadkeys',`
Chris PeBenito 0f5d13
	loadkeys_exec(xdm_t)
Chris PeBenito 0f5d13
')
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
optional_policy(`locallogin',`
Chris PeBenito 0f5d13
	locallogin_signull(xdm_t)
Chris PeBenito 0f5d13
')
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
optional_policy(`mta',`
Chris PeBenito 0f5d13
	# Do not audit attempts to check whether user root has email
Chris PeBenito 1815ba
	mta_dontaudit_getattr_spool_files(xdm_t)
Chris PeBenito 0f5d13
')
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
optional_policy(`nscd',`
Chris PeBenito 1815ba
	nscd_socket_use(xdm_t)
Chris PeBenito 0f5d13
')
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
optional_policy(`selinuxutil',`
Chris PeBenito 0f5d13
	seutil_sigchld_newrole(xdm_t)
Chris PeBenito 0f5d13
')
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
optional_policy(`udev',`
Chris PeBenito 0f5d13
	udev_read_db(xdm_t)
Chris PeBenito 0f5d13
')
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
optional_policy(`userhelper',`
Chris PeBenito 0f5d13
	userhelper_dontaudit_search_config(xdm_t)
Chris PeBenito 0f5d13
')
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
optional_policy(`usermanage',`
Chris PeBenito 0f5d13
	usermanage_read_crack_db(xdm_t)
Chris PeBenito 0f5d13
')
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
optional_policy(`xfs',`
Chris PeBenito 0f5d13
	xfs_stream_connect(xdm_t)
Chris PeBenito 0f5d13
')
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
########################################
Chris PeBenito 0f5d13
#
Chris PeBenito 0f5d13
# XDM Xserver local policy
Chris PeBenito 0f5d13
#
Chris PeBenito 0f5d13
Chris PeBenito 5a975c
allow xdm_xserver_t xdm_t:process signal;
Chris PeBenito 5a975c
allow xdm_xserver_t xdm_t:shm rw_shm_perms;
Chris PeBenito 5a975c
Chris PeBenito 5a975c
# NB we do NOT allow xdm_xserver_t xdm_var_lib_t:dir, only access to an open
Chris PeBenito 5a975c
# handle of a file inside the dir!!!
Chris PeBenito 5a975c
allow xdm_xserver_t xdm_var_lib_t:file { getattr read };
Chris PeBenito 5a975c
dontaudit xdm_xserver_t xdm_var_lib_t:dir search;
Chris PeBenito 0f5d13
Chris PeBenito 5a975c
allow xdm_xserver_t xdm_var_run_t:file { getattr read };
Chris PeBenito 0f5d13
Chris PeBenito 5a975c
# Label pid and temporary files with derived types.
Chris PeBenito 5a975c
allow xdm_xserver_t xdm_tmp_t:dir rw_dir_perms;
Chris PeBenito 5a975c
allow xdm_xserver_t xdm_tmp_t:file manage_file_perms;
Chris PeBenito 5a975c
allow xdm_xserver_t xdm_tmp_t:lnk_file create_lnk_perms;
Chris PeBenito 5a975c
allow xdm_xserver_t xdm_tmp_t:sock_file manage_file_perms;
Chris PeBenito 0f5d13
Chris PeBenito 5a975c
# Run xkbcomp.
Chris PeBenito 5a975c
allow xdm_xserver_t xkb_var_lib_t:lnk_file read;
Chris PeBenito 5a975c
can_exec(xdm_xserver_t, xkb_var_lib_t)
Chris PeBenito 5a975c
files_search_var_lib(xdm_xserver_t)
Chris PeBenito 0f5d13
Chris PeBenito 5a975c
# VNC v4 module in X server
Chris PeBenito 5a975c
corenet_tcp_bind_vnc_port(xdm_xserver_t)
Chris PeBenito 0f5d13
Chris PeBenito 5a975c
fs_search_auto_mountpoints(xdm_xserver_t)
Chris PeBenito 0f5d13
Chris PeBenito 5a975c
init_use_fd(xdm_xserver_t)
Chris PeBenito 0f5d13
Chris PeBenito 5a975c
tunable_policy(`use_nfs_home_dirs',`
Chris PeBenito 5a975c
	fs_manage_nfs_dirs(xdm_xserver_t)
Chris PeBenito 5a975c
	fs_manage_nfs_files(xdm_xserver_t)
Chris PeBenito 5a975c
	fs_manage_nfs_symlinks(xdm_xserver_t)
Chris PeBenito 5a975c
')
Chris PeBenito 5a975c
Chris PeBenito 5a975c
tunable_policy(`use_samba_home_dirs',`
Chris PeBenito 5a975c
	fs_manage_cifs_dirs(xdm_xserver_t)
Chris PeBenito 5a975c
	fs_manage_cifs_files(xdm_xserver_t)
Chris PeBenito 5a975c
	fs_manage_cifs_symlinks(xdm_xserver_t)
Chris PeBenito 5a975c
')
Chris PeBenito 0f5d13
Chris PeBenito 5a975c
ifdef(`strict_policy',`
Chris PeBenito 0f5d13
	# FIXME: After per user fonts are properly working
Chris PeBenito 0f5d13
	# xdm_xserver_t may no longer have any reason
Chris PeBenito 0f5d13
	# to read ROLE_home_t - examine this in more detail
Chris PeBenito 0f5d13
	# (xauth?)
Chris PeBenito 103fe2
	userdom_read_unpriv_users_home_content_files(xdm_xserver_t)
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
	ifdef(`TODO',`
Chris PeBenito 0f5d13
	# Read all global and per user fonts
Chris PeBenito 0f5d13
	read_fonts(xdm_xserver_t, sysadm)
Chris PeBenito 0f5d13
	read_fonts(xdm_xserver_t, staff)
Chris PeBenito 0f5d13
	read_fonts(xdm_xserver_t, user)
Chris PeBenito 0f5d13
	') dnl end TODO
Chris PeBenito 0f5d13
')
Chris PeBenito 0f5d13
Chris PeBenito 955019
ifdef(`targeted_policy',`
Chris PeBenito 955019
	allow xdm_xserver_t self:process { execheap execmem };
Chris PeBenito 955019
Chris PeBenito 0f27d9
	unconfined_domain_noaudit(xdm_xserver_t)
Chris PeBenito 955019
	unconfined_domtrans(xdm_xserver_t)
Chris PeBenito 955019
')
Chris PeBenito 955019
Chris PeBenito 0f5d13
ifdef(`TODO',`
Chris PeBenito 0f5d13
allow xdm_t xconsole_device_t:fifo_file { getattr setattr };
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
can_resmgrd_connect(xdm_t)
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
# Need to further investigate these permissions and
Chris PeBenito 0f5d13
# perhaps define derived types.
Chris PeBenito 0f5d13
allow xdm_t var_lib_t:dir { write search add_name remove_name  create unlink };
Chris PeBenito 0f5d13
allow xdm_t var_lib_t:file { create write unlink };
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
# Do not audit attempts to write to index files under /usr
Chris PeBenito 0f5d13
dontaudit xdm_t usr_t:file write;
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
ifdef(`rhgb.te', `
Chris PeBenito 0f5d13
allow xdm_xserver_t ramfs_t:dir rw_dir_perms;
Chris PeBenito 0f5d13
allow xdm_xserver_t ramfs_t:file create_file_perms;
Chris PeBenito 0f5d13
allow rhgb_t xdm_xserver_t:process signal;
Chris PeBenito 0f5d13
')
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
ifdef(`enable_polyinstantiation',`
Chris PeBenito 0f5d13
# xdm needs access for linking .X11-unix to poly /tmp
Chris PeBenito 0f5d13
allow xdm_t polymember:dir { add_name remove_name write };
Chris PeBenito 0f5d13
allow xdm_t polymember:lnk_file { create unlink };
Chris PeBenito 0f5d13
# xdm needs access for copying .Xauthority into new home
Chris PeBenito 0f5d13
allow xdm_t polymember:file { create getattr write };
Chris PeBenito 0f5d13
')
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
#
Chris PeBenito 0f5d13
# Wants to delete .xsession-errors file
Chris PeBenito 0f5d13
#
Chris PeBenito 0f5d13
allow xdm_t user_home_type:file unlink;
Chris PeBenito 0f5d13
#
Chris PeBenito 0f5d13
# Should fix exec of pam_timestamp_check is not closing xdm file descriptor
Chris PeBenito 0f5d13
#
Chris PeBenito 0f5d13
allow pam_t xdm_t:fifo_file { getattr ioctl write };
Chris PeBenito 0f5d13
') dnl end TODO