policy_module(xserver, 3.9.4) gen_require(` class x_drawable all_x_drawable_perms; class x_screen all_x_screen_perms; class x_gc all_x_gc_perms; class x_font all_x_font_perms; class x_colormap all_x_colormap_perms; class x_property all_x_property_perms; class x_selection all_x_selection_perms; class x_cursor all_x_cursor_perms; class x_client all_x_client_perms; class x_device all_x_device_perms; class x_pointer all_x_pointer_perms; class x_keyboard all_x_keyboard_perms; class x_server all_x_server_perms; class x_extension all_x_extension_perms; class x_resource all_x_resource_perms; class x_event all_x_event_perms; class x_synthetic_event all_x_synthetic_event_perms; ') ######################################## # # Declarations # ## ##

## Allows clients to write to the X server shared ## memory segments. ##

##
gen_tunable(xserver_clients_write_xshm, false) ## ##

## Allows XServer to execute writable memory ##

##
gen_tunable(xserver_execmem, false) ## ##

## Allow the graphical login program to execute bootloader ##

##
gen_tunable(xdm_exec_bootloader, false) ## ##

## Allow the graphical login program to create, read, write, and delete files in the /boot director and DOS filesystem. ##

##
gen_tunable(xdm_manage_bootloader,true) ## ##

## Allow the graphical login program to login directly as sysadm_r:sysadm_t ##

##
gen_tunable(xdm_sysadm_login, false) ## ##

## Allow the graphical login program to create files in HOME dirs as xdm_home_t. ##

##
gen_tunable(xdm_write_home, false) ## ##

## Allows xdm_t to bind on vnc_port_t(5910) ##

##
gen_tunable(xdm_bind_vnc_tcp_port, false) ## ##

## Support X userspace object manager ##

##
gen_tunable(xserver_object_manager, false) ## ##

## Allow regular users direct dri device access ##

##
gen_tunable(selinuxuser_direct_dri_enabled, false) attribute xdmhomewriter; attribute x_userdomain; attribute x_domain; attribute dridomain; # X Events attribute xevent_type; attribute input_xevent_type; type xevent_t, xevent_type; typealias xevent_t alias { user_property_xevent_t staff_property_xevent_t sysadm_property_xevent_t }; typealias xevent_t alias { auditadm_property_xevent_t secadm_property_xevent_t }; typealias xevent_t alias { user_focus_xevent_t staff_focus_xevent_t sysadm_focus_xevent_t }; typealias xevent_t alias { auditadm_focus_xevent_t secadm_focus_xevent_t }; typealias xevent_t alias { user_manage_xevent_t staff_manage_xevent_t sysadm_manage_xevent_t }; typealias xevent_t alias { auditadm_manage_xevent_t secadm_manage_xevent_t }; typealias xevent_t alias { user_default_xevent_t staff_default_xevent_t sysadm_default_xevent_t }; typealias xevent_t alias { auditadm_default_xevent_t secadm_default_xevent_t }; type client_xevent_t, xevent_type; typealias client_xevent_t alias { user_client_xevent_t staff_client_xevent_t sysadm_client_xevent_t }; typealias client_xevent_t alias { auditadm_client_xevent_t secadm_client_xevent_t }; type input_xevent_t, xevent_type, input_xevent_type; # X Extensions attribute xextension_type; type xextension_t, xextension_type; type security_xextension_t, xextension_type; # X Properties attribute xproperty_type; type xproperty_t, xproperty_type; type seclabel_xproperty_t, xproperty_type; type clipboard_xproperty_t, xproperty_type; # X Selections attribute xselection_type; type xselection_t, xselection_type; type clipboard_xselection_t, xselection_type; #type settings_xselection_t, xselection_type; #type dbus_xselection_t, xselection_type; # X Drawables attribute xdrawable_type; attribute xcolormap_type; type root_xdrawable_t, xdrawable_type; type root_xcolormap_t, xcolormap_type; attribute xserver_unconfined_type; xserver_object_types_template(root) xserver_object_types_template(user) typealias user_xproperty_t alias { staff_xproperty_t sysadm_xproperty_t }; typealias user_xproperty_t alias { auditadm_xproperty_t secadm_xproperty_t }; typealias user_input_xevent_t alias { staff_input_xevent_t sysadm_input_xevent_t }; typealias user_input_xevent_t alias { auditadm_input_xevent_t secadm_input_xevent_t }; type remote_t; xserver_object_types_template(remote) xserver_common_x_domain_template(remote, remote_t) type user_fonts_t; typealias user_fonts_t alias { staff_fonts_t sysadm_fonts_t xfs_fonts_t }; typealias user_fonts_t alias { auditadm_fonts_t secadm_fonts_t }; typealias user_fonts_t alias { xguest_fonts_t unconfined_fonts_t user_fonts_home_t }; typealias user_fonts_t alias xfs_tmp_t; userdom_user_home_content(user_fonts_t) files_tmp_file(user_fonts_t) type user_fonts_cache_t; typealias user_fonts_cache_t alias { staff_fonts_cache_t sysadm_fonts_cache_t }; typealias user_fonts_cache_t alias { auditadm_fonts_cache_t secadm_fonts_cache_t }; typealias user_fonts_cache_t alias { xguest_fonts_cache_t unconfined_fonts_cache_t }; userdom_user_home_content(user_fonts_cache_t) type user_fonts_config_t; typealias user_fonts_config_t alias { staff_fonts_config_t sysadm_fonts_config_t }; typealias user_fonts_config_t alias { auditadm_fonts_config_t secadm_fonts_config_t }; typealias user_fonts_config_t alias { fonts_config_home_t xguest_fonts_config_t unconfined_fonts_config_t }; userdom_user_home_content(user_fonts_config_t) type iceauth_t; type iceauth_exec_t; typealias iceauth_t alias { user_iceauth_t staff_iceauth_t sysadm_iceauth_t }; typealias iceauth_t alias { xguest_iceauth_t }; typealias iceauth_t alias { auditadm_iceauth_t secadm_iceauth_t }; userdom_user_application_domain(iceauth_t, iceauth_exec_t) type iceauth_home_t; typealias iceauth_home_t alias { user_iceauth_home_t staff_iceauth_home_t sysadm_iceauth_home_t }; typealias iceauth_home_t alias { auditadm_iceauth_home_t secadm_iceauth_home_t }; typealias iceauth_home_t alias { xguest_iceauth_home_t }; userdom_user_home_content(iceauth_home_t) type xauth_t; type xauth_exec_t; typealias xauth_t alias { user_xauth_t staff_xauth_t sysadm_xauth_t }; typealias xauth_t alias { auditadm_xauth_t secadm_xauth_t }; typealias xauth_t alias { xguest_xauth_t unconfined_xauth_t }; userdom_user_application_domain(xauth_t, xauth_exec_t) type xauth_home_t; typealias xauth_home_t alias { user_xauth_home_t staff_xauth_home_t sysadm_xauth_home_t }; typealias xauth_home_t alias { auditadm_xauth_home_t secadm_xauth_home_t }; typealias xauth_home_t alias { xguest_xauth_home_t unconfined_xauth_home_t }; userdom_user_home_content(xauth_home_t) type xauth_tmp_t; typealias xauth_tmp_t alias { user_xauth_tmp_t staff_xauth_tmp_t sysadm_xauth_tmp_t }; typealias xauth_tmp_t alias { xguest_xauth_tmp_t unconfined_xauth_tmp_t }; typealias xauth_tmp_t alias { auditadm_xauth_tmp_t secadm_xauth_tmp_t }; userdom_user_tmp_file(xauth_tmp_t) # this is not actually a device, its a pipe type xconsole_device_t; files_type(xconsole_device_t) dev_associate(xconsole_device_t) fs_associate_tmpfs(xconsole_device_t) files_associate_tmp(xconsole_device_t) type xdm_unconfined_exec_t; application_executable_file(xdm_unconfined_exec_t) type xdm_t alias xdm_dbusd_t; type xdm_exec_t; auth_login_pgm_domain(xdm_t) init_domain(xdm_t, xdm_exec_t) init_system_domain(xdm_t, xdm_exec_t) xserver_object_types_template(xdm) xserver_common_x_domain_template(xdm, xdm_t) type xdm_lock_t; files_lock_file(xdm_lock_t) type xdm_etc_t; files_config_file(xdm_etc_t) type xdm_rw_etc_t; files_config_file(xdm_rw_etc_t) type xdm_spool_t; files_spool_file(xdm_spool_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_unit_file_t; systemd_unit_file(xdm_unit_file_t) type xserver_var_lib_t; files_type(xserver_var_lib_t) type xserver_var_run_t; files_pid_file(xserver_var_run_t) type xdm_tmpfs_t; files_tmpfs_file(xdm_tmpfs_t) type xdm_home_t; userdom_user_home_content(xdm_home_t) type xdm_log_t; logging_log_file(xdm_log_t) # type for /var/lib/xkb type xkb_var_lib_t; files_type(xkb_var_lib_t) # Type for the executable used to start the X server, e.g. Xwrapper. type xserver_t; type xserver_exec_t; typealias xserver_t alias { user_xserver_t staff_xserver_t sysadm_xserver_t }; typealias xserver_t alias { auditadm_xserver_t secadm_xserver_t xdm_xserver_t }; init_system_domain(xserver_t, xserver_exec_t) ubac_constrained(xserver_t) type xserver_etc_t; files_config_file(xserver_etc_t) type xserver_tmpfs_t; typealias xserver_tmpfs_t alias { user_xserver_tmpfs_t staff_xserver_tmpfs_t sysadm_xserver_tmpfs_t xguest_xserver_tmpfs_t unconfined_xserver_tmpfs_t xdm_xserver_tmpfs_t }; typealias xserver_tmpfs_t alias { auditadm_xserver_tmpfs_t secadm_xserver_tmpfs_t }; userdom_user_tmp_file(xserver_tmpfs_t) type xsession_exec_t; corecmd_executable_file(xsession_exec_t) # Type for the X server log file. type xserver_log_t; logging_log_file(xserver_log_t) ifdef(`enable_mcs',` init_ranged_domain(xdm_t, xdm_exec_t, s0 - mcs_systemhigh) init_ranged_daemon_domain(xdm_t, xdm_exec_t, s0 - mcs_systemhigh) ') optional_policy(` prelink_object_file(xkb_var_lib_t) ') ######################################## # # Iceauth local policy # allow iceauth_t iceauth_home_t:file manage_file_perms; allow xdm_t iceauth_home_t:file read_file_perms; dev_read_rand(iceauth_t) fs_search_auto_mountpoints(iceauth_t) userdom_use_inherited_user_terminals(iceauth_t) userdom_read_user_tmp_files(iceauth_t) userdom_read_all_users_state(iceauth_t) userdom_home_manager(iceauth_t) xserver_filetrans_home_content(iceauth_t) ifdef(`hide_broken_symptoms',` dev_dontaudit_read_urand(iceauth_t) dev_dontaudit_rw_dri(iceauth_t) dev_dontaudit_rw_generic_dev_nodes(iceauth_t) term_dontaudit_use_unallocated_ttys(iceauth_t) userdom_dontaudit_read_user_home_content_files(iceauth_t) userdom_dontaudit_write_user_home_content_files(iceauth_t) userdom_dontaudit_write_user_tmp_files(iceauth_t) optional_policy(` mozilla_dontaudit_rw_user_home_files(iceauth_t) ') ') ######################################## # # Xauth local policy # allow xauth_t self:capability { dac_read_search }; allow xauth_t self:process signal; allow xauth_t self:shm create_shm_perms; allow xauth_t self:unix_stream_socket create_stream_socket_perms; allow xauth_t self:unix_dgram_socket create_socket_perms; allow xauth_t xdm_t:process sigchld; allow xauth_t xserver_t:unix_stream_socket connectto; corenet_tcp_connect_xserver_port(xauth_t) allow xauth_t xauth_home_t:file manage_file_perms; manage_dirs_pattern(xauth_t, xdm_var_run_t, xdm_var_run_t) manage_files_pattern(xauth_t, xdm_var_run_t, xdm_var_run_t) manage_dirs_pattern(xauth_t, xauth_tmp_t, xauth_tmp_t) manage_files_pattern(xauth_t, xauth_tmp_t, xauth_tmp_t) files_tmp_filetrans(xauth_t, xauth_tmp_t, { file dir }) stream_connect_pattern(xauth_t, xserver_tmp_t, xserver_tmp_t, xserver_t) kernel_read_network_state(xauth_t) kernel_read_system_state(xauth_t) kernel_request_load_module(xauth_t) dev_read_rand(xauth_t) dev_read_urand(xauth_t) domain_use_interactive_fds(xauth_t) domain_dontaudit_leaks(xauth_t) files_read_etc_files(xauth_t) files_read_usr_files(xauth_t) files_search_pids(xauth_t) files_dontaudit_getattr_all_dirs(xauth_t) files_dontaudit_leaks(xauth_t) files_var_lib_filetrans(xauth_t, xauth_home_t, file) fs_dontaudit_leaks(xauth_t) fs_getattr_all_fs(xauth_t) fs_search_auto_mountpoints(xauth_t) # Probably a leak term_dontaudit_use_ptmx(xauth_t) term_dontaudit_use_console(xauth_t) auth_use_nsswitch(xauth_t) userdom_use_inherited_user_terminals(xauth_t) userdom_read_user_tmp_files(xauth_t) userdom_read_all_users_state(xauth_t) userdom_search_user_home_dirs(xauth_t) userdom_user_home_dir_filetrans(xauth_t, xauth_home_t, file) userdom_user_home_dir_filetrans(xauth_t, xauth_home_t, file, ".Xauthority") userdom_user_home_dir_filetrans(xauth_t, xauth_home_t, file, ".Xauthority-l") userdom_user_home_dir_filetrans(xauth_t, xauth_home_t, file, ".Xauthority-c") userdom_user_home_dir_filetrans(xauth_t, xauth_home_t, file, ".Xauthority-n") userdom_user_home_dir_filetrans(xauth_t, xauth_home_t, file, ".xauth") userdom_user_home_dir_filetrans(xauth_t, xauth_home_t, file, ".Xauth") xserver_rw_xdm_tmp_files(xauth_t) ifdef(`hide_broken_symptoms',` userdom_manage_user_home_content_files(xauth_t) userdom_manage_user_tmp_files(xauth_t) dev_dontaudit_rw_generic_dev_nodes(xauth_t) miscfiles_read_fonts(xauth_t) ') userdom_home_manager(xauth_t) ifdef(`hide_broken_symptoms',` term_dontaudit_use_unallocated_ttys(xauth_t) dev_dontaudit_rw_dri(xauth_t) ') optional_policy(` nx_var_lib_filetrans(xauth_t, xauth_home_t, file) ') optional_policy(` ssh_use_ptys(xauth_t) ssh_sigchld(xauth_t) ssh_read_pipes(xauth_t) ssh_dontaudit_rw_tcp_sockets(xauth_t) ') ######################################## # # XDM Local policy # allow xdm_t self:capability { setgid setuid sys_resource kill sys_tty_config mknod chown dac_read_search dac_override fowner fsetid ipc_owner sys_nice sys_rawio net_bind_service net_admin sys_ptrace }; allow xdm_t self:capability2 { block_suspend bpf }; allow xdm_t self:cap_userns { dac_override kill net_admin setpcap sys_admin sys_ptrace }; dontaudit xdm_t self:capability sys_admin; dontaudit xdm_t self:capability2 wake_alarm; tunable_policy(`deny_ptrace',`',` allow xdm_t self:process ptrace; ') allow xdm_t self:process { setexec setpgid getattr getcap setcap getsched getsession setsched setrlimit signal_perms setkeycreate transition }; allow xdm_t self:fifo_file rw_fifo_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:unix_dgram_socket { create_socket_perms sendto listen }; allow xdm_t self:tcp_socket create_stream_socket_perms; allow xdm_t self:udp_socket create_socket_perms; allow xdm_t self:netlink_kobject_uevent_socket create_socket_perms; allow xdm_t self:netlink_route_socket { create_socket_perms nlmsg_read nlmsg_write }; allow xdm_t self:netlink_selinux_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 }; allow xdm_t self:dbus { send_msg acquire_svc }; allow xdm_t xauth_home_t:file manage_file_perms; allow xdm_t xserver_unconfined_type:process { signull }; allow xdm_t x_domain:system { status reload }; allow xdm_t xdm_unit_file_t:service { status start }; allow xdm_t xconsole_device_t:fifo_file { getattr_fifo_file_perms setattr_fifo_file_perms }; manage_dirs_pattern(xdm_t, xkb_var_lib_t, xkb_var_lib_t) manage_files_pattern(xdm_t, xkb_var_lib_t, xkb_var_lib_t) manage_dirs_pattern(xdm_t, xdm_home_t, xdm_home_t) manage_files_pattern(xdm_t, xdm_home_t, xdm_home_t) xserver_filetrans_home_content(xdm_t) xserver_filetrans_admin_home_content(xdm_t) #Handle mislabeled files in homedir userdom_delete_user_home_content_files(xdm_t) userdom_signull_unpriv_users(xdm_t) userdom_dontaudit_read_admin_home_lnk_files(xdm_t) # Allow gdm to run gdm-binary can_exec(xdm_t, xdm_exec_t) can_exec(xdm_t, xsession_exec_t) allow xdm_t xdm_lock_t:file manage_file_perms; files_lock_filetrans(xdm_t, xdm_lock_t, file) read_lnk_files_pattern(xdm_t, xdm_etc_t, xdm_etc_t) read_files_pattern(xdm_t, xdm_etc_t, xdm_etc_t) # wdm has its own config dir /etc/X11/wdm # this is ugly, daemons should not create files under /etc! manage_files_pattern(xdm_t, xdm_rw_etc_t, xdm_rw_etc_t) userdom_manage_all_user_tmp_content(xdm_t) userdom_exec_user_tmp_files(xdm_t) manage_dirs_pattern(xdm_t, xdm_tmpfs_t, xdm_tmpfs_t) manage_files_pattern(xdm_t, xdm_tmpfs_t, xdm_tmpfs_t) manage_lnk_files_pattern(xdm_t, xdm_tmpfs_t, xdm_tmpfs_t) manage_fifo_files_pattern(xdm_t, xdm_tmpfs_t, xdm_tmpfs_t) manage_sock_files_pattern(xdm_t, xdm_tmpfs_t, xdm_tmpfs_t) #fs_tmpfs_filetrans(xdm_t, xdm_tmpfs_t, file) manage_files_pattern(xdm_t, user_fonts_t, user_fonts_t) files_search_spool(xdm_t) manage_dirs_pattern(xdm_t, xdm_spool_t, xdm_spool_t) manage_files_pattern(xdm_t, xdm_spool_t, xdm_spool_t) files_spool_filetrans(xdm_t, xdm_spool_t, { file dir }) manage_dirs_pattern(xdm_t, xdm_var_lib_t, xdm_var_lib_t) manage_files_pattern(xdm_t, xdm_var_lib_t, xdm_var_lib_t) exec_files_pattern(xdm_t, xdm_var_lib_t, xdm_var_lib_t) manage_lnk_files_pattern(xdm_t, xdm_var_lib_t, xdm_var_lib_t) manage_sock_files_pattern(xdm_t, xdm_var_lib_t, xdm_var_lib_t) files_var_lib_filetrans(xdm_t, xdm_var_lib_t, { file dir }) # Read machine-id files_read_var_lib_files(xdm_t) allow xdm_t xdm_var_lib_t:dir watch_dir_perms; manage_dirs_pattern(xdm_t, xdm_var_run_t, xdm_var_run_t) manage_files_pattern(xdm_t, xdm_var_run_t, xdm_var_run_t) exec_files_pattern(xdm_t, xdm_var_run_t, xdm_var_run_t) manage_lnk_files_pattern(xdm_t, xdm_var_run_t, xdm_var_run_t) manage_fifo_files_pattern(xdm_t, xdm_var_run_t, xdm_var_run_t) manage_sock_files_pattern(xdm_t, xdm_var_run_t, xdm_var_run_t) files_pid_filetrans(xdm_t, xdm_var_run_t, { dir file fifo_file sock_file }) allow xdm_t xserver_t:process { getattr signal signull }; allow xdm_t xserver_t:unix_stream_socket connectto; allow xdm_t xserver_t:unix_dgram_socket sendto; allow xdm_t xserver_tmp_t:sock_file rw_sock_file_perms; allow xdm_t xserver_tmp_t:dir { setattr_dir_perms list_dir_perms }; # transition to the xdm xserver domtrans_pattern(xdm_t, xserver_exec_t, xserver_t) ps_process_pattern(xserver_t, xdm_t) allow xserver_t xdm_t:process signal; allow xdm_t xserver_t:process { noatsecure siginh rlimitinh signal sigkill }; allow xdm_t xserver_t:shm rw_shm_perms; read_files_pattern(xdm_t, xserver_t, xserver_t) # connect to xdm xserver over stream socket stream_connect_pattern(xdm_t, xserver_tmp_t, xserver_tmp_t, xserver_t) # Remove /tmp/.X11-unix/X0. delete_files_pattern(xdm_t, xserver_tmp_t, xserver_tmp_t) delete_sock_files_pattern(xdm_t, xserver_tmp_t, xserver_tmp_t) manage_dirs_pattern(xdm_t, xdm_log_t, xdm_log_t) manage_files_pattern(xdm_t, xdm_log_t, xdm_log_t) manage_lnk_files_pattern(xdm_t, xdm_log_t, xdm_log_t) manage_fifo_files_pattern(xdm_t, xdm_log_t, xdm_log_t) logging_log_filetrans(xdm_t, xdm_log_t, { dir file }) manage_dirs_pattern(xdm_t, xserver_log_t, xserver_log_t) manage_files_pattern(xdm_t, xserver_log_t, xserver_log_t) manage_lnk_files_pattern(xdm_t, xserver_log_t, xserver_log_t) manage_fifo_files_pattern(xdm_t, xserver_log_t, xserver_log_t) files_var_filetrans(xdm_t, xserver_log_t, dir, "gdm") allow xdm_t xserver_log_t:file map; kernel_mount_proc(xdm_t) kernel_read_system_state(xdm_t) kernel_read_device_sysctls(xdm_t) kernel_read_sysctl(xdm_t) kernel_read_fs_sysctls(xdm_t) kernel_read_kernel_sysctls(xdm_t) kernel_read_net_sysctls(xdm_t) kernel_read_network_state(xdm_t) kernel_read_vm_sysctls(xdm_t) kernel_request_load_module(xdm_t) kernel_stream_connect(xdm_t) kernel_read_key(xdm_t) kernel_view_key(xdm_t) corecmd_exec_shell(xdm_t) corecmd_exec_bin(xdm_t) corecmd_dontaudit_access_all_executables(xdm_t) corenet_all_recvfrom_netlabel(xdm_t) corenet_tcp_sendrecv_generic_if(xdm_t) corenet_udp_sendrecv_generic_if(xdm_t) corenet_tcp_sendrecv_generic_node(xdm_t) corenet_udp_sendrecv_generic_node(xdm_t) corenet_tcp_sendrecv_all_ports(xdm_t) corenet_udp_sendrecv_all_ports(xdm_t) corenet_tcp_bind_generic_node(xdm_t) corenet_udp_bind_generic_node(xdm_t) corenet_udp_bind_ipp_port(xdm_t) corenet_udp_bind_xdmcp_port(xdm_t) corenet_tcp_connect_all_ports(xdm_t) corenet_sendrecv_all_client_packets(xdm_t) # xdm tries to bind to biff_port_t corenet_dontaudit_tcp_bind_all_ports(xdm_t) dev_rwx_zero(xdm_t) dev_read_rand(xdm_t) dev_rw_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) dev_rw_apm_bios(xdm_t) dev_rw_input_dev(xdm_t) dev_setattr_apm_bios_dev(xdm_t) dev_rw_dri(xdm_t) dev_rw_agp(xdm_t) dev_rw_wireless(xdm_t) 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) dev_dontaudit_rw_misc(xdm_t) dev_read_video_dev(xdm_t) dev_write_video_dev(xdm_t) dev_setattr_video_dev(xdm_t) dev_getattr_scanner_dev(xdm_t) dev_setattr_scanner_dev(xdm_t) dev_read_sound(xdm_t) dev_write_sound(xdm_t) dev_getattr_power_mgmt_dev(xdm_t) dev_setattr_power_mgmt_dev(xdm_t) dev_getattr_null_dev(xdm_t) dev_setattr_null_dev(xdm_t) dev_getattr_loop_control(xdm_t) dev_manage_xserver_misc(xdm_t) dev_filetrans_xserver_misc(xdm_t) dev_map_xserver_misc(xdm_t) dev_remount_sysfs_fs(xdm_t) domain_use_interactive_fds(xdm_t) # Do not audit denied probes of /proc. domain_dontaudit_read_all_domains_state(xdm_t) domain_dontaudit_signal_all_domains(xdm_t) domain_dontaudit_getattr_all_entry_files(xdm_t) files_read_etc_files(xdm_t) files_read_var_files(xdm_t) files_read_etc_runtime_files(xdm_t) files_read_var_lib_symlinks(xdm_t) files_map_var_lib_files(xdm_t) files_exec_etc_files(xdm_t) files_list_mnt(xdm_t) files_watch_etc_dirs(xdm_t) files_watch_etc_files(xdm_t) files_watch_lib_dirs(xdm_t) files_watch_usr_dirs(xdm_t) files_watch_usr_files(xdm_t) files_watch_var_lib_dirs(xdm_t) files_watch_var_run_dirs(xdm_t) files_mounton_non_security(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) files_dontaudit_getattr_boot_dirs(xdm_t) files_dontaudit_write_usr_files(xdm_t) files_dontaudit_access_check_etc(xdm_t) files_dontaudit_getattr_all_dirs(xdm_t) files_dontaudit_getattr_all_symlinks(xdm_t) files_dontaudit_getattr_all_tmp_sockets(xdm_t) files_dontaudit_all_access_check(xdm_t) files_dontaudit_list_non_security(xdm_t) files_execmod_tmp(xdm_t) fs_getattr_all_fs(xdm_t) fs_search_auto_mountpoints(xdm_t) fs_search_all(xdm_t) fs_all_mount_fs_perms_tmpfs(xdm_t) fs_all_mount_fs_perms_xattr_fs(xdm_t) fs_mounton_fusefs(xdm_t) fs_dontaudit_list_noxattr_fs(xdm_t) fs_dontaudit_read_noxattr_fs_files(xdm_t) fs_manage_cgroup_dirs(xdm_t) fs_manage_cgroup_files(xdm_t) fs_getattr_nsfs_files(xdm_t) # memfd objects created by gnome-shell fs_map_tmpfs_files(xdm_t) fs_rw_tmpfs_files(xdm_t) miscfiles_watch_fonts_dirs(xdm_t) mount_read_pid_files(xdm_t) mls_socket_write_to_clearance(xdm_t) mls_trusted_object(xdm_t) # getattr needs to be allowed, see: # https://bugzilla.redhat.com/show_bug.cgi?id=1380951 # "Looks like this prevents the NVMe SSD from being properly detected by # gvfs or storaged (instead partitions on it show up as removable devices # in nautils)." storage_getattr_fixed_disk_dev(xdm_t) storage_dontaudit_read_fixed_disk(xdm_t) storage_dontaudit_write_fixed_disk(xdm_t) storage_dontaudit_setattr_fixed_disk_dev(xdm_t) storage_getattr_removable_dev(xdm_t) storage_dontaudit_raw_read_removable_device(xdm_t) storage_dontaudit_raw_write_removable_device(xdm_t) storage_dontaudit_setattr_removable_dev(xdm_t) storage_dontaudit_rw_scsi_generic(xdm_t) #storage_dontaudit_rw_fuse(xdm_t) storage_rw_fuse(xdm_t) term_mount_pty_fs(xdm_t) term_setattr_console(xdm_t) term_setattr_unallocated_ttys(xdm_t) term_use_all_terms(xdm_t) term_relabel_all_ttys(xdm_t) term_relabel_unallocated_ttys(xdm_t) term_getattr_virtio_console(xdm_t) auth_domtrans_pam_console(xdm_t) #auth_manage_pam_pid(xdm_t) auth_manage_pam_console_data(xdm_t) auth_signal_pam(xdm_t) auth_rw_faillog(xdm_t) auth_write_login_records(xdm_t) # Run telinit->init to shutdown. init_telinit(xdm_t) init_dbus_chat(xdm_t) init_pid_filetrans(xdm_t, xdm_var_run_t, dir, "multi-session-x") init_status(xdm_t) application_exec(xdm_t) libs_exec_lib_files(xdm_t) libs_exec_ldconfig(xdm_t) libs_dontaudit_setattr_lib_files(xdm_t) libs_dontaudit_setattr_lib_dirs(xdm_t) logging_read_generic_logs(xdm_t) miscfiles_search_man_pages(xdm_t) miscfiles_read_fonts(xdm_t) miscfiles_manage_fonts_cache(xdm_t) miscfiles_manage_localization(xdm_t) miscfiles_read_hwdata(xdm_t) miscfiles_map_generic_certs(xdm_t) miscfiles_read_certs(xdm_t) systemd_write_inhibit_pipes(xdm_t) systemd_dbus_chat_localed(xdm_t) systemd_dbus_chat_hostnamed(xdm_t) systemd_start_power_services(xdm_t) systemd_status_power_services(xdm_t) systemd_hwdb_mmap_config(xdm_t) systemd_hwdb_read_config(xdm_t) systemd_coredump_domtrans(xdm_t) systemd_login_watch_session_dirs(xdm_t) userdom_dontaudit_use_unpriv_user_fds(xdm_t) userdom_create_all_users_keys(xdm_t) # for .dmrc userdom_read_user_home_content_files(xdm_t) # Search /proc for any user domain processes. userdom_read_all_users_state(xdm_t) userdom_signal_all_users(xdm_t) userdom_stream_connect(xdm_t) userdom_manage_user_tmp_dirs(xdm_t) userdom_manage_user_tmp_files(xdm_t) userdom_manage_user_tmp_sockets(xdm_t) userdom_manage_tmp_role(system_r, xdm_t) userdom_mounton_tmp_sockets(xdm_t) userdom_nnp_transition_login_userdomain(xdm_t) userdom_watch_user_home_dirs(xdm_t) #userdom_home_manager(xdm_t) tunable_policy(`xdm_write_home',` userdom_user_home_dir_filetrans(xdm_t, xdm_home_t, { file lnk_file }) userdom_admin_home_dir_filetrans(xdm_t, xdm_home_t, { file lnk_file }) ',` userdom_user_home_dir_filetrans_user_home_content(xdm_t, { dir file lnk_file fifo_file sock_file }) ') tunable_policy(`use_nfs_home_dirs',` fs_list_auto_mountpoints(xdm_t) fs_manage_nfs_dirs(xdm_t) fs_manage_nfs_files(xdm_t) fs_manage_nfs_symlinks(xdm_t) fs_append_nfs_files(xdm_t) ') 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_append_cifs_files(xdm_t) ') tunable_policy(`use_fusefs_home_dirs',` fs_manage_fusefs_dirs(xdm_t) fs_manage_fusefs_files(xdm_t) fs_manage_fusefs_symlinks(xdm_t) ') tunable_policy(`use_ecryptfs_home_dirs',` fs_manage_ecryptfs_dirs(xdm_t) fs_manage_ecryptfs_files(xdm_t) ') ### filename transitions ### userdom_filetrans_generic_home_content(xdm_t) optional_policy(` alsa_read_lib(xdm_t) ') optional_policy(` dbus_exec_dbusd(xdm_t) dbus_rw_tmp_sock_files(xdm_t) dbus_stream_connect_session_bus(xdm_t) dbus_systemctl(xdm_t) dbus_watch_config(xdm_t) dbus_write_session_tmp_sock_files(xdm_t) ') optional_policy(` cups_stream_connect(xdm_t) ') optional_policy(` colord_read_lib_files(xdm_t) ') optional_policy(` dbus_read_lib_files(xdm_t) ') optional_policy(` fedoratp_domtrans(xdm_t) ') optional_policy(` gnome_data_filetrans(xserver_t, xdm_home_t, dir, "xorg") gnome_config_filetrans(xdm_t, home_cert_t, dir, "certificates") gnome_exec_atspi(xdm_t) ') optional_policy(` apache_filetrans_home_content(xdm_t) ') optional_policy(` auth_filetrans_home_content(xdm_t) ') optional_policy(` geoclue_dbus_chat(xdm_t) ') optional_policy(` gnome_filetrans_home_content(xdm_t) ') optional_policy(` gpg_filetrans_home_content(xdm_t) ') optional_policy(` irc_filetrans_home_content(xdm_t) ') optional_policy(` kerberos_filetrans_home_content(xdm_t) ') optional_policy(` mozilla_filetrans_home_content(xdm_t) ') optional_policy(` mta_filetrans_home_content(xdm_t) ') optional_policy(` pulseaudio_filetrans_home_content(xdm_t) ') optional_policy(` remotelogin_signull(xdm_t) ') optional_policy(` rpm_dbus_chat(xdm_t) ') optional_policy(` spamassassin_filetrans_home_content(xdm_t) spamassassin_filetrans_admin_home_content(xdm_t) ') optional_policy(` ssh_filetrans_admin_home_content(xdm_t) ssh_filetrans_home_content(xdm_t) ') optional_policy(` telepathy_filetrans_home_content(xdm_t) ') optional_policy(` thumb_filetrans_home_content(xdm_t) ') optional_policy(` tvtime_filetrans_home_content(xdm_t) ') optional_policy(` unconfined_server_stream_connectto(xdm_t) ') optional_policy(` virt_filetrans_home_content(xdm_t) ') ### end of filename transitions ### application_signal(xdm_t) xserver_rw_session(xdm_t, xdm_tmpfs_t) xserver_unconfined(xdm_t) xserver_domtrans_xauth(xdm_t) ifndef(`distro_redhat',` allow xdm_t self:process { execheap execmem }; ') ifdef(`distro_rhel4',` allow xdm_t self:process { execheap execmem }; ') tunable_policy(`use_nfs_home_dirs',` fs_exec_nfs_files(xdm_t) ') tunable_policy(`use_samba_home_dirs',` fs_exec_cifs_files(xdm_t) ') tunable_policy(`xdm_exec_bootloader',` bootloader_exec(xdm_t) files_read_boot_files(xdm_t) files_read_boot_symlinks(xdm_t) ') tunable_policy(`xdm_manage_bootloader',` fs_manage_dos_files(xdm_t) files_manage_boot_files(xdm_t) ') 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 xserver_t sysadm_t:shm { unix_read unix_write }; # allow xserver_t xdm_tmpfs_t:file rw_file_perms; ') tunable_policy(`xdm_bind_vnc_tcp_port',` corenet_tcp_bind_vnc_port(xdm_t) ') optional_policy(` accountsd_read_lib_files(xdm_t) accountsd_dbus_chat(xdm_t) accountsd_watch_lib(xdm_t) ') optional_policy(` acct_dontaudit_list_data(xdm_t) ') optional_policy(` boinc_dontaudit_getattr_lib(xdm_t) ') optional_policy(` alsa_domtrans(xdm_t) alsa_read_rw_config(xdm_t) ') optional_policy(` consolekit_dbus_chat(xdm_t) consolekit_read_log(xdm_t) ') optional_policy(` consoletype_exec(xdm_t) ') optional_policy(` dbus_system_bus_client(xdm_t) dbus_connect_system_bus(xdm_t) dbus_session_bus_client(xdm_t) dbus_connect_session_bus(xdm_t) optional_policy(` accountsd_dbus_chat(xdm_t) ') optional_policy(` avahi_dbus_chat(xdm_t) ') optional_policy(` bluetooth_dbus_chat(xdm_t) ') optional_policy(` cpufreqselector_dbus_chat(xdm_t) ') optional_policy(` devicekit_dbus_chat_disk(xdm_t) devicekit_dbus_chat_power(xdm_t) ') optional_policy(` gnomeclock_dbus_chat(xdm_t) ') optional_policy(` modemmanager_dbus_chat(xdm_t) ') optional_policy(` networkmanager_dbus_chat(xdm_t) ') ') optional_policy(` # Talk to the console mouse server. gpm_stream_connect(xdm_t) gpm_setattr_gpmctl(xdm_t) ') optional_policy(` gnome_stream_connect_gkeyringd(xdm_t) gnome_exec_gstreamer_home_files(xdm_t) gnome_exec_keyringd(xdm_t) gnome_delete_gkeyringd_tmp_content(xdm_t) gnome_manage_config(xdm_t) gnome_manage_gconf_home_files(xdm_t) gnome_read_config(xdm_t) gnome_read_usr_config(xdm_t) gnome_read_gconf_config(xdm_t) gnome_transition_gkeyringd(xdm_t) gnome_cache_filetrans(xdm_t, xdm_home_t, dir, "gdm") gnome_initial_setup_domtrans(xdm_t) gnome_initial_setup_filetrans_named_content(xdm_t) gnome_initial_setup_manage_var_run(xdm_t) gnome_initial_setup_noatsecure(xdm_t) gnome_initial_setup_read_state(xdm_t) ') optional_policy(` hostname_exec(xdm_t) ') optional_policy(` loadkeys_exec(xdm_t) ') optional_policy(` locallogin_signull(xdm_t) ') optional_policy(` # Do not audit attempts to check whether user root has email mta_dontaudit_getattr_spool_files(xdm_t) ') optional_policy(` policykit_dbus_chat(xdm_t) policykit_domtrans_auth(xdm_t) policykit_read_lib(xdm_t) policykit_read_reload(xdm_t) policykit_signal_auth(xdm_t) ') optional_policy(` pcscd_stream_connect(xdm_t) ') optional_policy(` plymouthd_search_spool(xdm_t) plymouthd_exec_plymouth(xdm_t) plymouthd_stream_connect(xdm_t) plymouthd_read_log(xdm_t) ') optional_policy(` pulseaudio_exec(xdm_t) pulseaudio_dbus_chat(xdm_t) pulseaudio_stream_connect(xdm_t) pulseaudio_read_state(xserver_t) ') optional_policy(` resmgr_stream_connect(xdm_t) ') optional_policy(` rhev_stream_connect_agentd(xdm_t) rhev_read_pid_files_agentd(xdm_t) ') # On crash gdm execs gdb to dump stack optional_policy(` rpm_exec(xdm_t) rpm_read_db(xdm_t) rpm_dontaudit_manage_db(xdm_t) rpm_dontaudit_dbus_chat(xdm_t) ') optional_policy(` rtkit_scheduled(xdm_t) ') optional_policy(` seutil_sigchld_newrole(xdm_t) ') optional_policy(` ssh_signull(xdm_t) ') optional_policy(` shutdown_domtrans(xdm_t) ') optional_policy(` snapper_dbus_chat(xdm_t) ') optional_policy(` sssd_read_pid_files(xdm_t) ') optional_policy(` telepathy_exec(xdm_t) ') optional_policy(` udev_read_db(xdm_t) ') optional_policy(` unconfined_signal(xdm_t) unconfined_xsession_spec_domtrans(xdm_t) ') optional_policy(` usbmuxd_stream_connect(xdm_t) ') optional_policy(` userhelper_dontaudit_search_config(xdm_t) ') optional_policy(` usermanage_read_crack_db(xdm_t) ') optional_policy(` vdagent_stream_connect(xdm_t) ') optional_policy(` wm_exec(xdm_t) ') optional_policy(` xfs_stream_connect(xdm_t) ') ######################################## # # X server local policy # # X Object Manager rules type_transition xserver_t xserver_t:x_drawable root_xdrawable_t; type_transition xserver_t xserver_t:x_colormap root_xcolormap_t; type_transition root_xdrawable_t input_xevent_t:x_event root_input_xevent_t; allow xserver_t { root_xdrawable_t x_domain }:x_drawable send; allow xserver_t xevent_type:x_event send; # setuid/setgid for the wrapper program to change UID # sys_rawio is for iopl access - should not be needed for frame-buffer # sys_admin, locking shared mem? chowning IPC message queues or semaphores? # admin of APM bios? # sys_nice is so that the X server can set a negative nice value # execheap needed until the X module loader is fixed. # NVIDIA Needs execstack allow xserver_t self:capability { sys_ptrace dac_read_search fowner fsetid setgid setuid ipc_owner sys_rawio sys_admin sys_nice sys_tty_config mknod net_bind_service }; dontaudit xserver_t self:capability chown; #allow xserver_t self:capability2 compromise_kernel; allow xserver_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem execstack execheap }; allow xserver_t self:fd use; allow xserver_t self:fifo_file rw_fifo_file_perms; allow xserver_t self:sock_file read_sock_file_perms; allow xserver_t self:shm create_shm_perms; allow xserver_t self:sem create_sem_perms; allow xserver_t self:msgq create_msgq_perms; allow xserver_t self:msg { send receive }; allow xserver_t self:unix_dgram_socket { create_socket_perms sendto }; allow xserver_t self:unix_stream_socket { create_stream_socket_perms connectto }; allow xserver_t self:tcp_socket create_stream_socket_perms; allow xserver_t self:udp_socket create_socket_perms; allow xserver_t self:netlink_selinux_socket create_socket_perms; allow xserver_t self:netlink_kobject_uevent_socket create_socket_perms; allow xserver_t { input_xevent_t input_xevent_type }:x_event send; domtrans_pattern(xserver_t, xauth_exec_t, xauth_t) allow xserver_t xauth_home_t:file read_file_perms; manage_dirs_pattern(xserver_t, xserver_tmp_t, xserver_tmp_t) manage_files_pattern(xserver_t, xserver_tmp_t, xserver_tmp_t) manage_sock_files_pattern(xserver_t, xserver_tmp_t, xserver_tmp_t) files_tmp_filetrans(xserver_t, xserver_tmp_t, { file dir sock_file }) filetrans_pattern(xserver_t, xserver_tmp_t, xserver_tmp_t, sock_file) allow xserver_t xserver_etc_t:dir list_dir_perms; read_files_pattern(xserver_t, xserver_etc_t, xserver_etc_t) read_lnk_files_pattern(xserver_t, xserver_etc_t, xserver_etc_t) manage_dirs_pattern(xserver_t, xserver_tmpfs_t, xserver_tmpfs_t) manage_files_pattern(xserver_t, xserver_tmpfs_t, xserver_tmpfs_t) manage_lnk_files_pattern(xserver_t, xserver_tmpfs_t, xserver_tmpfs_t) manage_fifo_files_pattern(xserver_t, xserver_tmpfs_t, xserver_tmpfs_t) manage_sock_files_pattern(xserver_t, xserver_tmpfs_t, xserver_tmpfs_t) fs_tmpfs_filetrans(xserver_t, xserver_tmpfs_t, { dir file lnk_file sock_file fifo_file }) allow xserver_t xserver_tmpfs_t:file map; manage_files_pattern(xserver_t, xkb_var_lib_t, xkb_var_lib_t) manage_lnk_files_pattern(xserver_t, xkb_var_lib_t, xkb_var_lib_t) files_search_var_lib(xserver_t) manage_dirs_pattern(xserver_t, xserver_var_lib_t, xserver_var_lib_t) manage_files_pattern(xserver_t, xserver_var_lib_t, xserver_var_lib_t) files_var_lib_filetrans(xserver_t, xserver_var_lib_t, dir) manage_dirs_pattern(xserver_t, xserver_var_run_t, xserver_var_run_t) manage_files_pattern(xserver_t, xserver_var_run_t, xserver_var_run_t) manage_sock_files_pattern(xserver_t, xdm_var_run_t, xdm_var_run_t) files_pid_filetrans(xserver_t, xserver_var_run_t, { file dir }) # Create files in /var/log with the xserver_log_t type. manage_files_pattern(xserver_t, xserver_log_t, xserver_log_t) logging_log_filetrans(xserver_t, xserver_log_t, file) manage_files_pattern(xserver_t, xdm_log_t, xdm_log_t) manage_dirs_pattern(xserver_t, xdm_home_t, xdm_home_t) manage_files_pattern(xserver_t, xdm_home_t, xdm_home_t) manage_lnk_files_pattern(xserver_t, xdm_home_t, xdm_home_t) kernel_read_system_state(xserver_t) kernel_read_device_sysctls(xserver_t) # Xorg wants to check if kernel is tainted kernel_read_kernel_sysctls(xserver_t) kernel_write_proc_files(xserver_t) kernel_request_load_module(xserver_t) # Run helper programs in xserver_t. corecmd_exec_bin(xserver_t) corecmd_exec_shell(xserver_t) corenet_all_recvfrom_netlabel(xserver_t) corenet_tcp_sendrecv_generic_if(xserver_t) corenet_udp_sendrecv_generic_if(xserver_t) corenet_tcp_sendrecv_generic_node(xserver_t) corenet_udp_sendrecv_generic_node(xserver_t) corenet_tcp_sendrecv_all_ports(xserver_t) corenet_udp_sendrecv_all_ports(xserver_t) corenet_tcp_bind_generic_node(xserver_t) corenet_tcp_bind_xserver_port(xserver_t) corenet_tcp_connect_all_ports(xserver_t) corenet_sendrecv_xserver_server_packets(xserver_t) corenet_sendrecv_all_client_packets(xserver_t) dev_rw_sysfs(xserver_t) dev_rw_mouse(xserver_t) dev_rw_mtrr(xserver_t) dev_rw_apm_bios(xserver_t) dev_rw_agp(xserver_t) dev_rw_framebuffer(xserver_t) dev_manage_dri_dev(xserver_t) dev_map_dri(xserver_t) dev_create_generic_dirs(xserver_t) dev_setattr_generic_dirs(xserver_t) # raw memory access is needed if not using the frame buffer dev_read_raw_memory(xserver_t) dev_wx_raw_memory(xserver_t) dev_read_urand(xserver_t) # for other device nodes such as the NVidia binary-only driver dev_manage_xserver_misc(xserver_t) dev_filetrans_xserver_misc(xserver_t) # read events - the synaptics touchpad driver reads raw events dev_rw_input_dev(xserver_t) dev_write_raw_memory(xserver_t) dev_rwx_zero(xserver_t) domain_dontaudit_read_all_domains_state(xserver_t) domain_signal_all_domains(xserver_t) files_read_etc_files(xserver_t) files_read_etc_runtime_files(xserver_t) files_read_usr_files(xserver_t) files_rw_tmpfs_files(xserver_t) # brought on by rhgb files_search_mnt(xserver_t) # for nscd files_dontaudit_search_pids(xserver_t) fs_getattr_xattr_fs(xserver_t) fs_search_nfs(xserver_t) fs_search_auto_mountpoints(xserver_t) mls_file_read_to_clearance(xserver_t) mls_file_write_all_levels(xserver_t) mls_file_upgrade(xserver_t) mls_process_write_to_clearance(xserver_t) mls_socket_read_to_clearance(xserver_t) mls_sysvipc_read_to_clearance(xserver_t) mls_sysvipc_write_to_clearance(xserver_t) mls_trusted_object(xserver_t) mls_xwin_read_to_clearance(xserver_t) selinux_validate_context(xserver_t) selinux_compute_access_vector(xserver_t) selinux_compute_create_context(xserver_t) auth_use_nsswitch(xserver_t) init_getpgid(xserver_t) init_abstract_socket_activation(xserver_t) term_setattr_unallocated_ttys(xserver_t) term_use_unallocated_ttys(xserver_t) locallogin_use_fds(xserver_t) logging_send_syslog_msg(xserver_t) logging_send_audit_msgs(xserver_t) miscfiles_read_fonts(xserver_t) miscfiles_read_hwdata(xserver_t) # read x_contexts seutil_read_default_contexts(xserver_t) seutil_read_config(xserver_t) seutil_read_file_contexts(xserver_t) userdom_search_user_home_dirs(xserver_t) userdom_use_user_ttys(xserver_t) userdom_setattr_user_ttys(xserver_t) userdom_read_user_tmp_files(xserver_t) userdom_rw_user_tmpfs_files(xserver_t) userdom_map_tmp_files(xserver_t) ifndef(`distro_redhat',` allow xserver_t self:process { execmem execheap execstack }; domain_mmap_low_uncond(xserver_t) ') ifdef(`distro_rhel4',` allow xserver_t self:process { execmem execheap execstack }; ') ifdef(`enable_mls',` range_transition xserver_t xserver_tmp_t:sock_file s0 - mls_systemhigh; range_transition xserver_t xserver_t:x_drawable s0 - mls_systemhigh; ') tunable_policy(`!xserver_object_manager',` # should be xserver_unconfined(xserver_t), # but typeattribute doesnt work in conditionals allow xserver_t xserver_t:x_server *; allow xserver_t { x_domain root_xdrawable_t }:x_drawable *; allow xserver_t xserver_t:x_screen *; allow xserver_t x_domain:x_gc *; allow xserver_t { x_domain root_xcolormap_t }:x_colormap *; allow xserver_t xproperty_type:x_property *; allow xserver_t xselection_type:x_selection *; allow xserver_t x_domain:x_cursor *; allow xserver_t x_domain:x_client *; allow xserver_t { x_domain xserver_t }:x_device *; allow xserver_t { x_domain xserver_t }:x_pointer *; allow xserver_t { x_domain xserver_t }:x_keyboard *; allow xserver_t xextension_type:x_extension *; allow xserver_t { x_domain xserver_t }:x_resource *; allow xserver_t xevent_type:{ x_event x_synthetic_event } *; ') optional_policy(` apm_stream_connect(xserver_t) ') optional_policy(` auth_search_pam_console_data(xserver_t) ') optional_policy(` consolekit_read_state(xserver_t) ') optional_policy(` devicekit_signal_power(xserver_t) ') optional_policy(` getty_use_fds(xserver_t) ') optional_policy(` modutils_domtrans_kmod(xserver_t) ') optional_policy(` rhgb_getpgid(xserver_t) rhgb_signal(xserver_t) ') optional_policy(` setrans_translate_context(xserver_t) ') optional_policy(` sandbox_rw_xserver_tmpfs_files(xserver_t) ') optional_policy(` tcpd_wrapped_domain(xserver_t, xserver_exec_t) ') optional_policy(` mozilla_plugin_read_state(xserver_t) mozilla_plugin_rw_tmp_files(xserver_t) mozilla_plugin_rw_tmpfs_files(xserver_t) ') optional_policy(` policykit_dbus_chat(xserver_t) ') optional_policy(` udev_read_db(xserver_t) ') optional_policy(` unconfined_domain(xserver_t) ') optional_policy(` userhelper_search_config(xserver_t) ') optional_policy(` wine_rw_shm(xserver_t) ') optional_policy(` xfs_stream_connect(xserver_t) ') ######################################## # # XDM Xserver local policy # # cjp: when xdm is configurable via tunable these # rules will be enabled only when xdm is enabled allow xserver_t xdm_t:process { signal getpgid }; allow xserver_t xdm_t:shm rw_shm_perms; # NB we do NOT allow xserver_t xdm_var_lib_t:dir, only access to an open # handle of a file inside the dir!!! allow xserver_t xdm_var_lib_t:file read_file_perms; dontaudit xserver_t xdm_var_lib_t:dir search_dir_perms; read_files_pattern(xserver_t, xdm_var_run_t, xdm_var_run_t) # Label pid and temporary files with derived types. userdom_manage_user_tmp_files(xserver_t) userdom_manage_user_tmp_sockets(xserver_t) # Run xkbcomp. allow xserver_t xkb_var_lib_t:lnk_file read_lnk_file_perms; can_exec(xserver_t, xkb_var_lib_t) # VNC v4 module in X server corenet_tcp_bind_vnc_port(xserver_t) init_use_fds(xserver_t) # FIXME: After per user fonts are properly working # xserver_t may no longer have any reason # to read ROLE_home_t - examine this in more detail # (xauth?) userdom_read_user_home_content_files(xserver_t) userdom_read_all_users_state(xserver_t) userdom_home_manager(xserver_t) xserver_use_user_fonts(xserver_t) optional_policy(` dbus_system_bus_client(xserver_t) ') optional_policy(` mono_rw_shm(xserver_t) ') optional_policy(` rhgb_rw_shm(xserver_t) rhgb_rw_tmpfs_files(xserver_t) ') ######################################## # # Rules common to all X window domains # # Hacks # everyone can do override-redirect windows. # this could be used to spoof labels allow x_domain self:x_drawable override; # firefox gets nosy with other people's windows allow x_domain x_domain:x_drawable { list_child receive }; # X Server # can get X server attributes allow x_domain xserver_t:x_server getattr; # can grab the server allow x_domain xserver_t:x_server grab; # can read and write server-owned generic resources allow x_domain xserver_t:x_resource { read write }; # can mess with own clients allow x_domain self:x_client { getattr manage destroy }; # X Protocol Extensions allow x_domain xextension_t:x_extension { query use }; allow x_domain security_xextension_t:x_extension { query use }; # X Properties # can change properties of root window allow x_domain root_xdrawable_t:x_drawable { list_property get_property set_property }; # can change properties of my own windows allow x_domain self:x_drawable { list_property get_property set_property }; # can read and write cut buffers allow x_domain clipboard_xproperty_t:x_property { create read write append }; # can read security labels allow x_domain seclabel_xproperty_t:x_property { getattr read }; # can change all other properties allow x_domain xproperty_t:x_property { getattr create read write append destroy }; # X Windows # operations allowed on root windows allow x_domain root_xdrawable_t:x_drawable { getattr setattr list_child add_child remove_child send receive hide show }; # operations allowed on my windows allow x_domain self:x_drawable { create destroy getattr setattr read write show hide list_child add_child remove_child manage send receive }; allow x_domain self:x_drawable blend; # operations allowed on all windows allow x_domain x_domain:x_drawable { getattr get_property set_property remove_child }; # X Colormaps # can use the default colormap allow x_domain root_xcolormap_t:x_colormap { read use add_color remove_color install uninstall }; # can create and use colormaps allow x_domain self:x_colormap *; # X Devices # operations allowed on my own devices allow x_domain self:{ x_device x_pointer x_keyboard } *; # operations allowed on generic devices allow x_domain xserver_t:x_device { use getattr setattr getfocus setfocus bell grab freeze force_cursor }; # operations allowed on core keyboard allow x_domain xserver_t:x_keyboard { use getattr setattr getfocus setfocus bell grab }; # operations allowed on core pointer allow x_domain xserver_t:x_pointer { read use getattr setattr getfocus setfocus bell grab freeze force_cursor }; # all devices can generate input events allow x_domain root_xdrawable_t:x_drawable send; allow x_domain x_domain:x_drawable send; allow x_domain input_xevent_t:x_event send; # dontaudit keyloggers repeatedly polling #dontaudit x_domain xserver_t:x_keyboard read; # X Input # can receive default events allow x_domain xevent_t:{ x_event x_synthetic_event } receive; # can receive ICCCM events allow x_domain client_xevent_t:{ x_event x_synthetic_event } receive; # can send ICCCM events to the root window allow x_domain client_xevent_t:x_synthetic_event send; # can receive root window input events allow x_domain root_input_xevent_t:x_event receive; # X Selections # can use the clipboard allow x_domain clipboard_xselection_t:x_selection { getattr setattr read }; # can use default selections allow x_domain xselection_t:x_selection { getattr setattr read }; # Other X Objects # can create and use cursors allow x_domain self:x_cursor *; # can create and use graphics contexts allow x_domain self:x_gc *; # can read and write own objects allow x_domain self:x_resource { read write }; # can mess with the screensaver allow x_domain xserver_t:x_screen { getattr saver_getattr }; # Device rules allow x_domain xserver_t:x_device { read getattr use setattr setfocus grab bell }; allow x_domain xserver_t:x_screen getattr; ######################################## # # Rules for unconfined access to this module # allow xserver_unconfined_type xserver_t:x_server *; allow xserver_unconfined_type xdrawable_type:x_drawable *; allow xserver_unconfined_type xserver_t:x_screen *; allow xserver_unconfined_type x_domain:x_gc *; allow xserver_unconfined_type xcolormap_type:x_colormap *; allow xserver_unconfined_type xproperty_type:x_property *; allow xserver_unconfined_type xselection_type:x_selection *; allow xserver_unconfined_type x_domain:x_cursor *; allow xserver_unconfined_type x_domain:x_client *; allow xserver_unconfined_type { x_domain xserver_t }:x_device *; allow xserver_unconfined_type { x_domain xserver_t }:x_pointer *; allow xserver_unconfined_type { x_domain xserver_t }:x_keyboard *; allow xserver_unconfined_type xextension_type:x_extension *; allow xserver_unconfined_type { x_domain xserver_t }:x_resource *; allow xserver_unconfined_type xevent_type:{ x_event x_synthetic_event } *; tunable_policy(`! xserver_object_manager',` # should be xserver_unconfined(x_domain), # but typeattribute doesnt work in conditionals allow x_domain xserver_t:x_server *; allow x_domain xdrawable_type:x_drawable *; allow x_domain xserver_t:x_screen *; allow x_domain x_domain:x_gc *; allow x_domain xcolormap_type:x_colormap *; allow x_domain xproperty_type:x_property *; allow x_domain xselection_type:x_selection *; allow x_domain x_domain:x_cursor *; allow x_domain x_domain:x_client *; allow x_domain { x_domain xserver_t }:x_device *; allow x_domain { x_domain xserver_t }:x_pointer *; allow x_domain { x_domain xserver_t }:x_keyboard *; allow x_domain xextension_type:x_extension *; allow x_domain { x_domain xserver_t }:x_resource *; allow x_domain xevent_type:{ x_event x_synthetic_event } *; ') tunable_policy(`xserver_execmem',` allow xserver_t self:process { execheap execmem execstack }; ') # Hack to handle the problem of using the nvidia blobs tunable_policy(`deny_execmem',`',` allow xdm_t self:process execmem; ') tunable_policy(`selinuxuser_execstack',` allow xdm_t self:process { execstack execmem }; ') tunable_policy(`use_nfs_home_dirs',` fs_append_nfs_files(xdmhomewriter) ') optional_policy(` unconfined_rw_shm(xserver_t) # xserver signals unconfined user on startx unconfined_signal(xserver_t) unconfined_getpgid(xserver_t) ') allow xdm_t xdm_unconfined_exec_t:dir search_dir_perms; can_exec(xdm_t, xdm_unconfined_exec_t) optional_policy(` type xdm_unconfined_t; domain_type(xdm_unconfined_t) domain_entry_file(xdm_unconfined_t, xdm_unconfined_exec_t) role system_r types xdm_unconfined_t; domtrans_pattern(xdm_t, xdm_unconfined_exec_t, xdm_unconfined_t) unconfined_domain(xdm_unconfined_t) ') # X Userdomain # Xserver read/write client shm allow xserver_t x_userdomain:fd use; allow xserver_t x_userdomain:shm rw_shm_perms; allow xserver_t x_userdomain:process { getpgid signal }; allow xserver_t x_userdomain:shm rw_shm_perms; allow x_userdomain xserver_t:unix_dgram_socket sendto; allow x_userdomain user_fonts_t:dir list_dir_perms; allow x_userdomain user_fonts_t:file read_file_perms; allow x_userdomain user_fonts_t:lnk_file read_lnk_file_perms; allow x_userdomain user_fonts_config_t:dir list_dir_perms; allow x_userdomain user_fonts_config_t:file read_file_perms; manage_dirs_pattern(x_userdomain, user_fonts_cache_t, user_fonts_cache_t) manage_files_pattern(x_userdomain, user_fonts_cache_t, user_fonts_cache_t) stream_connect_pattern(x_userdomain, xserver_tmp_t, xserver_tmp_t, xserver_t) allow x_userdomain xserver_tmp_t:sock_file delete_sock_file_perms; files_search_tmp(x_userdomain) # Communicate via System V shared memory. allow x_userdomain xserver_t:shm r_shm_perms; allow x_userdomain xserver_tmpfs_t:file { read_file_perms map }; # allow ps to show iceauth ps_process_pattern(x_userdomain, iceauth_t) domtrans_pattern(x_userdomain, iceauth_exec_t, iceauth_t) allow x_userdomain iceauth_home_t:file read_file_perms; domtrans_pattern(x_userdomain, xauth_exec_t, xauth_t) allow x_userdomain xauth_t:process signal; # allow ps to show xauth ps_process_pattern(x_userdomain, xauth_t) allow x_userdomain xserver_t:process signal; allow x_userdomain xauth_home_t:file read_file_perms; # for when /tmp/.X11-unix is created by the system allow x_userdomain xdm_t:fd use; allow x_userdomain xdm_t:fifo_file rw_inherited_fifo_file_perms; userdom_search_user_tmp_dirs(x_userdomain) userdom_rw_user_tmp_sock_files(x_userdomain) dontaudit x_userdomain xdm_t:tcp_socket { read write }; allow x_userdomain xdm_t:dbus send_msg; allow xdm_t x_userdomain:dbus send_msg; # Client read xserver shm allow x_userdomain xserver_t:fd use; allow x_userdomain xserver_tmpfs_t:file read_file_perms; # Read /tmp/.X0-lock allow x_userdomain xserver_tmp_t:file read_inherited_file_perms; allow xdm_t x_userdomain:system { status reload }; clock_read_adjtime(x_userdomain) dev_rw_xserver_misc(x_userdomain) dev_rw_power_management(x_userdomain) dev_read_input(x_userdomain) dev_read_misc(x_userdomain) dev_write_misc(x_userdomain) # open office is looking for the following dev_getattr_agp_dev(x_userdomain) # GNOME checks for usb and other devices: dev_rw_usbfs(x_userdomain) # mmap generic SSL certificates miscfiles_map_generic_certs(x_userdomain) miscfiles_read_fonts(x_userdomain) miscfiles_setattr_fonts_cache_dirs(x_userdomain) miscfiles_read_hwdata(x_userdomain) #xserver_common_x_domain_template(user, x_userdomain) #xserver_domtrans(x_userdomain) #xserver_unconfined(x_userdomain) #xserver_xsession_entry_type(x_userdomain) xserver_dontaudit_write_log(x_userdomain) #xserver_stream_connect_xdm(x_userdomain) # certain apps want to read xdm.pid file xserver_read_xdm_pid(x_userdomain) # gnome-session creates socket under /tmp/.ICE-unix/ xserver_create_xdm_tmp_sockets(x_userdomain) # Needed for escd, remove if we get escd policy xserver_manage_xdm_tmp_files(x_userdomain) xserver_read_xdm_etc_files(x_userdomain) #xserver_xdm_append_log(x_userdomain) xserver_rw_session(x_userdomain,xserver_tmpfs_t) term_use_virtio_console(x_userdomain) # Client write xserver shm tunable_policy(`xserver_clients_write_xshm',` allow x_userdomain xserver_t:shm rw_shm_perms; allow x_userdomain xserver_tmpfs_t:file rw_file_perms; ') optional_policy(` boltd_dbus_chat(x_userdomain) ') optional_policy(` gnome_read_gconf_config(x_userdomain) ') optional_policy(` pulseaudio_stream_connect(x_userdomain) ') optional_policy(` thumb_nnp_domtrans(x_userdomain) ') optional_policy(` timedatex_dbus_chat(x_userdomain) ') tunable_policy(`selinuxuser_direct_dri_enabled',` dev_rw_dri(dridomain) ',` dev_dontaudit_rw_dri(dridomain) ')