updated patches
Here are the updated versions of my patches, a bit later than I had hoped, sorry for that.
xdm.diff contains the updated xdm policy. I took what Russell posted and modified it so that it works with my patched wdm.
games.diff is the updates games policy, using userdomain now.
misc.diff contains a few minor changes I made. Lilo wants to read the locale files, there's my apm/acpid changes in there, and a minor touch on fcron.
These policy changes run on my notebook in enforcing mode, and everything looks happy so far.
Signature · 3 lines
http://web.lemuria.org/pubkey.html pub 1024D/2D7A04F5 2002-05-16 Tom Vogt <[email protected]> Key fingerprint = C731 64D1 4BCF 4C20 48A4 29B2 BF01 9FA1 2D7A 04F5
domains/program/xdm.te +32 -8
@@ -1,6 +1,9 @@ #DESC XDM - X Display Manager # # Authors: Mark Westerman [email protected] +# Russell Coker <[email protected]> +# +# Some wdm-specific changes by Tom Vogt <[email protected]> # # Some alterations and documentation by Stephen Smalley <[email protected]> #
@@ -11,19 +14,24 @@ # # xdm_t is the domain of a X Display Manager process # spawned by getty. -# xdm_exec_t is the type of the [xgk]dm program +# xdm_exec_t is the type of the [xgkw]dm program # daemon_domain(xdm, `, privuser, privrole, auth, privowner, privmem') # for running xdm from init domain_auto_trans(init_t, xdm_exec_t, xdm_t) +# for xdmctl +allow xdm_t xdm_var_run_t:fifo_file create_file_perms; + tmp_domain(xdm) var_lib_domain(xdm) -# NB we do NOT allow xdm_xserver_t xdm_var_lib_t:dir!!! +# 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; type xsession_exec_t, file_type, sysadmfile, exec_type; +type etc_xdm_t, file_type, sysadmfile; allow xdm_t default_context_t:file { read getattr };
@@ -35,13 +43,17 @@ # for reboot allow xdm_t initctl_t:fifo_file write; +# init script wants to check if it needs to update windowmanagerlist +allow initrc_t etc_xdm_t:file { getattr read }; + # # Use capabilities. allow xdm_t self:capability { setgid setuid sys_resource kill }; # Use /dev/mem. -# Commented out by default. +# Commented out by default. Needed if you can not use the framebuffer #allow xdm_t memory_device_t:chr_file { execute read write }; +allow xdm_xserver_t memory_device_t:chr_file { read write }; allow xdm_t random_device_t:chr_file { getattr read };
@@ -70,8 +82,9 @@ allow xdm_t xserver_var_log_t:file create_file_perms; +allow xdm_t self:shm create_shm_perms; allow userdomain xdm_xserver_t:unix_stream_socket connectto; -allow userdomain xdm_xserver_t:shm { read unix_read getattr associate }; +allow userdomain xdm_xserver_t:shm r_shm_perms; allow userdomain xdm_xserver_t:fd use; allow userdomain xdm_xserver_tmpfs_t:file read; allow xdm_xserver_t userdomain:shm { unix_read unix_write read write };
@@ -88,7 +101,7 @@ allow xdm_t lastlog_t:file rw_file_perms; # Ask the security server for SIDs for user sessions. -allow xdm_t security_t:security { get_user_sids context_to_sid }; +allow xdm_t security_t:security { get_user_sids context_to_sid sid_to_context }; # Access the shared memory pseudo file system. # Should really define a derived type for this.
@@ -102,8 +115,8 @@ allow xdm_t var_lock_t:file { create write unlink }; # Connect to xfs. -ifdef(`xfs.te', -`allow xdm_t xfs_tmp_t:dir { search }; +ifdef(`xfs.te', ` +allow xdm_t xfs_tmp_t:dir { search }; allow xdm_t xfs_tmp_t:sock_file { write }; can_unix_connect(xdm_t, xfs_t)')
@@ -111,6 +124,11 @@ allow xdm_t etc_t:lnk_file read; allow xdm_t etc_runtime_t:file { getattr read }; +# wdm has its own config dir /etc/X11/wdm +file_type_auto_trans(xdm_t, etc_t, etc_xdm_t, file); +allow xdm_t etc_xdm_t:dir r_dir_perms; +allow xdm_t etc_xdm_t:file r_file_perms; + # Signal any user domain. allow xdm_t userdomain:process signal_perms;
@@ -143,10 +161,16 @@ dontaudit xdm_t sysadm_home_dir_t:dir { getattr search }; # Do not audit user access to the X log files due to file handle inheritance -dontaudit unpriv_userdomain xserver_var_log_t:file append; +dontaudit unpriv_userdomain xserver_var_log_t:file { write append }; # Access sound device. allow xdm_t sound_device_t:chr_file { setattr getattr }; +# Login necessities and dontaudits +allow userdomain etc_xdm_t:dir { search }; +dontaudit userdomain initrc_t:fd { use }; +dontaudit userdomain xdm_var_lib_t:file { read write }; + # Run the X server in a derived domain. xserver_domain(xdm) +
domains/program/xserver.te +6 -0
@@ -34,3 +34,9 @@ # Everything else is in the xserver_domain macro in # macros/program/xserver_macros.te. +ifdef(`xdm.te',` +# XFree86-4 wants to check if kernel is tainted +allow xdm_xserver_t sysctl_kernel_t:dir { search }; +allow xdm_xserver_t sysctl_kernel_t:file { getattr read }; +allow xdm_xserver_t sysctl_t:dir { search }; +')
file_contexts/program/xdm.fc +12 -4
@@ -1,11 +1,19 @@ # X Display Manager -/usr/bin/[xgk]dm system_u:object_r:xdm_exec_t +/usr/bin/[xgkw]dm system_u:object_r:xdm_exec_t +/usr/X11R6/bin/[xgkw]dm system_u:object_r:xdm_exec_t +/usr/X11R6/bin/wdmLogin system_u:object_r:xdm_exec_t /usr/bin/gpe-dm system_u:object_r:xdm_exec_t -/var/[xgk]dm(/.*)? system_u:object_r:xserver_var_log_t -/usr/var/[xgk]dm(/.*)? system_u:object_r:xserver_var_log_t -/var/log/kdm\.log system_u:object_r:xserver_var_log_t +/usr/sbin/update_wdm_wmlist system_u:object_r:xdm_exec_t +/var/[xgkw]dm(/.*)? system_u:object_r:xserver_var_log_t +/usr/var/[xgkw]dm(/.*)? system_u:object_r:xserver_var_log_t +/var/log/[xgkw]dm\.log system_u:object_r:xserver_var_log_t /tmp/\.X11-unix(/.*)? system_u:object_r:initrc_xserver_tmp_t /tmp/\.X0-lock system_u:object_r:xdm_tmp_t /etc/X11/Xsession[^/]* -- system_u:object_r:xsession_exec_t +/etc/X11/wdm(/.*)? system_u:object_r:etc_xdm_t +/etc/X11/wdm/Xsetup(_0)? system_u:object_r:xsession_exec_t +/etc/X11/wdm/Xstartup(_0)? system_u:object_r:xsession_exec_t +/etc/X11/wdm/Xreset(_0)? system_u:object_r:xsession_exec_t +/etc/X11/wdm/Xsession system_u:object_r:xsession_exec_t /var/run/xdmctl system_u:object_r:xdm_var_run_t /var/lib/kdm(/.*)? system_u:object_r:xdm_var_lib_t
file_contexts/types.fc +1 -1
@@ -229,7 +229,7 @@ /usr/lib/gconv/.*\.so system_u:object_r:shlib_t /usr/share/guile/g-wrapped/.*\.so system_u:object_r:shlib_t /usr/share/selinux(/.*)? system_u:object_r:policy_src_t -/usr/games(/.*)? system_u:object_r:bin_t +#/usr/games(/.*)? system_u:object_r:bin_t # # /usr/.*glibc.*-linux/lib
domains/program/games.te +27 -0
@@ -2,6 +2,8 @@ # # Author: Russell Coker <[email protected]> # +# Changes by Tom Vogt <[email protected]> +# # type for shared data from games type games_data_t, file_type, sysadmfile;
@@ -14,3 +16,28 @@ # Everything else is in the x_client_domain macro in # macros/program/x_client_macros.te. + +# games_t also used for games installed on the system, run by the user, +# so holes in them won't compromise the user session +allow userdomain games_data_t:file r_file_perms; +allow userdomain games_data_t:dir r_dir_perms; + +# Game data stored in user home dirs +type games_usrdata_t, file_type, sysadmfile; +allow user_games_t user_home_t:dir { search }; +file_type_auto_trans(user_games_t, user_home_t, games_usrdata_t); +# +# Allow users to read and write these files +# If we want to prevent cheating, we could take away the write +# permissions. :) +allow userdomain games_usrdata_t:file create_file_perms; +allow userdomain games_usrdata_t:dir create_dir_perms; + +# Various access attempts to devices. Many games work just fine without, +# but if yours does not, try to comment these out and look for which ones +# it needs: +dontaudit user_games_t device_t:chr_file { getattr }; +dontaudit user_games_t fixed_disk_device_t:blk_file { getattr }; +dontaudit user_games_t removable_device_t:blk_file { getattr }; +dontaudit user_games_t removable_device_t:lnk_file { read }; +
file_contexts/program/games.fc +12 -2
@@ -1,5 +1,15 @@ -# netscape/mozilla -/usr/games/.* system_u:object_r:games_exec_t +# games installed on the system +# Most games installed in /usr/local/games don't follow FHS conventions and +# drop the binaries in with the data - therefore, you must relabel the +# binaries to system_u:object_r:games_exec_t manually! +/usr/games(/.*)? system_u:object_r:games_data_t +/usr/local/games(/.*)? system_u:object_r:games_data_t /usr/lib/games/.* -- system_u:object_r:games_exec_t /var/games(/.*)? system_u:object_r:games_data_t /usr/bin/micq system_u:object_r:games_exec_t +# +# Some examples +# Majesty (Fantasy RTS) +/usr/local/games/majesty/majesty system_u:object_r:games_exec_t +/usr/local/games/majesty/majx system_u:object_r:games_exec_t +/usr/local/games/majesty/netmodules/libtcp_ip.so system_u:object_r:games_exec_t
file_contexts/types.fc +1 -1
@@ -229,7 +229,7 @@ /usr/lib/gconv/.*\.so system_u:object_r:shlib_t /usr/share/guile/g-wrapped/.*\.so system_u:object_r:shlib_t /usr/share/selinux(/.*)? system_u:object_r:policy_src_t -/usr/games(/.*)? system_u:object_r:bin_t +#/usr/games(/.*)? system_u:object_r:bin_t # # /usr/.*glibc.*-linux/lib
domains/program/apmd.te +6 -0
@@ -34,6 +34,12 @@ allow apmd_t { etc_runtime_t modules_conf_t }:file { getattr read }; allow apmd_t etc_t:lnk_file read; +# acpid wants a socket +allow apmd_t var_run_t:sock_file create_file_perms; + +# acpid also has a logfile +log_domain(apmd) + # for id allow apmd_t security_t:security sid_to_context;
domains/program/bootloader.te +6 -0
@@ -107,3 +107,9 @@ allow bootloader_t policy_config_t:dir { search read }; allow bootloader_t policy_config_t:file read; + +# Locals +allow bootloader_t locale_t:dir { search }; +allow bootloader_t locale_t:file { read }; +allow bootloader_t locale_t:lnk_file { read }; +
file_contexts/program/apmd.fc +3 -0
@@ -1,4 +1,7 @@ # apmd /usr/sbin/apmd system_u:object_r:apmd_exec_t +/usr/sbin/acpid system_u:object_r:apmd_exec_t /usr/bin/apm system_u:object_r:apm_exec_t /var/run/apmd\.pid system_u:object_r:apmd_var_run_t +/var/run/.acpid.socket system_u:object_r:apmd_var_run_t +
file_contexts/program/crond.fc +1 -0
@@ -17,5 +17,6 @@ /var/spool/fcron/.* <<none>> /var/spool/fcron/systab.orig system_u:object_r:sysadm_cron_spool_t /var/spool/fcron/systab system_u:object_r:sysadm_cron_spool_t +/var/spool/fcron/new.systab system_u:object_r:sysadm_cron_spool_t /var/run/fcron\.fifo system_u:object_r:crond_var_run_t /var/run/fcron\.pid system_u:object_r:crond_var_run_t