selinux-policy/policy/modules/services/xserver.te

482 lines
13 KiB
Plaintext
Raw Normal View History

2006-01-19 22:01:48 +00:00
policy_module(xserver,1.1.15)
2006-01-19 22:01:48 +00:00
########################################
#
# Declarations
#
2006-03-28 18:29:52 +00:00
attribute fonts_type;
attribute fonts_cache_type;
attribute fonts_config_type;
2006-01-20 19:36:54 +00:00
type ice_tmp_t;
files_tmp_file(ice_tmp_t)
type iceauth_exec_t;
corecmd_executable_file(iceauth_exec_t)
2006-01-20 19:36:54 +00:00
type xauth_exec_t;
corecmd_executable_file(xauth_exec_t)
2006-01-20 19:36:54 +00:00
2006-04-06 19:27:41 +00:00
# this is not actually a device, its a pipe
type xconsole_device_t;
files_type(xconsole_device_t)
fs_associate_tmpfs(xconsole_device_t)
files_associate_tmp(xconsole_device_t)
2006-01-30 22:51:35 +00:00
type xdm_t;
# real declaration moved to mls until
# range_transition works in loadable modules
gen_require(`
type xdm_exec_t;
')
auth_login_pgm_domain(xdm_t)
2006-01-30 22:51:35 +00:00
init_domain(xdm_t,xdm_exec_t)
init_daemon_domain(xdm_t,xdm_exec_t)
type xdm_lock_t;
files_lock_file(xdm_lock_t)
type xdm_rw_etc_t;
files_type(xdm_rw_etc_t)
type xdm_var_lib_t;
files_type(xdm_var_lib_t)
type xdm_var_run_t;
files_pid_file(xdm_var_run_t)
type xdm_tmp_t;
files_tmp_file(xdm_tmp_t)
type xdm_tmpfs_t;
files_tmpfs_file(xdm_tmpfs_t)
2006-01-19 22:01:48 +00:00
# type for /var/lib/xkb
type xkb_var_lib_t;
2006-06-14 20:52:45 +00:00
files_type(xkb_var_lib_t)
2006-01-19 22:01:48 +00:00
# Type for the executable used to start the X server, e.g. Xwrapper.
type xserver_exec_t;
corecmd_executable_file(xserver_exec_t)
2006-01-19 22:01:48 +00:00
2006-01-30 22:51:35 +00:00
type xsession_exec_t;
corecmd_executable_file(xsession_exec_t)
2006-01-30 22:51:35 +00:00
2006-01-19 22:01:48 +00:00
# Type for the X server log file.
type xserver_log_t;
logging_log_file(xserver_log_t)
2006-01-20 22:02:24 +00:00
xserver_common_domain_template(xdm)
init_system_domain(xdm_xserver_t,xserver_exec_t)
2006-01-30 22:51:35 +00:00
optional_policy(`
2006-01-20 22:02:24 +00:00
prelink_object_file(xkb_var_lib_t)
')
2006-01-30 22:51:35 +00:00
########################################
#
# XDM Local policy
#
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 };
allow xdm_t self:process { setexec setpgid getsched setsched setrlimit signal_perms setkeycreate };
2006-01-30 22:51:35 +00:00
allow xdm_t self:fifo_file rw_file_perms;
allow xdm_t self:shm create_shm_perms;
allow xdm_t self:sem create_sem_perms;
allow xdm_t self:unix_stream_socket { connectto create_stream_socket_perms };
allow xdm_t self:netlink_route_socket r_netlink_socket_perms;
2006-01-30 22:51:35 +00:00
allow xdm_t self:unix_dgram_socket create_socket_perms;
allow xdm_t self:tcp_socket create_stream_socket_perms;
allow xdm_t self:udp_socket create_socket_perms;
allow xdm_t self:socket create_socket_perms;
allow xdm_t self:appletalk_socket create_socket_perms;
allow xdm_t self:key { search link write };
2006-01-30 22:51:35 +00:00
# Supress permission check on .ICE-unix
dontaudit xdm_t ice_tmp_t:dir { getattr setattr };
2006-04-06 19:27:41 +00:00
allow xdm_t xconsole_device_t:fifo_file { getattr setattr };
allow xdm_t xdm_tmp_t:dir manage_dir_perms;
allow xdm_t xdm_tmp_t:file manage_file_perms;
allow xdm_t xdm_tmp_t:sock_file manage_file_perms;
files_tmp_filetrans(xdm_t, xdm_tmp_t, { file dir sock_file })
2006-01-30 22:51:35 +00:00
# Allow gdm to run gdm-binary
can_exec(xdm_t, xdm_exec_t)
# wdm has its own config dir /etc/X11/wdm
# this is ugly, daemons should not create files under /etc!
allow xdm_t xdm_rw_etc_t:dir rw_dir_perms;
allow xdm_t xdm_rw_etc_t:file create_file_perms;
kernel_read_system_state(xdm_t)
kernel_read_kernel_sysctls(xdm_t)
kernel_read_net_sysctls(xdm_t)
kernel_read_network_state(xdm_t)
2006-01-30 22:51:35 +00:00
corecmd_exec_shell(xdm_t)
corecmd_exec_bin(xdm_t)
corecmd_exec_sbin(xdm_t)
2006-05-30 19:46:34 +00:00
corenet_non_ipsec_sendrecv(xdm_t)
2006-01-30 22:51:35 +00:00
corenet_tcp_sendrecv_generic_if(xdm_t)
corenet_udp_sendrecv_generic_if(xdm_t)
corenet_tcp_sendrecv_all_nodes(xdm_t)
corenet_udp_sendrecv_all_nodes(xdm_t)
corenet_tcp_sendrecv_all_ports(xdm_t)
corenet_udp_sendrecv_all_ports(xdm_t)
corenet_tcp_bind_all_nodes(xdm_t)
corenet_udp_bind_all_nodes(xdm_t)
corenet_tcp_connect_all_ports(xdm_t)
2006-05-30 19:46:34 +00:00
corenet_sendrecv_all_client_packets(xdm_t)
2006-01-30 22:51:35 +00:00
# xdm tries to bind to biff_port_t
corenet_dontaudit_tcp_bind_all_ports(xdm_t)
dev_read_rand(xdm_t)
dev_read_sysfs(xdm_t)
dev_getattr_framebuffer_dev(xdm_t)
dev_setattr_framebuffer_dev(xdm_t)
dev_getattr_mouse_dev(xdm_t)
dev_setattr_mouse_dev(xdm_t)
2006-01-30 22:51:35 +00:00
dev_rw_apm_bios(xdm_t)
dev_setattr_apm_bios_dev(xdm_t)
dev_rw_dri(xdm_t)
dev_rw_agp(xdm_t)
2006-01-30 22:51:35 +00:00
dev_getattr_xserver_misc_dev(xdm_t)
dev_setattr_xserver_misc_dev(xdm_t)
dev_getattr_misc_dev(xdm_t)
dev_setattr_misc_dev(xdm_t)
2006-01-30 22:51:35 +00:00
dev_dontaudit_rw_misc(xdm_t)
dev_getattr_video_dev(xdm_t)
dev_setattr_video_dev(xdm_t)
dev_getattr_scanner_dev(xdm_t)
dev_setattr_scanner_dev(xdm_t)
dev_getattr_sound_dev(xdm_t)
dev_setattr_sound_dev(xdm_t)
dev_getattr_power_mgmt_dev(xdm_t)
dev_setattr_power_mgmt_dev(xdm_t)
2006-01-30 22:51:35 +00:00
2006-02-20 21:33:25 +00:00
domain_use_interactive_fds(xdm_t)
2006-01-30 22:51:35 +00:00
# Do not audit denied probes of /proc.
domain_dontaudit_read_all_domains_state(xdm_t)
files_read_etc_files(xdm_t)
files_read_var_files(xdm_t)
2006-01-30 22:51:35 +00:00
files_read_etc_runtime_files(xdm_t)
files_exec_etc_files(xdm_t)
files_list_mnt(xdm_t)
# Read /usr/share/terminfo/l/linux and /usr/share/icons/default/index.theme...
files_read_usr_files(xdm_t)
# Poweroff wants to create the /poweroff file when run from xdm
files_create_boot_flag(xdm_t)
fs_getattr_all_fs(xdm_t)
fs_search_auto_mountpoints(xdm_t)
storage_dontaudit_read_fixed_disk(xdm_t)
storage_dontaudit_write_fixed_disk(xdm_t)
2006-02-02 21:08:12 +00:00
storage_dontaudit_setattr_fixed_disk_dev(xdm_t)
2006-01-30 22:51:35 +00:00
storage_dontaudit_raw_read_removable_device(xdm_t)
storage_dontaudit_raw_write_removable_device(xdm_t)
2006-02-02 21:08:12 +00:00
storage_dontaudit_setattr_removable_dev(xdm_t)
2006-01-30 22:51:35 +00:00
storage_dontaudit_rw_scsi_generic(xdm_t)
term_setattr_console(xdm_t)
term_dontaudit_use_console(xdm_t)
2006-02-02 21:08:12 +00:00
term_use_unallocated_ttys(xdm_t)
2006-01-30 22:51:35 +00:00
term_setattr_unallocated_ttys(xdm_t)
auth_manage_pam_pid(xdm_t)
auth_manage_pam_console_data(xdm_t)
auth_rw_faillog(xdm_t)
auth_write_login_records(xdm_t)
2006-01-30 22:51:35 +00:00
2006-02-02 21:08:12 +00:00
init_use_script_ptys(xdm_t)
2006-01-30 22:51:35 +00:00
# Run telinit->init to shutdown.
init_exec(xdm_t)
init_write_initctl(xdm_t)
libs_use_ld_so(xdm_t)
libs_use_shared_libs(xdm_t)
libs_exec_lib_files(xdm_t)
logging_read_generic_logs(xdm_t)
miscfiles_read_localization(xdm_t)
miscfiles_read_fonts(xdm_t)
sysnet_read_config(xdm_t)
2006-02-20 21:33:25 +00:00
userdom_dontaudit_use_unpriv_user_fds(xdm_t)
2006-02-21 18:40:44 +00:00
userdom_dontaudit_search_sysadm_home_dirs(xdm_t)
2006-06-21 21:02:49 +00:00
userdom_create_all_users_keys(xdm_t)
2006-01-30 22:51:35 +00:00
# for .dmrc
2006-02-21 18:40:44 +00:00
userdom_read_unpriv_users_home_content_files(xdm_t)
2006-01-30 22:51:35 +00:00
# Search /proc for any user domain processes.
2006-02-02 21:08:12 +00:00
userdom_read_all_users_state(xdm_t)
2006-01-30 22:51:35 +00:00
userdom_signal_all_users(xdm_t)
ifdef(`strict_policy',`
allow xdm_t xdm_lock_t:file create_file_perms;
files_lock_filetrans(xdm_t,xdm_lock_t,file)
2006-01-30 22:51:35 +00:00
2006-05-19 13:14:37 +00:00
allow xdm_t xdm_tmpfs_t:dir manage_dir_perms;
allow xdm_t xdm_tmpfs_t:file manage_file_perms;
allow xdm_t xdm_tmpfs_t:lnk_file create_lnk_perms;
allow xdm_t xdm_tmpfs_t:sock_file manage_file_perms;
allow xdm_t xdm_tmpfs_t:fifo_file manage_file_perms;
2006-02-21 18:40:44 +00:00
fs_tmpfs_filetrans(xdm_t,xdm_tmpfs_t,{ dir file lnk_file sock_file fifo_file })
2006-01-30 22:51:35 +00:00
allow xdm_t xdm_var_lib_t:file create_file_perms;
allow xdm_t xdm_var_lib_t:dir create_dir_perms;
files_var_lib_filetrans(xdm_t,xdm_var_lib_t,file)
2006-01-30 22:51:35 +00:00
allow xdm_t xdm_var_run_t:dir manage_dir_perms;
2006-05-19 13:14:37 +00:00
allow xdm_t xdm_var_run_t:file manage_file_perms;
2006-01-30 22:51:35 +00:00
allow xdm_t xdm_var_run_t:fifo_file manage_file_perms;
2006-05-19 13:14:37 +00:00
files_pid_filetrans(xdm_t,xdm_var_run_t,{ dir file fifo_file })
2006-01-30 22:51:35 +00:00
allow xdm_t xdm_xserver_t:process signal;
allow xdm_t xdm_xserver_t:unix_stream_socket connectto;
allow xdm_t xdm_xserver_tmp_t:sock_file rw_file_perms;
allow xdm_t xdm_xserver_tmp_t:dir { setattr r_dir_perms };
# transition to the xdm xserver
domain_auto_trans(xdm_t, xserver_exec_t, xdm_xserver_t)
allow xdm_t xdm_xserver_t:fd use;
allow xdm_xserver_t xdm_t:fd use;
allow xdm_xserver_t xdm_t:fifo_file rw_file_perms;
allow xdm_xserver_t xdm_t:process { signal sigchld };
allow xdm_t xdm_xserver_t:process { noatsecure siginh rlimitinh signal sigkill };
allow xdm_t xdm_xserver_t:shm rw_shm_perms;
# connect to xdm xserver over stream socket
allow xdm_t xdm_xserver_tmp_t:dir r_dir_perms;
allow xdm_t xdm_xserver_tmp_t:sock_file rw_file_perms;
allow xdm_t xdm_xserver_t:unix_stream_socket connectto;
# Remove /tmp/.X11-unix/X0.
allow xdm_t xdm_xserver_tmp_t:dir { remove_name write };
allow xdm_t xdm_xserver_tmp_t:sock_file unlink;
allow xdm_t xdm_xserver_tmp_t:file unlink;
allow xdm_t xserver_log_t:dir manage_dir_perms;
2006-01-30 22:51:35 +00:00
allow xdm_t xserver_log_t:file manage_file_perms;
allow xdm_t xserver_log_t:fifo_file manage_file_perms;
2006-02-21 18:40:44 +00:00
logging_log_filetrans(xdm_t,xserver_log_t,file)
2006-01-30 22:51:35 +00:00
auth_domtrans_pam_console(xdm_t)
2006-02-15 16:42:51 +00:00
xserver_rw_session_template(xdm,xdm_t,xdm_tmpfs_t)
2006-01-30 22:51:35 +00:00
tunable_policy(`xdm_sysadm_login',`
userdom_xsession_spec_domtrans_all_users(xdm_t)
# FIXME:
# xserver_rw_session_template(xdm,userdomain)
',`
userdom_xsession_spec_domtrans_unpriv_users(xdm_t)
# FIXME:
# xserver_rw_session_template(xdm,unpriv_userdomain)
# dontaudit xdm_xserver_t sysadm_t:shm { unix_read unix_write };
# allow xdm_xserver_t xdm_tmpfs_t:file rw_file_perms;
')
optional_policy(`
2006-01-30 22:51:35 +00:00
alsa_domtrans(xdm_t)
')
')
ifdef(`targeted_policy',`
unconfined_domain(xdm_t)
2006-01-30 22:51:35 +00:00
unconfined_domtrans(xdm_t)
2006-05-19 13:14:37 +00:00
userdom_generic_user_home_dir_filetrans_generic_user_home_content(xdm_t, {file dir })
ifndef(`distro_redhat',`
allow xdm_t self:process { execheap execmem };
')
ifdef(`distro_rhel4',`
allow xdm_t self:process { execheap execmem };
')
2006-01-30 22:51:35 +00:00
')
tunable_policy(`use_nfs_home_dirs',`
fs_manage_nfs_dirs(xdm_t)
fs_manage_nfs_files(xdm_t)
fs_manage_nfs_symlinks(xdm_t)
fs_exec_nfs_files(xdm_t)
2006-01-30 22:51:35 +00:00
')
tunable_policy(`use_samba_home_dirs',`
fs_manage_cifs_dirs(xdm_t)
fs_manage_cifs_files(xdm_t)
fs_manage_cifs_symlinks(xdm_t)
fs_exec_cifs_files(xdm_t)
2006-01-30 22:51:35 +00:00
')
2006-04-03 19:49:47 +00:00
optional_policy(`
consoletype_exec(xdm_t)
2006-04-03 19:49:47 +00:00
')
optional_policy(`
2006-01-30 22:51:35 +00:00
# Talk to the console mouse server.
gpm_stream_connect(xdm_t)
gpm_setattr_gpmctl(xdm_t)
')
optional_policy(`
2006-01-30 22:51:35 +00:00
hostname_exec(xdm_t)
')
optional_policy(`
2006-01-30 22:51:35 +00:00
loadkeys_exec(xdm_t)
')
optional_policy(`
2006-01-30 22:51:35 +00:00
locallogin_signull(xdm_t)
')
optional_policy(`
2006-01-30 22:51:35 +00:00
# Do not audit attempts to check whether user root has email
2006-02-02 21:08:12 +00:00
mta_dontaudit_getattr_spool_files(xdm_t)
2006-01-30 22:51:35 +00:00
')
optional_policy(`
2006-02-02 21:08:12 +00:00
nscd_socket_use(xdm_t)
2006-01-30 22:51:35 +00:00
')
optional_policy(`
2006-01-30 22:51:35 +00:00
seutil_sigchld_newrole(xdm_t)
')
optional_policy(`
2006-01-30 22:51:35 +00:00
udev_read_db(xdm_t)
')
optional_policy(`
2006-01-30 22:51:35 +00:00
userhelper_dontaudit_search_config(xdm_t)
')
optional_policy(`
2006-01-30 22:51:35 +00:00
usermanage_read_crack_db(xdm_t)
')
optional_policy(`
2006-01-30 22:51:35 +00:00
xfs_stream_connect(xdm_t)
')
########################################
#
# XDM Xserver local policy
#
2006-05-19 13:14:37 +00:00
allow xdm_xserver_t xdm_t:process { signal getpgid };
2006-02-07 21:48:00 +00:00
allow xdm_xserver_t xdm_t:shm rw_shm_perms;
# NB we do NOT allow xdm_xserver_t xdm_var_lib_t:dir, only access to an open
# handle of a file inside the dir!!!
allow xdm_xserver_t xdm_var_lib_t:file { getattr read };
dontaudit xdm_xserver_t xdm_var_lib_t:dir search;
2006-01-30 22:51:35 +00:00
2006-02-07 21:48:00 +00:00
allow xdm_xserver_t xdm_var_run_t:file { getattr read };
2006-01-30 22:51:35 +00:00
2006-02-07 21:48:00 +00:00
# Label pid and temporary files with derived types.
allow xdm_xserver_t xdm_tmp_t:dir rw_dir_perms;
allow xdm_xserver_t xdm_tmp_t:file manage_file_perms;
allow xdm_xserver_t xdm_tmp_t:lnk_file create_lnk_perms;
allow xdm_xserver_t xdm_tmp_t:sock_file manage_file_perms;
2006-01-30 22:51:35 +00:00
2006-02-07 21:48:00 +00:00
# Run xkbcomp.
allow xdm_xserver_t xkb_var_lib_t:lnk_file read;
can_exec(xdm_xserver_t, xkb_var_lib_t)
files_search_var_lib(xdm_xserver_t)
2006-01-30 22:51:35 +00:00
2006-02-07 21:48:00 +00:00
# VNC v4 module in X server
corenet_tcp_bind_vnc_port(xdm_xserver_t)
2006-01-30 22:51:35 +00:00
2006-02-07 21:48:00 +00:00
fs_search_auto_mountpoints(xdm_xserver_t)
2006-01-30 22:51:35 +00:00
init_use_fds(xdm_xserver_t)
2006-01-30 22:51:35 +00:00
2006-02-07 21:48:00 +00:00
tunable_policy(`use_nfs_home_dirs',`
fs_manage_nfs_dirs(xdm_xserver_t)
fs_manage_nfs_files(xdm_xserver_t)
fs_manage_nfs_symlinks(xdm_xserver_t)
')
tunable_policy(`use_samba_home_dirs',`
fs_manage_cifs_dirs(xdm_xserver_t)
fs_manage_cifs_files(xdm_xserver_t)
fs_manage_cifs_symlinks(xdm_xserver_t)
')
2006-01-30 22:51:35 +00:00
2006-02-07 21:48:00 +00:00
ifdef(`strict_policy',`
2006-01-30 22:51:35 +00:00
# FIXME: After per user fonts are properly working
# xdm_xserver_t may no longer have any reason
# to read ROLE_home_t - examine this in more detail
# (xauth?)
2006-02-21 18:40:44 +00:00
userdom_read_unpriv_users_home_content_files(xdm_xserver_t)
2006-01-30 22:51:35 +00:00
2006-03-28 18:29:52 +00:00
xserver_use_all_users_fonts(xdm_xserver_t)
2006-01-30 22:51:35 +00:00
')
ifdef(`targeted_policy',`
unconfined_domain_noaudit(xdm_xserver_t)
unconfined_domtrans(xdm_xserver_t)
ifndef(`distro_redhat',`
allow xdm_xserver_t self:process { execheap execmem };
')
ifdef(`distro_rhel4',`
allow xdm_xserver_t self:process { execheap execmem };
')
')
2006-04-14 19:13:17 +00:00
optional_policy(`
resmgr_stream_connect(xdm_t)
')
optional_policy(`
2006-03-09 19:02:29 +00:00
rhgb_rw_shm(xdm_xserver_t)
rhgb_rw_tmpfs_files(xdm_xserver_t)
')
2006-01-30 22:51:35 +00:00
ifdef(`TODO',`
# Need to further investigate these permissions and
# perhaps define derived types.
allow xdm_t var_lib_t:dir { write search add_name remove_name create unlink };
allow xdm_t var_lib_t:file { create write unlink };
# Do not audit attempts to write to index files under /usr
dontaudit xdm_t usr_t:file write;
ifdef(`rhgb.te', `
allow xdm_xserver_t ramfs_t:dir rw_dir_perms;
allow xdm_xserver_t ramfs_t:file create_file_perms;
allow rhgb_t xdm_xserver_t:process signal;
')
ifdef(`enable_polyinstantiation',`
# xdm needs access for linking .X11-unix to poly /tmp
allow xdm_t polymember:dir { add_name remove_name write };
allow xdm_t polymember:lnk_file { create unlink };
# xdm needs access for copying .Xauthority into new home
allow xdm_t polymember:file { create getattr write };
')
#
# Wants to delete .xsession-errors file
#
allow xdm_t user_home_type:file unlink;
#
# Should fix exec of pam_timestamp_check is not closing xdm file descriptor
#
allow pam_t xdm_t:fifo_file { getattr ioctl write };
') dnl end TODO