Chris PeBenito 23a444
Chris PeBenito acd87c
policy_module(xdm,1.1.3)
Chris PeBenito 23a444
Chris PeBenito 23a444
########################################
Chris PeBenito 23a444
#
Chris PeBenito 23a444
# Declarations
Chris PeBenito 23a444
#
Chris PeBenito 23a444
Chris PeBenito 049e11
type xdm_t;
Chris PeBenito 23a444
Chris PeBenito 23a444
# real declaration moved to mls until
Chris PeBenito 23a444
# range_transition works in loadable modules
Chris PeBenito 23a444
gen_require(`
Chris PeBenito 23a444
	type xdm_exec_t;
Chris PeBenito 23a444
')
Chris PeBenito 23a444
init_domain(xdm_t,xdm_exec_t)
Chris PeBenito 23a444
init_daemon_domain(xdm_t,xdm_exec_t)
Chris PeBenito 23a444
Chris PeBenito 23a444
type xsession_exec_t;
Chris PeBenito 23a444
files_type(xsession_exec_t)
Chris PeBenito 23a444
Chris PeBenito 23a444
type xdm_xserver_tmp_t;
Chris PeBenito 23a444
files_type(xdm_xserver_tmp_t)
Chris PeBenito 23a444
Chris PeBenito 23a444
type xdm_lock_t;
Chris PeBenito 23a444
files_lock_file(xdm_lock_t)
Chris PeBenito 23a444
Chris PeBenito 23a444
type xdm_rw_etc_t;
Chris PeBenito 23a444
files_type(xdm_rw_etc_t)
Chris PeBenito 23a444
Chris PeBenito 23a444
type xdm_var_lib_t;
Chris PeBenito 23a444
files_type(xdm_var_lib_t)
Chris PeBenito 23a444
Chris PeBenito 07620c
type xdm_var_run_t;
Chris PeBenito 07620c
files_type(xdm_var_run_t)
Chris PeBenito 07620c
Chris PeBenito 23a444
type xdm_tmp_t;
Chris PeBenito 23a444
files_tmp_file(xdm_tmp_t)
Chris PeBenito 23a444
Chris PeBenito 23a444
type xdm_tmpfs_t;
Chris PeBenito 23a444
files_tmpfs_file(xdm_tmpfs_t)
Chris PeBenito 23a444
Chris PeBenito 23a444
########################################
Chris PeBenito 23a444
#
Chris PeBenito 23a444
# Local policy
Chris PeBenito 23a444
#
Chris PeBenito 23a444
Chris PeBenito f3936d
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 07620c
allow xdm_t self:process { setexec setpgid setsched setrlimit signal_perms };
Chris PeBenito f3936d
allow xdm_t self:fifo_file rw_file_perms;
Chris PeBenito f3936d
allow xdm_t self:shm create_shm_perms;
Chris PeBenito 07620c
allow xdm_t self:sem create_sem_perms;
Chris PeBenito f3936d
allow xdm_t self:unix_stream_socket { connectto create_stream_socket_perms };
Chris PeBenito f3936d
allow xdm_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 07620c
allow xdm_t self:tcp_socket create_stream_socket_perms;
Chris PeBenito 07620c
allow xdm_t self:udp_socket create_socket_perms;
Chris PeBenito 07620c
Chris PeBenito 07620c
# Allow gdm to run gdm-binary
Chris PeBenito 07620c
can_exec(xdm_t, xdm_exec_t)
Chris PeBenito cac3ec
Chris PeBenito dace0b
# wdm has its own config dir /etc/X11/wdm
Chris PeBenito dace0b
# this is ugly, daemons should not create files under /etc!
Chris PeBenito dace0b
allow xdm_t xdm_rw_etc_t:dir rw_dir_perms;
Chris PeBenito dace0b
allow xdm_t xdm_rw_etc_t:file create_file_perms;
Chris PeBenito dace0b
Chris PeBenito dace0b
allow xdm_t xdm_var_run_t:dir setattr;
Chris PeBenito dace0b
# for xdmctl
Chris PeBenito dace0b
allow xdm_t xdm_var_run_t:fifo_file create_file_perms;
Chris PeBenito dace0b
Chris PeBenito f3936d
kernel_read_system_state(xdm_t)
Chris PeBenito f3936d
kernel_read_kernel_sysctl(xdm_t)
Chris PeBenito f3936d
Chris PeBenito dace0b
corecmd_exec_shell(xdm_t)
Chris PeBenito dace0b
corecmd_exec_bin(xdm_t)
Chris PeBenito dace0b
corecmd_exec_sbin(xdm_t)
Chris PeBenito dace0b
Chris PeBenito 07620c
corenet_tcp_sendrecv_generic_if(xdm_t)
Chris PeBenito 07620c
corenet_udp_sendrecv_generic_if(xdm_t)
Chris PeBenito 07620c
corenet_raw_sendrecv_generic_if(xdm_t)
Chris PeBenito 07620c
corenet_tcp_sendrecv_all_nodes(xdm_t)
Chris PeBenito 07620c
corenet_udp_sendrecv_all_nodes(xdm_t)
Chris PeBenito 07620c
corenet_raw_sendrecv_all_nodes(xdm_t)
Chris PeBenito 07620c
corenet_tcp_sendrecv_all_ports(xdm_t)
Chris PeBenito 07620c
corenet_udp_sendrecv_all_ports(xdm_t)
Chris PeBenito 07620c
corenet_non_ipsec_sendrecv(xdm_t)
Chris PeBenito 07620c
corenet_tcp_bind_all_nodes(xdm_t)
Chris PeBenito 07620c
corenet_udp_bind_all_nodes(xdm_t)
Chris PeBenito dace0b
corenet_tcp_connect_all_ports(xdm_t)
Chris PeBenito 07620c
# xdm tries to bind to biff_port_t
Chris PeBenito 07620c
corenet_dontaudit_tcp_bind_all_ports(xdm_t)
Chris PeBenito dace0b
Chris PeBenito f3936d
dev_read_rand(xdm_t)
Chris PeBenito f3936d
dev_read_urand(xdm_t)
Chris PeBenito 07620c
dev_read_sysfs(xdm_t)
Chris PeBenito 07620c
dev_getattr_framebuffer(xdm_t)
Chris PeBenito 07620c
dev_setattr_framebuffer(xdm_t)
Chris PeBenito 07620c
dev_getattr_mouse(xdm_t)
Chris PeBenito 07620c
dev_setattr_mouse(xdm_t)
Chris PeBenito 07620c
dev_rw_apm_bios(xdm_t)
Chris PeBenito 07620c
dev_setattr_apm_bios(xdm_t)
Chris PeBenito 07620c
dev_rw_dri_dev(xdm_t)
Chris PeBenito 07620c
dev_rw_agp_dev(xdm_t)
Chris PeBenito 07620c
dev_getattr_xserver_misc_dev(xdm_t)
Chris PeBenito 07620c
dev_setattr_xserver_misc_dev(xdm_t)
Chris PeBenito 07620c
dev_getattr_misc(xdm_t)
Chris PeBenito 07620c
dev_setattr_misc(xdm_t)
Chris PeBenito 07620c
dev_dontaudit_rw_misc(xdm_t)
Chris PeBenito 07620c
dev_getattr_video_dev(xdm_t)
Chris PeBenito 07620c
dev_setattr_video_dev(xdm_t)
Chris PeBenito 07620c
dev_getattr_scanner(xdm_t)
Chris PeBenito 07620c
dev_setattr_scanner(xdm_t)
Chris PeBenito 07620c
dev_getattr_snd_dev(xdm_t)
Chris PeBenito 07620c
dev_setattr_snd_dev(xdm_t)
Chris PeBenito 07620c
dev_getattr_power_management(xdm_t)
Chris PeBenito 07620c
dev_setattr_power_management(xdm_t)
Chris PeBenito 07620c
Chris PeBenito 07620c
domain_use_wide_inherit_fd(xdm_t)
Chris PeBenito 07620c
# Do not audit denied probes of /proc.
Chris PeBenito 07620c
domain_dontaudit_read_all_domains_state(xdm_t)
Chris PeBenito f3936d
Chris PeBenito dace0b
files_read_etc_files(xdm_t)
Chris PeBenito dace0b
files_read_etc_runtime_files(xdm_t)
Chris PeBenito acd87c
files_exec_etc_files(xdm_t)
Chris PeBenito 07620c
files_list_mnt(xdm_t)
Chris PeBenito dace0b
# Read /usr/share/terminfo/l/linux and /usr/share/icons/default/index.theme...
Chris PeBenito dace0b
files_read_usr_files(xdm_t)
Chris PeBenito 07620c
# Poweroff wants to create the /poweroff file when run from xdm
Chris PeBenito 07620c
files_create_boot_flag(xdm_t)
Chris PeBenito 07620c
Chris PeBenito 07620c
fs_getattr_all_fs(xdm_t)
Chris PeBenito 07620c
fs_search_auto_mountpoints(xdm_t)
Chris PeBenito dace0b
Chris PeBenito f3936d
selinux_get_fs_mount(xdm_t)
Chris PeBenito f3936d
selinux_validate_context(xdm_t)
Chris PeBenito f3936d
selinux_compute_access_vector(xdm_t)
Chris PeBenito f3936d
selinux_compute_create_context(xdm_t)
Chris PeBenito f3936d
selinux_compute_relabel_context(xdm_t)
Chris PeBenito f3936d
selinux_compute_user_contexts(xdm_t)
Chris PeBenito f3936d
Chris PeBenito 07620c
storage_dontaudit_read_fixed_disk(xdm_t)
Chris PeBenito 07620c
storage_dontaudit_write_fixed_disk(xdm_t)
Chris PeBenito 07620c
storage_dontaudit_setattr_fixed_disk(xdm_t)
Chris PeBenito 07620c
storage_dontaudit_raw_read_removable_device(xdm_t)
Chris PeBenito 07620c
storage_dontaudit_raw_write_removable_device(xdm_t)
Chris PeBenito 07620c
storage_dontaudit_setattr_removable_device(xdm_t)
Chris PeBenito 07620c
storage_dontaudit_rw_scsi_generic(xdm_t)
Chris PeBenito 07620c
Chris PeBenito 07620c
term_setattr_console(xdm_t)
Chris PeBenito 07620c
term_dontaudit_use_console(xdm_t)
Chris PeBenito 07620c
term_use_unallocated_tty(xdm_t)
Chris PeBenito 07620c
term_setattr_unallocated_ttys(xdm_t)
Chris PeBenito 07620c
Chris PeBenito dace0b
auth_rw_lastlog(xdm_t)
Chris PeBenito 07620c
auth_read_login_records(xdm_t)
Chris PeBenito dace0b
auth_append_login_records(xdm_t)
Chris PeBenito 07620c
auth_manage_pam_pid(xdm_t)
Chris PeBenito 07620c
auth_exec_pam(xdm_t)
Chris PeBenito 07620c
auth_manage_pam_console_data(xdm_t)
Chris PeBenito f3936d
Chris PeBenito dace0b
init_rw_utmp(xdm_t)
Chris PeBenito 07620c
init_use_script_pty(xdm_t)
Chris PeBenito 07620c
# Run telinit->init to shutdown.
Chris PeBenito 07620c
init_exec(xdm_t)
Chris PeBenito dace0b
init_write_initctl(xdm_t)
Chris PeBenito dace0b
Chris PeBenito 07620c
libs_use_ld_so(xdm_t)
Chris PeBenito 07620c
libs_use_shared_libs(xdm_t)
Chris PeBenito acd87c
libs_exec_lib_files(xdm_t)
Chris PeBenito dace0b
Chris PeBenito 07620c
logging_send_syslog_msg(xdm_t)
Chris PeBenito 07620c
logging_read_generic_logs(xdm_t)
Chris PeBenito 07620c
Chris PeBenito 07620c
miscfiles_read_localization(xdm_t)
Chris PeBenito 07620c
miscfiles_read_fonts(xdm_t)
Chris PeBenito 07620c
Chris PeBenito dace0b
seutil_read_config(xdm_t)
Chris PeBenito dace0b
seutil_read_default_contexts(xdm_t)
Chris PeBenito dace0b
Chris PeBenito 07620c
sysnet_read_config(xdm_t)
Chris PeBenito 07620c
Chris PeBenito 07620c
userdom_dontaudit_use_unpriv_user_fd(xdm_t)
Chris PeBenito 07620c
userdom_dontaudit_search_sysadm_home_dir(xdm_t)
Chris PeBenito 07620c
# for .dmrc
Chris PeBenito 07620c
userdom_read_unpriv_user_home_files(xdm_t)
Chris PeBenito 07620c
# Search /proc for any user domain processes.
Chris PeBenito 07620c
userdom_read_all_userdomains_state(xdm_t)
Chris PeBenito 07620c
Chris PeBenito dace0b
ifdef(`strict_policy',`
Chris PeBenito cac3ec
	allow xdm_t xdm_lock_t:file create_file_perms;
Chris PeBenito 9d5949
	files_filetrans_lock(xdm_t,xdm_lock_t)
Chris PeBenito cac3ec
Chris PeBenito cac3ec
	allow xdm_t xdm_tmp_t:dir create_dir_perms;
Chris PeBenito cac3ec
	allow xdm_t xdm_tmp_t:file create_file_perms;
Chris PeBenito cac3ec
	allow xdm_t xdm_tmp_t:file create_file_perms;
Chris PeBenito 9d5949
	files_filetrans_tmp(xdm_t, xdm_tmp_t, { file dir sock_file })
Chris PeBenito cac3ec
Chris PeBenito cac3ec
	allow xdm_t xdm_tmpfs_t:dir { read getattr lock search ioctl add_name remove_name write };
Chris PeBenito cac3ec
	allow xdm_t xdm_tmpfs_t:file { create ioctl read getattr lock write setattr append link unlink rename };
Chris PeBenito cac3ec
	allow xdm_t xdm_tmpfs_t:lnk_file { create read getattr setattr link unlink rename };
Chris PeBenito cac3ec
	allow xdm_t xdm_tmpfs_t:sock_file { create ioctl read getattr lock write setattr append link unlink rename };
Chris PeBenito cac3ec
	allow xdm_t xdm_tmpfs_t:fifo_file { create ioctl read getattr lock write setattr append link unlink rename };
Chris PeBenito 9d5949
	fs_filetrans_tmpfs(xdm_t,xdm_tmpfs_t,{ dir file lnk_file sock_file fifo_file })
Chris PeBenito cac3ec
Chris PeBenito cac3ec
	allow xdm_t xdm_var_lib_t:file create_file_perms;
Chris PeBenito cac3ec
	allow xdm_t xdm_var_lib_t:dir create_dir_perms;
Chris PeBenito 9d5949
	files_filetrans_var_lib(xdm_t,xdm_var_lib_t)
Chris PeBenito dace0b
Chris PeBenito dace0b
	allow xdm_t xdm_var_run_t:dir manage_dir_perms;
Chris PeBenito dace0b
	allow xdm_t xdm_var_run_t:fifo_file manage_file_perms;
Chris PeBenito dace0b
	files_filetrans_pid(xdm_t,xdm_var_run_t,{ dir fifo_file })
Chris PeBenito 3b3113
Chris PeBenito 07620c
	domain_subj_id_change_exempt(xdm_t)
Chris PeBenito 07620c
	domain_role_change_exempt(xdm_t)
Chris PeBenito 07620c
	domain_obj_id_change_exempt(xdm_t)
Chris PeBenito 07620c
Chris PeBenito 07620c
	auth_domtrans_chk_passwd(xdm_t)
Chris PeBenito 07620c
	auth_domtrans_pam_console(xdm_t)	
Chris PeBenito 07620c
Chris PeBenito 3b3113
	xserver_dontaudit_read_all_users_iceauth(xdm_t)
Chris PeBenito 07620c
Chris PeBenito 07620c
	optional_policy(`alsa',`
Chris PeBenito 07620c
		alsa_domtrans(xdm_t)
Chris PeBenito 07620c
	')
Chris PeBenito dace0b
')
Chris PeBenito dace0b
Chris PeBenito dace0b
ifdef(`targeted_policy',`
Chris PeBenito dace0b
	allow xdm_t self:process { execheap execmem };
Chris PeBenito dace0b
	unconfined_domain_template(xdm_t)
Chris PeBenito dace0b
	unconfined_domtrans(xdm_t)
Chris PeBenito dace0b
')
Chris PeBenito dace0b
Chris PeBenito 07620c
optional_policy(`gpm',`
Chris PeBenito 07620c
	# Talk to the console mouse server.
Chris PeBenito 07620c
	gpm_stream_connect(xdm_t)
Chris PeBenito 07620c
	gpm_setattr_gpmctl(xdm_t)
Chris PeBenito 07620c
')
Chris PeBenito 07620c
Chris PeBenito dace0b
optional_policy(`hostname',`
Chris PeBenito dace0b
	hostname_exec(xdm_t)
Chris PeBenito dace0b
')
Chris PeBenito dace0b
Chris PeBenito dace0b
optional_policy(`loadkeys',`
Chris PeBenito dace0b
	loadkeys_exec(xdm_t)
Chris PeBenito f3936d
')
Chris PeBenito f3936d
Chris PeBenito 132880
optional_policy(`locallogin',`
Chris PeBenito c6d4c8
	locallogin_signull(xdm_t)
Chris PeBenito c6d4c8
')
Chris PeBenito c6d4c8
Chris PeBenito 07620c
optional_policy(`nscd',`
Chris PeBenito 07620c
	nscd_use_socket(xdm_t)
Chris PeBenito 07620c
')
Chris PeBenito 07620c
Chris PeBenito 07620c
optional_policy(`selinuxutil',`
Chris PeBenito 07620c
	seutil_sigchld_newrole(xdm_t)
Chris PeBenito 07620c
')
Chris PeBenito 07620c
Chris PeBenito 07620c
optional_policy(`udev',`
Chris PeBenito 07620c
	udev_read_db(xdm_t)
Chris PeBenito 07620c
')
Chris PeBenito 07620c
Chris PeBenito 7c2f5a
optional_policy(`userhelper',`
Chris PeBenito 7c2f5a
	userhelper_dontaudit_search_config(xdm_t)
Chris PeBenito 7c2f5a
')
Chris PeBenito 7c2f5a
Chris PeBenito 07620c
optional_policy(`usermanage',`
Chris PeBenito 07620c
	usermanage_read_crack_db(xdm_t)
Chris PeBenito 07620c
')
Chris PeBenito 07620c
Chris PeBenito f3936d
ifdef(`TODO',`
Chris PeBenito f3936d
# cjp: TODO: integrate strict policy:
Chris PeBenito f3936d
allow initrc_t xdm_var_run_t:fifo_file unlink;
Chris PeBenito f3936d
Chris PeBenito f3936d
# NB we do NOT allow xdm_xserver_t xdm_var_lib_t:dir, only access to an open
Chris PeBenito f3936d
# handle of a file inside the dir!!!
Chris PeBenito f3936d
allow xdm_xserver_t xdm_var_lib_t:file { getattr read };
Chris PeBenito f3936d
dontaudit xdm_xserver_t xdm_var_lib_t:dir search;
Chris PeBenito f3936d
allow xdm_xserver_t xdm_var_run_t:file { getattr read };
Chris PeBenito f3936d
Chris PeBenito f3936d
allow xdm_t xdm_xserver_tmp_t:dir r_dir_perms;
Chris PeBenito f3936d
allow xdm_t xdm_xserver_t:process signal;
Chris PeBenito dace0b
allow xdm_t xdm_xserver_t:unix_stream_socket connectto;
Chris PeBenito f3936d
allow xdm_t xdm_xserver_tmp_t:sock_file rw_file_perms;
Chris PeBenito f3936d
allow xdm_t xdm_xserver_tmp_t:dir { setattr r_dir_perms };
Chris PeBenito f3936d
allow xdm_xserver_t xdm_t:process signal;
Chris PeBenito f3936d
Chris PeBenito f3936d
# init script wants to check if it needs to update windowmanagerlist
Chris PeBenito f3936d
allow initrc_t xdm_rw_etc_t:file { getattr read };
Chris PeBenito f3936d
ifdef(`distro_suse', `
Chris PeBenito f3936d
# set permissions on /tmp/.X11-unix
Chris PeBenito f3936d
allow initrc_t xdm_tmp_t:dir setattr;
Chris PeBenito f3936d
')
Chris PeBenito f3936d
Chris PeBenito f3936d
# Transition to user domains for user sessions.
Chris PeBenito f3936d
domain_trans(xdm_t, xsession_exec_t, unpriv_userdomain)
Chris PeBenito f3936d
allow unpriv_userdomain xdm_xserver_t:unix_stream_socket connectto;
Chris PeBenito f3936d
allow unpriv_userdomain xdm_xserver_t:shm r_shm_perms;
Chris PeBenito f3936d
allow unpriv_userdomain xdm_xserver_t:fd use;
Chris PeBenito f3936d
allow unpriv_userdomain xdm_xserver_tmpfs_t:file { getattr read };
Chris PeBenito f3936d
allow xdm_xserver_t unpriv_userdomain:shm rw_shm_perms;
Chris PeBenito f3936d
allow xdm_xserver_t unpriv_userdomain:fd use;
Chris PeBenito f3936d
Chris PeBenito f3936d
# Do not audit user access to the X log files due to file handle inheritance
Chris PeBenito f3936d
dontaudit unpriv_userdomain xserver_log_t:file { write append };
Chris PeBenito f3936d
Chris PeBenito f3936d
# gnome-session creates socket under /tmp/.ICE-unix/
Chris PeBenito f3936d
allow unpriv_userdomain xdm_tmp_t:dir rw_dir_perms;
Chris PeBenito f3936d
allow unpriv_userdomain xdm_tmp_t:sock_file create;
Chris PeBenito f3936d
Chris PeBenito f3936d
# Allow xdm logins as sysadm_r:sysadm_t
Chris PeBenito f3936d
bool xdm_sysadm_login false;
Chris PeBenito f3936d
if (xdm_sysadm_login) {
Chris PeBenito f3936d
domain_trans(xdm_t, xsession_exec_t, sysadm_t)
Chris PeBenito f3936d
allow sysadm_t xdm_xserver_t:unix_stream_socket connectto;
Chris PeBenito f3936d
allow sysadm_t xdm_xserver_t:shm r_shm_perms;
Chris PeBenito f3936d
allow sysadm_t xdm_xserver_t:fd use;
Chris PeBenito f3936d
allow sysadm_t xdm_xserver_tmpfs_t:file { getattr read };
Chris PeBenito f3936d
allow xdm_xserver_t sysadm_t:shm rw_shm_perms;
Chris PeBenito f3936d
allow xdm_xserver_t sysadm_t:fd use;
Chris PeBenito f3936d
}
Chris PeBenito f3936d
Chris PeBenito f3936d
# Label pid and temporary files with derived types.
Chris PeBenito f3936d
rw_dir_create_file(xdm_xserver_t, xdm_tmp_t)
Chris PeBenito f3936d
allow xdm_xserver_t xdm_tmp_t:sock_file create_file_perms;
Chris PeBenito f3936d
Chris PeBenito f3936d
allow xdm_t xconsole_device_t:fifo_file { getattr setattr };
Chris PeBenito 07620c
Chris PeBenito f3936d
allow xdm_t device_t:dir rw_dir_perms;
Chris PeBenito f3936d
can_resmgrd_connect(xdm_t)
Chris PeBenito f3936d
Chris PeBenito f3936d
# Access xdm log files.
Chris PeBenito f3936d
file_type_auto_trans(xdm_t, var_log_t, xserver_log_t, file)
Chris PeBenito f3936d
allow xdm_t xserver_log_t:dir rw_dir_perms;
Chris PeBenito f3936d
allow xdm_t xserver_log_t:dir setattr;
Chris PeBenito f3936d
# Access /var/gdm/.gdmfifo.
Chris PeBenito f3936d
allow xdm_t xserver_log_t:fifo_file create_file_perms;
Chris PeBenito f3936d
Chris PeBenito f3936d
allow { xdm_t unpriv_userdomain } xdm_xserver_t:unix_stream_socket connectto;
Chris PeBenito f3936d
allow { xdm_t unpriv_userdomain } xdm_xserver_t:shm rw_shm_perms;
Chris PeBenito f3936d
allow { xdm_t unpriv_userdomain } xdm_xserver_t:fd use;
Chris PeBenito f3936d
allow { xdm_t unpriv_userdomain } xdm_xserver_tmpfs_t:file { getattr read };
Chris PeBenito f3936d
allow xdm_xserver_t { xdm_t unpriv_userdomain }:shm rw_shm_perms;
Chris PeBenito f3936d
allow xdm_xserver_t { xdm_t unpriv_userdomain }:fd use;
Chris PeBenito f3936d
Chris PeBenito f3936d
# Remove /tmp/.X11-unix/X0.
Chris PeBenito f3936d
allow xdm_t xdm_xserver_tmp_t:dir { remove_name write };
Chris PeBenito f3936d
allow xdm_t xdm_xserver_tmp_t:sock_file unlink;
Chris PeBenito f3936d
Chris PeBenito f3936d
# Need to further investigate these permissions and
Chris PeBenito f3936d
# perhaps define derived types.
Chris PeBenito f3936d
allow xdm_t var_lib_t:dir { write search add_name remove_name  create unlink };
Chris PeBenito f3936d
allow xdm_t var_lib_t:file { create write unlink };
Chris PeBenito f3936d
Chris PeBenito f3936d
# Connect to xfs.
Chris PeBenito f3936d
ifdef(`xfs.te', `
Chris PeBenito f3936d
allow xdm_t xfs_tmp_t:dir search;
Chris PeBenito f3936d
allow xdm_t xfs_tmp_t:sock_file write;
Chris PeBenito f3936d
can_unix_connect(xdm_t, xfs_t)
Chris PeBenito f3936d
')
Chris PeBenito f3936d
Chris PeBenito f3936d
# Signal any user domain.
Chris PeBenito f3936d
allow xdm_t userdomain:process signal_perms;
Chris PeBenito f3936d
Chris PeBenito f3936d
# Do not audit denied attempts to access devices.
Chris PeBenito f3936d
dontaudit xdm_t devpts_t:dir search;
Chris PeBenito f3936d
Chris PeBenito f3936d
# Do not audit attempts to write to index files under /usr
Chris PeBenito f3936d
dontaudit xdm_t usr_t:file write;
Chris PeBenito cac3ec
Chris PeBenito f3936d
# Do not audit user access to the X log files due to file handle inheritance
Chris PeBenito f3936d
dontaudit unpriv_userdomain xserver_log_t:file { write append };
Chris PeBenito f3936d
Chris PeBenito f3936d
# Do not audit attempts to check whether user root has email
Chris PeBenito f3936d
dontaudit xdm_t { var_spool_t mail_spool_t }:dir search;
Chris PeBenito f3936d
dontaudit xdm_t mail_spool_t:file getattr;
Chris PeBenito f3936d
Chris PeBenito f3936d
# Run the X server in a derived domain.
Chris PeBenito f3936d
xserver_domain(xdm)
Chris PeBenito f3936d
Chris PeBenito f3936d
ifdef(`rhgb.te', `
Chris PeBenito f3936d
allow xdm_xserver_t ramfs_t:dir rw_dir_perms;
Chris PeBenito f3936d
allow xdm_xserver_t ramfs_t:file create_file_perms;
Chris PeBenito f3936d
allow rhgb_t xdm_xserver_t:process signal;
Chris PeBenito f3936d
')
Chris PeBenito f3936d
Chris PeBenito f3936d
# Insert video drivers.  
Chris PeBenito f3936d
allow insmod_t xserver_log_t:file write;
Chris PeBenito f3936d
allow insmod_t xdm_xserver_t:unix_stream_socket { read write };
Chris PeBenito f3936d
Chris PeBenito f3936d
# Search /var/run.
Chris PeBenito f3936d
allow xdm_xserver_t var_run_t:dir search;
Chris PeBenito f3936d
Chris PeBenito f3936d
# FIXME: After per user fonts are properly working
Chris PeBenito f3936d
# xdm_xserver_t may no longer have any reason
Chris PeBenito f3936d
# to read ROLE_home_t - examine this in more detail
Chris PeBenito f3936d
# (xauth?)
Chris PeBenito f3936d
Chris PeBenito f3936d
# Search home directories.
Chris PeBenito 07620c
allow xdm_xserver_t home_root_t:dir search;
Chris PeBenito f3936d
allow xdm_xserver_t user_home_type:dir search;
Chris PeBenito f3936d
allow xdm_xserver_t user_home_type:file { getattr read };
Chris PeBenito f3936d
Chris PeBenito f3936d
if (use_nfs_home_dirs) {
Chris PeBenito f3936d
allow { xdm_t xdm_xserver_t } autofs_t:dir { search getattr };
Chris PeBenito f3936d
allow { xdm_t xdm_xserver_t } nfs_t:dir create_dir_perms;
Chris PeBenito f3936d
allow { xdm_t xdm_xserver_t } nfs_t:{file lnk_file} create_file_perms;
Chris PeBenito f3936d
can_exec(xdm_t, nfs_t)
Chris PeBenito f3936d
}
Chris PeBenito f3936d
Chris PeBenito f3936d
if (use_samba_home_dirs) {
Chris PeBenito f3936d
allow { xdm_t xdm_xserver_t } cifs_t:dir create_dir_perms;
Chris PeBenito f3936d
allow { xdm_t xdm_xserver_t } cifs_t:{file lnk_file} create_file_perms;
Chris PeBenito f3936d
can_exec(xdm_t, cifs_t)
Chris PeBenito f3936d
}
Chris PeBenito f3936d
Chris PeBenito f3936d
ifdef(`support_polyinstatiation', `
Chris PeBenito f3936d
# xdm_t can polyinstantiate
Chris PeBenito 07620c
files_polyinstantiate_all(xdm_t)
Chris PeBenito f3936d
# xdm needs access for linking .X11-unix to poly /tmp
Chris PeBenito f3936d
allow xdm_t polymember:dir { add_name remove_name write };
Chris PeBenito f3936d
allow xdm_t polymember:lnk_file { create unlink };
Chris PeBenito f3936d
# xdm needs access for copying .Xauthority into new home
Chris PeBenito f3936d
allow xdm_t polymember:file { create getattr write };
Chris PeBenito f3936d
')
Chris PeBenito f3936d
Chris PeBenito f3936d
#
Chris PeBenito f3936d
# Wants to delete .xsession-errors file
Chris PeBenito f3936d
#
Chris PeBenito f3936d
allow xdm_t user_home_type:file unlink;
Chris PeBenito f3936d
#
Chris PeBenito f3936d
# Should fix exec of pam_timestamp_check is not closing xdm file descriptor
Chris PeBenito f3936d
#
Chris PeBenito f3936d
allow pam_t xdm_t:fifo_file { getattr ioctl write };
Chris PeBenito f3936d
Chris PeBenito f3936d
# VNC v4 module in X server
Chris PeBenito 07620c
corenet_tcp_bind_vnc_port(xdm_xserver_t)
Chris PeBenito f3936d
Chris PeBenito f3936d
# Supress permission check on .ICE-unix
Chris PeBenito f3936d
dontaudit xdm_t ice_tmp_t:dir { getattr setattr };
Chris PeBenito f3936d
') dnl end TODO