Chris PeBenito 23a444
Chris PeBenito 23a444
policy_module(xdm,1.0)
Chris PeBenito 23a444
Chris PeBenito 23a444
########################################
Chris PeBenito 23a444
#
Chris PeBenito 23a444
# Declarations
Chris PeBenito 23a444
#
Chris PeBenito 23a444
Chris PeBenito 23a444
# hack until all of strict is converted
Chris PeBenito 23a444
#type xdm_t;
Chris PeBenito 23a444
gen_require(`
Chris PeBenito 23a444
	type unconfined_t;
Chris PeBenito 23a444
')
Chris PeBenito 23a444
typealias unconfined_t alias 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 xserver_log_t;
Chris PeBenito 23a444
files_type(xserver_log_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_run_t;
Chris PeBenito 23a444
files_type(xdm_var_run_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 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 23a444
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 23a444
allow xdm_t self:process { setexec setpgid setsched setrlimit };
Chris PeBenito 23a444
allow xdm_t self:fifo_file rw_file_perms;
Chris PeBenito 23a444
allow xdm_t self:shm create_shm_perms;
Chris PeBenito 23a444
allow xdm_t self:unix_stream_socket { connectto create_stream_socket_perms };
Chris PeBenito 23a444
allow xdm_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 23a444
Chris PeBenito 23a444
allow xdm_t xdm_lock_t:file create_file_perms;
Chris PeBenito 23a444
files_create_lock(xdm_t,xdm_lock_t)
Chris PeBenito 23a444
Chris PeBenito 23a444
allow xdm_t xdm_tmp_t:dir create_dir_perms;
Chris PeBenito 23a444
allow xdm_t xdm_tmp_t:file create_file_perms;
Chris PeBenito 23a444
allow xdm_t xdm_tmp_t:file create_file_perms;
Chris PeBenito 23a444
files_create_tmp_files(xdm_t, xdm_tmp_t, { file dir sock_file })
Chris PeBenito 23a444
Chris PeBenito 23a444
allow xdm_t xdm_tmpfs_t:dir { read getattr lock search ioctl add_name remove_name write };
Chris PeBenito 23a444
allow xdm_t xdm_tmpfs_t:file { create ioctl read getattr lock write setattr append link unlink rename };
Chris PeBenito 23a444
allow xdm_t xdm_tmpfs_t:lnk_file { create read getattr setattr link unlink rename };
Chris PeBenito 23a444
allow xdm_t xdm_tmpfs_t:sock_file { create ioctl read getattr lock write setattr append link unlink rename };
Chris PeBenito 23a444
allow xdm_t xdm_tmpfs_t:fifo_file { create ioctl read getattr lock write setattr append link unlink rename };
Chris PeBenito 23a444
fs_create_tmpfs_data(xdm_t,xdm_tmpfs_t,{ dir file lnk_file sock_file fifo_file })
Chris PeBenito 23a444
Chris PeBenito 23a444
allow xdm_t xdm_var_lib_t:file create_file_perms;
Chris PeBenito 23a444
allow xdm_t xdm_var_lib_t:dir create_dir_perms;
Chris PeBenito 23a444
files_create_var_lib(xdm_t,xdm_var_lib_t)
Chris PeBenito 23a444
Chris PeBenito 23a444
kernel_read_system_state(xdm_t)
Chris PeBenito 23a444
kernel_read_kernel_sysctl(xdm_t)
Chris PeBenito 23a444
Chris PeBenito 23a444
dev_read_rand(xdm_t)
Chris PeBenito 23a444
dev_read_urand(xdm_t)
Chris PeBenito 23a444
Chris PeBenito 23a444
selinux_get_fs_mount(xdm_t)
Chris PeBenito 23a444
selinux_validate_context(xdm_t)
Chris PeBenito 23a444
selinux_compute_access_vector(xdm_t)
Chris PeBenito 23a444
selinux_compute_create_context(xdm_t)
Chris PeBenito 23a444
selinux_compute_relabel_context(xdm_t)
Chris PeBenito 23a444
selinux_compute_user_contexts(xdm_t)
Chris PeBenito 23a444
Chris PeBenito 23a444
files_read_etc_runtime_files(xdm_t)
Chris PeBenito 23a444
Chris PeBenito 23a444
ifdef(`targeted_policy',`
Chris PeBenito 23a444
	unconfined_domain_template(xdm_t)
Chris PeBenito 23a444
')
Chris PeBenito 23a444
Chris PeBenito 23a444
ifdef(`TODO',`
Chris PeBenito 23a444
# cjp: TODO: integrate strict policy:
Chris PeBenito 23a444
daemon_domain(xdm, `, privuser, privrole, auth_chkpwd, privowner, privmem, nscd_client_domain')
Chris PeBenito 23a444
Chris PeBenito 23a444
allow xdm_t xdm_var_run_t:dir setattr;
Chris PeBenito 23a444
Chris PeBenito 23a444
# for xdmctl
Chris PeBenito 23a444
allow xdm_t xdm_var_run_t:fifo_file create_file_perms;
Chris PeBenito 23a444
allow initrc_t xdm_var_run_t:fifo_file unlink;
Chris PeBenito 23a444
file_type_auto_trans(xdm_t, var_run_t, xdm_var_run_t, fifo_file)
Chris PeBenito 23a444
file_type_auto_trans(xdm_t, var_run_t, xdm_var_run_t, dir)
Chris PeBenito 23a444
Chris PeBenito 23a444
# NB we do NOT allow xdm_xserver_t xdm_var_lib_t:dir, only access to an open
Chris PeBenito 23a444
# handle of a file inside the dir!!!
Chris PeBenito 23a444
allow xdm_xserver_t xdm_var_lib_t:file { getattr read };
Chris PeBenito 23a444
dontaudit xdm_xserver_t xdm_var_lib_t:dir search;
Chris PeBenito 23a444
allow xdm_xserver_t xdm_var_run_t:file { getattr read };
Chris PeBenito 23a444
Chris PeBenito 23a444
allow xdm_t default_context_t:dir search;
Chris PeBenito 23a444
allow xdm_t default_context_t:{ file lnk_file } { read getattr };
Chris PeBenito 23a444
Chris PeBenito 23a444
can_network(xdm_t)
Chris PeBenito 23a444
allow xdm_t port_type:tcp_socket name_connect;
Chris PeBenito 23a444
Chris PeBenito 23a444
allow xdm_t xdm_xserver_tmp_t:dir r_dir_perms;
Chris PeBenito 23a444
allow xdm_t xdm_xserver_t:process signal;
Chris PeBenito 23a444
can_unix_connect(xdm_t, xdm_xserver_t)
Chris PeBenito 23a444
allow xdm_t xdm_xserver_tmp_t:sock_file rw_file_perms;
Chris PeBenito 23a444
allow xdm_t xdm_xserver_tmp_t:dir { setattr r_dir_perms };
Chris PeBenito 23a444
allow xdm_xserver_t xdm_t:process signal;
Chris PeBenito 23a444
# for reboot
Chris PeBenito 23a444
allow xdm_t initctl_t:fifo_file write;
Chris PeBenito 23a444
Chris PeBenito 23a444
# init script wants to check if it needs to update windowmanagerlist
Chris PeBenito 23a444
allow initrc_t xdm_rw_etc_t:file { getattr read };
Chris PeBenito 23a444
ifdef(`distro_suse', `
Chris PeBenito 23a444
# set permissions on /tmp/.X11-unix
Chris PeBenito 23a444
allow initrc_t xdm_tmp_t:dir setattr;
Chris PeBenito 23a444
')
Chris PeBenito 23a444
Chris PeBenito 23a444
# Transition to user domains for user sessions.
Chris PeBenito 23a444
domain_trans(xdm_t, xsession_exec_t, unpriv_userdomain)
Chris PeBenito 23a444
allow unpriv_userdomain xdm_xserver_t:unix_stream_socket connectto;
Chris PeBenito 23a444
allow unpriv_userdomain xdm_xserver_t:shm r_shm_perms;
Chris PeBenito 23a444
allow unpriv_userdomain xdm_xserver_t:fd use;
Chris PeBenito 23a444
allow unpriv_userdomain xdm_xserver_tmpfs_t:file { getattr read };
Chris PeBenito 23a444
allow xdm_xserver_t unpriv_userdomain:shm rw_shm_perms;
Chris PeBenito 23a444
allow xdm_xserver_t unpriv_userdomain:fd use;
Chris PeBenito 23a444
Chris PeBenito 23a444
# Do not audit user access to the X log files due to file handle inheritance
Chris PeBenito 23a444
dontaudit unpriv_userdomain xserver_log_t:file { write append };
Chris PeBenito 23a444
Chris PeBenito 23a444
# gnome-session creates socket under /tmp/.ICE-unix/
Chris PeBenito 23a444
allow unpriv_userdomain xdm_tmp_t:dir rw_dir_perms;
Chris PeBenito 23a444
allow unpriv_userdomain xdm_tmp_t:sock_file create;
Chris PeBenito 23a444
Chris PeBenito 23a444
# Allow xdm logins as sysadm_r:sysadm_t
Chris PeBenito 23a444
bool xdm_sysadm_login false;
Chris PeBenito 23a444
if (xdm_sysadm_login) {
Chris PeBenito 23a444
domain_trans(xdm_t, xsession_exec_t, sysadm_t)
Chris PeBenito 23a444
allow sysadm_t xdm_xserver_t:unix_stream_socket connectto;
Chris PeBenito 23a444
allow sysadm_t xdm_xserver_t:shm r_shm_perms;
Chris PeBenito 23a444
allow sysadm_t xdm_xserver_t:fd use;
Chris PeBenito 23a444
allow sysadm_t xdm_xserver_tmpfs_t:file { getattr read };
Chris PeBenito 23a444
allow xdm_xserver_t sysadm_t:shm rw_shm_perms;
Chris PeBenito 23a444
allow xdm_xserver_t sysadm_t:fd use;
Chris PeBenito 23a444
}
Chris PeBenito 23a444
Chris PeBenito 23a444
# Label pid and temporary files with derived types.
Chris PeBenito 23a444
rw_dir_create_file(xdm_xserver_t, xdm_tmp_t)
Chris PeBenito 23a444
allow xdm_xserver_t xdm_tmp_t:sock_file create_file_perms;
Chris PeBenito 23a444
Chris PeBenito 23a444
# Run helper programs.
Chris PeBenito 23a444
allow xdm_t etc_t:file { getattr read };
Chris PeBenito 23a444
allow xdm_t bin_t:dir { getattr search };
Chris PeBenito 23a444
# lib_t is for running cpp
Chris PeBenito 23a444
can_exec(xdm_t, { shell_exec_t etc_t bin_t sbin_t lib_t })
Chris PeBenito 23a444
allow xdm_t { bin_t sbin_t }:lnk_file read;
Chris PeBenito 23a444
ifdef(`hostname.te', `can_exec(xdm_t, hostname_exec_t)')
Chris PeBenito 23a444
ifdef(`loadkeys.te', `can_exec(xdm_t, loadkeys_exec_t)')
Chris PeBenito 23a444
allow xdm_t xdm_xserver_t:process sigkill;
Chris PeBenito 23a444
allow xdm_t xdm_xserver_tmp_t:file unlink;
Chris PeBenito 23a444
Chris PeBenito 23a444
# Access devices.
Chris PeBenito 23a444
allow xdm_t device_t:dir { read search };
Chris PeBenito 23a444
allow xdm_t console_device_t:chr_file setattr;
Chris PeBenito 23a444
allow xdm_t xconsole_device_t:fifo_file { getattr setattr };
Chris PeBenito 23a444
allow xdm_t framebuf_device_t:chr_file { getattr setattr };
Chris PeBenito 23a444
allow xdm_t mouse_device_t:chr_file { getattr setattr };
Chris PeBenito 23a444
allow xdm_t apm_bios_t:chr_file { setattr getattr read write };
Chris PeBenito 23a444
allow xdm_t dri_device_t:chr_file rw_file_perms;
Chris PeBenito 23a444
allow xdm_t device_t:dir rw_dir_perms;
Chris PeBenito 23a444
allow xdm_t agp_device_t:chr_file rw_file_perms;
Chris PeBenito 23a444
allow xdm_t { xserver_misc_device_t misc_device_t }:chr_file { setattr getattr };
Chris PeBenito 23a444
allow xdm_t v4l_device_t:chr_file { setattr getattr };
Chris PeBenito 23a444
allow xdm_t scanner_device_t:chr_file { setattr getattr };
Chris PeBenito 23a444
allow xdm_t tty_device_t:chr_file { ioctl read write setattr getattr };
Chris PeBenito 23a444
allow xdm_t device_t:lnk_file read;
Chris PeBenito 23a444
can_resmgrd_connect(xdm_t)
Chris PeBenito 23a444
Chris PeBenito 23a444
# Access xdm log files.
Chris PeBenito 23a444
file_type_auto_trans(xdm_t, var_log_t, xserver_log_t, file)
Chris PeBenito 23a444
allow xdm_t xserver_log_t:dir rw_dir_perms;
Chris PeBenito 23a444
allow xdm_t xserver_log_t:dir setattr;
Chris PeBenito 23a444
# Access /var/gdm/.gdmfifo.
Chris PeBenito 23a444
allow xdm_t xserver_log_t:fifo_file create_file_perms;
Chris PeBenito 23a444
Chris PeBenito 23a444
allow { xdm_t unpriv_userdomain } xdm_xserver_t:unix_stream_socket connectto;
Chris PeBenito 23a444
allow { xdm_t unpriv_userdomain } xdm_xserver_t:shm rw_shm_perms;
Chris PeBenito 23a444
allow { xdm_t unpriv_userdomain } xdm_xserver_t:fd use;
Chris PeBenito 23a444
allow { xdm_t unpriv_userdomain } xdm_xserver_tmpfs_t:file { getattr read };
Chris PeBenito 23a444
allow xdm_xserver_t { xdm_t unpriv_userdomain }:shm rw_shm_perms;
Chris PeBenito 23a444
allow xdm_xserver_t { xdm_t unpriv_userdomain }:fd use;
Chris PeBenito 23a444
Chris PeBenito 23a444
# Remove /tmp/.X11-unix/X0.
Chris PeBenito 23a444
allow xdm_t xdm_xserver_tmp_t:dir { remove_name write };
Chris PeBenito 23a444
allow xdm_t xdm_xserver_tmp_t:sock_file unlink;
Chris PeBenito 23a444
Chris PeBenito 23a444
ifdef(`gpm.te', `
Chris PeBenito 23a444
# Talk to the console mouse server.
Chris PeBenito 23a444
allow xdm_t gpmctl_t:sock_file { getattr setattr write };
Chris PeBenito 23a444
allow xdm_t gpm_t:unix_stream_socket connectto;
Chris PeBenito 23a444
')
Chris PeBenito 23a444
Chris PeBenito 23a444
allow xdm_t sysfs_t:dir search;
Chris PeBenito 23a444
Chris PeBenito 23a444
# Update utmp and wtmp.
Chris PeBenito 23a444
allow xdm_t initrc_var_run_t: file { read write lock };
Chris PeBenito 23a444
allow xdm_t wtmp_t:file append;
Chris PeBenito 23a444
Chris PeBenito 23a444
# Update lastlog.
Chris PeBenito 23a444
allow xdm_t lastlog_t:file rw_file_perms;
Chris PeBenito 23a444
Chris PeBenito 23a444
# Need to further investigate these permissions and
Chris PeBenito 23a444
# perhaps define derived types.
Chris PeBenito 23a444
allow xdm_t var_lib_t:dir { write search add_name remove_name  create unlink };
Chris PeBenito 23a444
allow xdm_t var_lib_t:file { create write unlink };
Chris PeBenito 23a444
Chris PeBenito 23a444
# Connect to xfs.
Chris PeBenito 23a444
ifdef(`xfs.te', `
Chris PeBenito 23a444
allow xdm_t xfs_tmp_t:dir search;
Chris PeBenito 23a444
allow xdm_t xfs_tmp_t:sock_file write;
Chris PeBenito 23a444
can_unix_connect(xdm_t, xfs_t)
Chris PeBenito 23a444
')
Chris PeBenito 23a444
Chris PeBenito 23a444
allow xdm_t etc_t:lnk_file read;
Chris PeBenito 23a444
Chris PeBenito 23a444
# wdm has its own config dir /etc/X11/wdm
Chris PeBenito 23a444
# this is ugly, daemons should not create files under /etc!
Chris PeBenito 23a444
allow xdm_t xdm_rw_etc_t:dir rw_dir_perms;
Chris PeBenito 23a444
allow xdm_t xdm_rw_etc_t:file create_file_perms;
Chris PeBenito 23a444
Chris PeBenito 23a444
# Signal any user domain.
Chris PeBenito 23a444
allow xdm_t userdomain:process signal_perms;
Chris PeBenito 23a444
Chris PeBenito 23a444
# Search /proc for any user domain processes.
Chris PeBenito 23a444
allow xdm_t userdomain:dir r_dir_perms;
Chris PeBenito 23a444
allow xdm_t userdomain:{ file lnk_file } r_file_perms;
Chris PeBenito 23a444
Chris PeBenito 23a444
# Allow xdm access to the user domains
Chris PeBenito 23a444
allow xdm_t home_root_t:dir search;
Chris PeBenito 23a444
allow xdm_xserver_t home_root_t:dir search;
Chris PeBenito 23a444
Chris PeBenito 23a444
# Do not audit denied attempts to access devices.
Chris PeBenito 23a444
dontaudit xdm_t {removable_device_t fixed_disk_device_t}:{ chr_file blk_file } {setattr rw_file_perms};
Chris PeBenito 23a444
dontaudit xdm_t device_t:file_class_set rw_file_perms;
Chris PeBenito 23a444
dontaudit xdm_t misc_device_t:file_class_set rw_file_perms;
Chris PeBenito 23a444
dontaudit xdm_t removable_device_t:file_class_set rw_file_perms;
Chris PeBenito 23a444
dontaudit xdm_t scsi_generic_device_t:file_class_set rw_file_perms;
Chris PeBenito 23a444
dontaudit xdm_t devpts_t:dir search;
Chris PeBenito 23a444
Chris PeBenito 23a444
# Do not audit denied probes of /proc.
Chris PeBenito 23a444
dontaudit xdm_t domain:dir r_dir_perms;
Chris PeBenito 23a444
dontaudit xdm_t domain:{ file lnk_file } r_file_perms;
Chris PeBenito 23a444
Chris PeBenito 23a444
# Read /usr/share/terminfo/l/linux and /usr/share/icons/default/index.theme...
Chris PeBenito 23a444
allow xdm_t usr_t:{ lnk_file file } { getattr read };
Chris PeBenito 23a444
Chris PeBenito 23a444
# Read fonts
Chris PeBenito 23a444
read_fonts(xdm_t)
Chris PeBenito 23a444
Chris PeBenito 23a444
# Do not audit attempts to write to index files under /usr
Chris PeBenito 23a444
dontaudit xdm_t usr_t:file write;
Chris PeBenito 23a444
Chris PeBenito 23a444
# Do not audit access to /root
Chris PeBenito 23a444
dontaudit xdm_t sysadm_home_dir_t:dir { getattr search };
Chris PeBenito 23a444
Chris PeBenito 23a444
# Do not audit user access to the X log files due to file handle inheritance
Chris PeBenito 23a444
dontaudit unpriv_userdomain xserver_log_t:file { write append };
Chris PeBenito 23a444
Chris PeBenito 23a444
# Do not audit attempts to check whether user root has email
Chris PeBenito 23a444
dontaudit xdm_t { var_spool_t mail_spool_t }:dir search;
Chris PeBenito 23a444
dontaudit xdm_t mail_spool_t:file getattr;
Chris PeBenito 23a444
Chris PeBenito 23a444
# Access sound device.
Chris PeBenito 23a444
allow xdm_t sound_device_t:chr_file { setattr getattr };
Chris PeBenito 23a444
Chris PeBenito 23a444
# Allow setting of attributes on power management devices.
Chris PeBenito 23a444
allow xdm_t power_device_t:chr_file { getattr setattr };
Chris PeBenito 23a444
Chris PeBenito 23a444
# Run the X server in a derived domain.
Chris PeBenito 23a444
xserver_domain(xdm)
Chris PeBenito 23a444
Chris PeBenito 23a444
ifdef(`rhgb.te', `
Chris PeBenito 23a444
allow xdm_xserver_t ramfs_t:dir rw_dir_perms;
Chris PeBenito 23a444
allow xdm_xserver_t ramfs_t:file create_file_perms;
Chris PeBenito 23a444
allow rhgb_t xdm_xserver_t:process signal;
Chris PeBenito 23a444
')
Chris PeBenito 23a444
Chris PeBenito 23a444
# Unrestricted inheritance.
Chris PeBenito 23a444
allow xdm_t xdm_xserver_t:process { noatsecure siginh rlimitinh };
Chris PeBenito 23a444
Chris PeBenito 23a444
# Run xkbcomp.
Chris PeBenito 23a444
allow xdm_xserver_t var_lib_t:dir search;
Chris PeBenito 23a444
allow xdm_xserver_t xkb_var_lib_t:lnk_file read;
Chris PeBenito 23a444
can_exec(xdm_xserver_t, xkb_var_lib_t)
Chris PeBenito 23a444
Chris PeBenito 23a444
# Insert video drivers.  
Chris PeBenito 23a444
allow xdm_xserver_t self:capability mknod;
Chris PeBenito 23a444
allow xdm_xserver_t sysctl_modprobe_t:file { getattr read };
Chris PeBenito 23a444
domain_auto_trans(xdm_xserver_t, insmod_exec_t, insmod_t)
Chris PeBenito 23a444
allow insmod_t xserver_log_t:file write;
Chris PeBenito 23a444
allow insmod_t xdm_xserver_t:unix_stream_socket { read write };
Chris PeBenito 23a444
Chris PeBenito 23a444
# Read /proc/dri/.*
Chris PeBenito 23a444
allow xdm_xserver_t proc_t:dir { search read };
Chris PeBenito 23a444
Chris PeBenito 23a444
# Search /var/run.
Chris PeBenito 23a444
allow xdm_xserver_t var_run_t:dir search;
Chris PeBenito 23a444
Chris PeBenito 23a444
# FIXME: After per user fonts are properly working
Chris PeBenito 23a444
# xdm_xserver_t may no longer have any reason
Chris PeBenito 23a444
# to read ROLE_home_t - examine this in more detail
Chris PeBenito 23a444
# (xauth?)
Chris PeBenito 23a444
Chris PeBenito 23a444
# Search home directories.
Chris PeBenito 23a444
allow xdm_xserver_t user_home_type:dir search;
Chris PeBenito 23a444
allow xdm_xserver_t user_home_type:file { getattr read };
Chris PeBenito 23a444
Chris PeBenito 23a444
if (use_nfs_home_dirs) {
Chris PeBenito 23a444
allow { xdm_t xdm_xserver_t } autofs_t:dir { search getattr };
Chris PeBenito 23a444
allow { xdm_t xdm_xserver_t } nfs_t:dir create_dir_perms;
Chris PeBenito 23a444
allow { xdm_t xdm_xserver_t } nfs_t:{file lnk_file} create_file_perms;
Chris PeBenito 23a444
can_exec(xdm_t, nfs_t)
Chris PeBenito 23a444
}
Chris PeBenito 23a444
Chris PeBenito 23a444
if (use_samba_home_dirs) {
Chris PeBenito 23a444
allow { xdm_t xdm_xserver_t } cifs_t:dir create_dir_perms;
Chris PeBenito 23a444
allow { xdm_t xdm_xserver_t } cifs_t:{file lnk_file} create_file_perms;
Chris PeBenito 23a444
can_exec(xdm_t, cifs_t)
Chris PeBenito 23a444
}
Chris PeBenito 23a444
Chris PeBenito 23a444
# for .dmrc
Chris PeBenito 23a444
allow xdm_t user_home_dir_type:dir { getattr search };
Chris PeBenito 23a444
allow xdm_t user_home_type:file { getattr read };
Chris PeBenito 23a444
Chris PeBenito 23a444
ifdef(`support_polyinstatiation', `
Chris PeBenito 23a444
# xdm_t can polyinstantiate
Chris PeBenito 23a444
polyinstantiater(xdm_t)
Chris PeBenito 23a444
# xdm needs access for linking .X11-unix to poly /tmp
Chris PeBenito 23a444
allow xdm_t polymember:dir { add_name remove_name write };
Chris PeBenito 23a444
allow xdm_t polymember:lnk_file { create unlink };
Chris PeBenito 23a444
# xdm needs access for copying .Xauthority into new home
Chris PeBenito 23a444
allow xdm_t polymember:file { create getattr write };
Chris PeBenito 23a444
')
Chris PeBenito 23a444
Chris PeBenito 23a444
allow xdm_t mnt_t:dir { getattr read search };
Chris PeBenito 23a444
#
Chris PeBenito 23a444
# Wants to delete .xsession-errors file
Chris PeBenito 23a444
#
Chris PeBenito 23a444
allow xdm_t user_home_type:file unlink;
Chris PeBenito 23a444
#
Chris PeBenito 23a444
# Should fix exec of pam_timestamp_check is not closing xdm file descriptor
Chris PeBenito 23a444
#
Chris PeBenito 23a444
ifdef(`pam.te', `
Chris PeBenito 23a444
allow xdm_t pam_var_run_t:dir create_dir_perms;
Chris PeBenito 23a444
allow xdm_t pam_var_run_t:file create_file_perms;
Chris PeBenito 23a444
allow pam_t xdm_t:fifo_file { getattr ioctl write };
Chris PeBenito 23a444
domain_auto_trans(xdm_t, pam_console_exec_t, pam_console_t)
Chris PeBenito 23a444
can_exec(xdm_t, pam_exec_t)
Chris PeBenito 23a444
# For pam_console
Chris PeBenito 23a444
rw_dir_create_file(xdm_t, pam_var_console_t)
Chris PeBenito 23a444
')
Chris PeBenito 23a444
Chris PeBenito 23a444
# Pamconsole/alsa 
Chris PeBenito 23a444
ifdef(`alsa.te', `
Chris PeBenito 23a444
domain_auto_trans(xdm_t, alsa_exec_t, alsa_t)
Chris PeBenito 23a444
') dnl ifdef
Chris PeBenito 23a444
Chris PeBenito 23a444
allow xdm_t var_log_t:file { getattr read };
Chris PeBenito 23a444
allow xdm_t wtmp_t:file { getattr read };
Chris PeBenito 23a444
Chris PeBenito 23a444
domain_auto_trans(initrc_t, xserver_exec_t, xdm_xserver_t)
Chris PeBenito 23a444
#
Chris PeBenito 23a444
# Poweroff wants to create the /poweroff file when run from xdm
Chris PeBenito 23a444
#
Chris PeBenito 23a444
file_type_auto_trans(xdm_t, root_t, etc_runtime_t, file)
Chris PeBenito 23a444
Chris PeBenito 23a444
#
Chris PeBenito 23a444
# xdm tries to bind to biff_port_t
Chris PeBenito 23a444
#
Chris PeBenito 23a444
dontaudit xdm_t port_type:tcp_socket name_bind;
Chris PeBenito 23a444
Chris PeBenito 23a444
# VNC v4 module in X server
Chris PeBenito 23a444
allow xdm_xserver_t vnc_port_t:tcp_socket name_bind; 
Chris PeBenito 23a444
ifdef(`crack.te', `
Chris PeBenito 23a444
allow xdm_t crack_db_t:file r_file_perms;
Chris PeBenito 23a444
')
Chris PeBenito 23a444
r_dir_file(xdm_t, selinux_config_t)
Chris PeBenito 23a444
Chris PeBenito 23a444
# Run telinit->init to shutdown.
Chris PeBenito 23a444
can_exec(xdm_t, init_exec_t)
Chris PeBenito 23a444
allow xdm_t self:sem create_sem_perms;
Chris PeBenito 23a444
Chris PeBenito 23a444
# Allow gdm to run gdm-binary
Chris PeBenito 23a444
can_exec(xdm_t, xdm_exec_t)
Chris PeBenito 23a444
Chris PeBenito 23a444
# Supress permission check on .ICE-unix
Chris PeBenito 23a444
dontaudit xdm_t ice_tmp_t:dir { getattr setattr };
Chris PeBenito 23a444
') dnl end TODO