Chris PeBenito 488ec7
Chris PeBenito 0f5d13
policy_module(xserver,1.0.1)
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 0f5d13
ifdef(`strict_policy',`
Chris PeBenito 0f5d13
	xserver_common_domain_template(xdm)
Chris PeBenito 0f5d13
	init_system_domain(xdm_xserver_t,xserver_exec_t)
Chris PeBenito 0f5d13
')
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 0f5d13
domain_use_wide_inherit_fd(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 0f5d13
storage_dontaudit_setattr_fixed_disk(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 0f5d13
storage_dontaudit_setattr_removable_device(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 0f5d13
term_use_unallocated_tty(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 0f5d13
init_use_script_pty(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 0f5d13
userdom_dontaudit_use_unpriv_user_fd(xdm_t)
Chris PeBenito 0f5d13
userdom_dontaudit_search_sysadm_home_dir(xdm_t)
Chris PeBenito 0f5d13
# for .dmrc
Chris PeBenito 0f5d13
userdom_read_unpriv_user_home_files(xdm_t)
Chris PeBenito 0f5d13
# Search /proc for any user domain processes.
Chris PeBenito 0f5d13
userdom_read_all_userdomains_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 0f5d13
	files_filetrans_lock(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 0f5d13
	files_filetrans_tmp(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 0f5d13
	fs_filetrans_tmpfs(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 0f5d13
	files_filetrans_var_lib(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 0f5d13
	files_filetrans_pid(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 0f5d13
	logging_filetrans_log(xdm_t,xserver_log_t,file)
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
	domain_subj_id_change_exempt(xdm_t)
Chris PeBenito 0f5d13
	domain_role_change_exempt(xdm_t)
Chris PeBenito 0f5d13
	domain_obj_id_change_exempt(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 0f5d13
	# FIXME:
Chris PeBenito 0f5d13
	# 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 0f5d13
	unconfined_domain_template(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 0f5d13
	mta_dontaudit_getattr_spool(xdm_t)
Chris PeBenito 0f5d13
')
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
optional_policy(`nscd',`
Chris PeBenito 0f5d13
	nscd_use_socket(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 0f5d13
ifdef(`strict_policy',`
Chris PeBenito 0f5d13
	allow xdm_xserver_t xdm_t:process signal;
Chris PeBenito 0f5d13
	allow xdm_xserver_t xdm_t:shm rw_shm_perms;
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
	# NB we do NOT allow xdm_xserver_t xdm_var_lib_t:dir, only access to an open
Chris PeBenito 0f5d13
	# handle of a file inside the dir!!!
Chris PeBenito 0f5d13
	allow xdm_xserver_t xdm_var_lib_t:file { getattr read };
Chris PeBenito 0f5d13
	dontaudit xdm_xserver_t xdm_var_lib_t:dir search;
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
	allow xdm_xserver_t xdm_var_run_t:file { getattr read };
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
	# Label pid and temporary files with derived types.
Chris PeBenito 0f5d13
	allow xdm_xserver_t xdm_tmp_t:dir rw_dir_perms;
Chris PeBenito 0f5d13
	allow xdm_xserver_t xdm_tmp_t:file manage_file_perms;
Chris PeBenito 0f5d13
	allow xdm_xserver_t xdm_tmp_t:lnk_file create_lnk_perms;
Chris PeBenito 0f5d13
	allow xdm_xserver_t xdm_tmp_t:sock_file manage_file_perms;
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
	# Run xkbcomp.
Chris PeBenito 0f5d13
	allow xdm_xserver_t xkb_var_lib_t:lnk_file read;
Chris PeBenito 0f5d13
	can_exec(xdm_xserver_t, xkb_var_lib_t)
Chris PeBenito 0f5d13
	files_search_var_lib(xdm_xserver_t)
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
	# VNC v4 module in X server
Chris PeBenito 0f5d13
	corenet_tcp_bind_vnc_port(xdm_xserver_t)
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
	fs_search_auto_mountpoints(xdm_xserver_t)
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
	init_use_fd(xdm_xserver_t)
Chris PeBenito 0f5d13
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 0f5d13
	userdom_read_unpriv_user_home_files(xdm_xserver_t)
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
	tunable_policy(`use_nfs_home_dirs',`
Chris PeBenito 0f5d13
		fs_manage_nfs_dirs(xdm_xserver_t)
Chris PeBenito 0f5d13
		fs_manage_nfs_files(xdm_xserver_t)
Chris PeBenito 0f5d13
		fs_manage_nfs_symlinks(xdm_xserver_t)
Chris PeBenito 0f5d13
	')
Chris PeBenito 0f5d13
Chris PeBenito 0f5d13
	tunable_policy(`use_samba_home_dirs',`
Chris PeBenito 0f5d13
		fs_manage_cifs_dirs(xdm_xserver_t)
Chris PeBenito 0f5d13
		fs_manage_cifs_files(xdm_xserver_t)
Chris PeBenito 0f5d13
		fs_manage_cifs_symlinks(xdm_xserver_t)
Chris PeBenito 0f5d13
	')
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 0f5d13
ifdef(`TODO',`
Chris PeBenito 0f5d13
# cjp: TODO: integrate strict policy:
Chris PeBenito 0f5d13
# init script wants to check if it needs to update windowmanagerlist
Chris PeBenito 0f5d13
allow initrc_t xdm_rw_etc_t:file { getattr read };
Chris PeBenito 0f5d13
ifdef(`distro_suse', `
Chris PeBenito 0f5d13
# set permissions on /tmp/.X11-unix
Chris PeBenito 0f5d13
allow initrc_t xdm_tmp_t:dir setattr;
Chris PeBenito 0f5d13
')
Chris PeBenito 0f5d13
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