]> git.ipfire.org Git - people/stevee/selinux-policy.git/commitdiff
add rhgb
authorChris PeBenito <cpebenito@tresys.com>
Thu, 9 Mar 2006 19:02:29 +0000 (19:02 +0000)
committerChris PeBenito <cpebenito@tresys.com>
Thu, 9 Mar 2006 19:02:29 +0000 (19:02 +0000)
12 files changed:
refpolicy/Changelog
refpolicy/policy/modules/admin/firstboot.if
refpolicy/policy/modules/kernel/filesystem.if
refpolicy/policy/modules/services/rhgb.fc [new file with mode: 0644]
refpolicy/policy/modules/services/rhgb.if [new file with mode: 0644]
refpolicy/policy/modules/services/rhgb.te [new file with mode: 0644]
refpolicy/policy/modules/services/xserver.if
refpolicy/policy/modules/services/xserver.te
refpolicy/policy/modules/system/fstools.te
refpolicy/policy/modules/system/init.te
refpolicy/policy/modules/system/modutils.te
refpolicy/policy/modules/system/mount.te

index 59c2a64e294b42ef4e8f5ac8750e2e2a9965a1e1..b96d3b2f545d42f701f318bb37cb33bbe1a86543 100644 (file)
@@ -3,6 +3,7 @@
        apt (Erich Schubert)
        clamav (Erich Schubert)
        dpkg (Erich Schubert)
+       rhgb
        thunderbird
        tor (Erich Schubert)
 
index 42144562f22dceb12f8416c52fac6b4fcef1f89a..ceb05800540d8bbd2a90d7145d117084eba1f3c1 100644 (file)
@@ -111,3 +111,20 @@ interface(`firstboot_write_pipes',`
 
        allow $1 firstboot_t:fifo_file write;
 ')
+########################################
+## <summary>
+##     Read firstboot writable config files.
+## </summary>
+## <param name="domain">
+##     <summary>
+##     The type of the process performing this action.
+##     </summary>
+## </param>
+#
+interface(`firstboot_read_rw_files',`
+       gen_require(`
+               type firstboot_rw_t;
+       ')
+
+       allow $1 firstboot_rw_t:file r_file_perms;
+')
index d7b2f862a7d2698e17e07b32e33a6bd2b5a4c8e8..a2a105ac491d9f55f64f9bd562ed23c56d02d1f3 100644 (file)
@@ -1960,7 +1960,7 @@ interface(`fs_search_ramfs',`
                type ramfs_t;
        ')
 
-       allow $1 ramfs_t:dir search;
+       allow $1 ramfs_t:dir search_dir_perms;
 ')
 
 ########################################
@@ -2017,6 +2017,26 @@ interface(`fs_dontaudit_read_ramfs_pipes',`
        dontaudit $1 ramfs_t:fifo_file read;
 ')
 
+########################################
+## <summary>
+##     Create, read, write, and delete
+##     files on a ramfs filesystem.
+## </summary>
+## <param name="domain">
+##     <summary>
+##     Domain allowed access.
+##     </summary>
+## </param>
+#
+interface(`fs_manage_ramfs_files',`
+       gen_require(`
+               type ramfs_t;
+       ')
+
+       allow $1 ramfs_t:dir rw_dir_perms;
+       allow $1 ramfs_t:file manage_file_perms;
+')
+
 ########################################
 ## <summary>
 ##     Write to named pipe on a ramfs filesystem.
@@ -2032,9 +2052,29 @@ interface(`fs_write_ramfs_pipes',`
                type ramfs_t;
        ')
 
+       allow $1 ramfs_t:dir search_dir_perms;
        allow $1 ramfs_t:fifo_file write;
 ')
 
+########################################
+## <summary>
+##     Do not audit attempts to write to named 
+##     pipes on a ramfs filesystem.
+## </summary>
+## <param name="domain">
+##     <summary>
+##     Domain allowed access.
+##     </summary>
+## </param>
+#
+interface(`fs_dontaudit_write_ramfs_pipes',`
+       gen_require(`
+               type ramfs_t;
+       ')
+
+       dontaudit $1 ramfs_t:fifo_file write;
+')
+
 ########################################
 ## <summary>
 ##     Read and write a named pipe on a ramfs filesystem.
@@ -2050,9 +2090,30 @@ interface(`fs_rw_ramfs_pipes',`
                type ramfs_t;
        ')
 
+       allow $1 ramfs_t:dir search_dir_perms;
        allow $1 ramfs_t:fifo_file rw_file_perms;
 ')
 
+########################################
+## <summary>
+##     Create, read, write, and delete 
+##     named pipes on a ramfs filesystem.
+## </summary>
+## <param name="domain">
+##     <summary>
+##     Domain allowed access.
+##     </summary>
+## </param>
+#
+interface(`fs_manage_ramfs_pipes',`
+       gen_require(`
+               type ramfs_t;
+       ')
+
+       allow $1 ramfs_t:dir rw_dir_perms;
+       allow $1 ramfs_t:fifo_file manage_file_perms;
+')
+
 ########################################
 ## <summary>
 ##     Write to named socket on a ramfs filesystem.
@@ -2071,6 +2132,26 @@ interface(`fs_write_ramfs_sockets',`
        allow $1 ramfs_t:sock_file write;
 ')
 
+########################################
+## <summary>
+##     Create, read, write, and delete
+##     named sockets on a ramfs filesystem.
+## </summary>
+## <param name="domain">
+##     <summary>
+##     Domain allowed access.
+##     </summary>
+## </param>
+#
+interface(`fs_manage_ramfs_sockets',`
+       gen_require(`
+               type ramfs_t;
+       ')
+
+       allow $1 ramfs_t:dir rw_dir_perms;
+       allow $1 ramfs_t:sock_file manage_file_perms;
+')
+
 ########################################
 ## <summary>
 ##     Mount a ROM filesystem.
diff --git a/refpolicy/policy/modules/services/rhgb.fc b/refpolicy/policy/modules/services/rhgb.fc
new file mode 100644 (file)
index 0000000..9e5d31b
--- /dev/null
@@ -0,0 +1,4 @@
+#
+# /usr
+#
+/usr/bin/rhgb          --      gen_context(system_u:object_r:rhgb_exec_t,s0)
diff --git a/refpolicy/policy/modules/services/rhgb.if b/refpolicy/policy/modules/services/rhgb.if
new file mode 100644 (file)
index 0000000..639ece6
--- /dev/null
@@ -0,0 +1,126 @@
+## <summary> Red Hat Graphical Boot </summary>
+
+########################################
+## <summary>
+##     RHGB stub interface.  No access allowed.
+## </summary>
+## <param name="domain">
+##     <summary>
+##     N/A
+##     </summary>
+## </param>
+#
+interface(`rhgb_stub',`
+       gen_require(`
+               type rhgb_t;
+       ')
+')
+
+########################################
+## <summary>
+##     Use a rhgb file descriptor.
+## </summary>
+## <param name="domain">
+##     <summary>
+##     The type of the process performing this action.
+##     </summary>
+## </param>
+#
+interface(`rhgb_use_fds',`
+       gen_require(`
+               type rhgb_t;
+       ')
+
+       allow $1 rhgb_t:fd use;
+')
+
+########################################
+## <summary>
+##     Read and write to unix stream sockets.
+## </summary>
+## <param name="domain">
+##     <summary>
+##     The type of the process performing this action.
+##     </summary>
+## </param>
+#
+interface(`rhgb_rw_stream_sockets',`
+       gen_require(`
+               type rhgb_t;
+       ')
+
+       allow $1 rhgb_t:unix_stream_socket { read write };
+')
+
+########################################
+## <summary>
+##     Do not audit attempts to read and write
+##     rhgb unix domain stream sockets.
+## </summary>
+## <param name="domain">
+##     <summary>
+##     The type of the process performing this action.
+##     </summary>
+## </param>
+#
+interface(`rhgb_dontaudit_rw_stream_sockets',`
+       gen_require(`
+               type rhgb_t;
+       ')
+
+       dontaudit $1 rhgb_t:unix_stream_socket { read write };
+')
+
+########################################
+## <summary>
+##     Connected to rhgb unix stream socket.
+## </summary>
+## <param name="domain">
+##     <summary>
+##     The type of the process performing this action.
+##     </summary>
+## </param>
+#
+interface(`rhgb_stream_connect',`
+       gen_require(`
+               type rhgb_t;
+       ')
+
+       allow $1 rhgb_t:unix_stream_socket connectto;
+')
+
+########################################
+## <summary>
+##     Read and write to rhgb shared memory.
+## </summary>
+## <param name="domain">
+##     <summary>
+##     The type of the process performing this action.
+##     </summary>
+## </param>
+#
+interface(`rhgb_rw_shm',`
+       gen_require(`
+               type rhgb_t;
+       ')
+
+       allow $1 rhgb_t:shm rw_shm_perms;
+')
+
+########################################
+## <summary>
+##     Read and write to rhgb temporary file system.
+## </summary>
+## <param name="domain">
+##     <summary>
+##     The type of the process performing this action.
+##     </summary>
+## </param>
+#
+interface(`rhgb_rw_tmpfs_files',`
+       gen_require(`
+               type rhgb_tmpfs_t;
+       ')
+
+       allow $1 rhgb_tmpfs_t:file { read write };
+')
diff --git a/refpolicy/policy/modules/services/rhgb.te b/refpolicy/policy/modules/services/rhgb.te
new file mode 100644 (file)
index 0000000..99acd6b
--- /dev/null
@@ -0,0 +1,149 @@
+
+policy_module(rhgb,1.0.0)
+
+########################################
+#
+# Declarations
+#
+
+type rhgb_t;
+type rhgb_exec_t;
+init_daemon_domain(rhgb_t,rhgb_exec_t)
+
+type rhgb_devpts_t;
+term_pty(rhgb_devpts_t)
+
+type rhgb_tmpfs_t;
+files_tmpfs_file(rhgb_tmpfs_t)
+
+########################################
+#
+# Local policy
+#
+
+allow rhgb_t self:capability { sys_admin sys_tty_config };
+dontaudit rhgb_t self:capability sys_tty_config;
+allow rhgb_t self:process signal_perms;
+allow rhgb_t self:shm create_shm_perms;
+allow rhgb_t self:unix_stream_socket create_stream_socket_perms;
+allow rhgb_t self:fifo_file rw_file_perms;
+allow rhgb_t self:tcp_socket create_socket_perms;
+allow rhgb_t self:udp_socket create_socket_perms;
+
+allow rhgb_t rhgb_devpts_t:chr_file { rw_file_perms setattr };
+term_create_pty(rhgb_t,rhgb_devpts_t)
+
+allow rhgb_t rhgb_tmpfs_t:dir manage_dir_perms;
+allow rhgb_t rhgb_tmpfs_t:file manage_file_perms;
+allow rhgb_t rhgb_tmpfs_t:lnk_file create_lnk_perms;
+allow rhgb_t rhgb_tmpfs_t:sock_file manage_file_perms;
+allow rhgb_t rhgb_tmpfs_t:fifo_file manage_file_perms;
+fs_tmpfs_filetrans(rhgb_t,rhgb_tmpfs_t,{ dir file lnk_file sock_file fifo_file })
+
+kernel_read_kernel_sysctls(rhgb_t)
+kernel_read_system_state(rhgb_t)
+
+corecmd_exec_bin(rhgb_t)
+corecmd_exec_sbin(rhgb_t)
+
+corenet_tcp_sendrecv_generic_if(rhgb_t)
+corenet_udp_sendrecv_generic_if(rhgb_t)
+corenet_raw_sendrecv_generic_if(rhgb_t)
+corenet_tcp_sendrecv_all_nodes(rhgb_t)
+corenet_udp_sendrecv_all_nodes(rhgb_t)
+corenet_raw_sendrecv_all_nodes(rhgb_t)
+corenet_tcp_sendrecv_all_ports(rhgb_t)
+corenet_udp_sendrecv_all_ports(rhgb_t)
+corenet_non_ipsec_sendrecv(rhgb_t)
+corenet_tcp_bind_all_nodes(rhgb_t)
+corenet_udp_bind_all_nodes(rhgb_t)
+corenet_tcp_connect_all_ports(rhgb_t)
+
+dev_read_sysfs(rhgb_t)
+
+domain_use_interactive_fds(rhgb_t)
+
+files_read_etc_files(rhgb_t)
+files_read_etc_runtime_files(rhgb_t)
+files_search_tmp(rhgb_t)
+files_read_usr_files(rhgb_t)
+files_mounton_mnt(rhgb_t)
+files_dontaudit_read_default_files(rhgb_t)
+files_dontaudit_search_pids(rhgb_t)
+# for nscd
+files_dontaudit_search_var(rhgb_t)
+
+fs_search_auto_mountpoints(rhgb_t)
+fs_mount_ramfs(rhgb_t)
+fs_unmount_ramfs(rhgb_t)
+# for ramfs file systems
+fs_manage_ramfs_files(rhgb_t)
+fs_manage_ramfs_pipes(rhgb_t)
+fs_manage_ramfs_sockets(rhgb_t)
+
+term_dontaudit_use_console(rhgb_t)
+term_use_unallocated_ttys(rhgb_t)
+
+init_use_fds(rhgb_t)
+init_use_script_ptys(rhgb_t)
+init_write_initctl(rhgb_t)
+
+libs_use_ld_so(rhgb_t)
+libs_use_shared_libs(rhgb_t)
+# for localization
+libs_read_lib_files(rhgb_t)
+
+logging_send_syslog_msg(rhgb_t)
+
+miscfiles_read_localization(rhgb_t)
+miscfiles_read_fonts(rhgb_t)
+
+sysnet_read_config(rhgb_t)
+
+userdom_dontaudit_use_unpriv_user_fds(rhgb_t)
+
+xserver_read_xdm_xserver_tmp_files(rhgb_t)
+xserver_kill_xdm_xserver(rhgb_t)
+# for running setxkbmap
+xserver_read_xkb_libs(rhgb_t)
+
+ifdef(`targeted_policy',`
+       term_dontaudit_use_generic_ptys(rhgb_t)
+       files_dontaudit_read_root_files(rhgb_t)
+')
+
+optional_policy(`firstboot',`
+       firstboot_read_rw_files(rhgb_t)
+')
+
+optional_policy(`nis',`
+       nis_use_ypbind(rhgb_t)
+')
+
+optional_policy(`selinuxutil',`
+       seutil_sigchld_newrole(rhgb_t)
+')
+
+optional_policy(`udev',`
+       udev_read_db(rhgb_t)
+')
+
+ifdef(`TODO',`
+       #TODO
+       ifdef(`hide_broken_symptoms', `
+               # for a bug in the X server
+               dontaudit mount_t rhgb_gph_t:fd use;
+       ')
+       #TODO this seems a bit much
+       allow domain rhgb_devpts_t:chr_file { read write };
+       #TODO this (ie files_dontaudit_read_default_files(rhgb_t))doesn't make sense with the following
+       allow rhgb_t default_t:file { getattr read };
+       #TODO
+       # for gnome-pty-helper
+       gph_domain(rhgb, system)
+       allow initrc_t rhgb_gph_t:fd use;
+       ifdef(`hide_broken_symptoms', `
+               # it should not do this
+               dontaudit rhgb_t { staff_home_dir_t sysadm_home_dir_t }:dir search;
+       ')
+')
index 01c85c1a7186264423f11f353575cfbf3574df66..e4ea88483778c37fe725a11cc495a8c8a6269b39 100644 (file)
@@ -828,3 +828,79 @@ interface(`xserver_delete_log',`
        allow $1 xserver_log_t:dir rw_dir_perms;
        allow $1 xserver_log_t:file unlink;
 ')
+
+########################################
+## <summary>
+##     Read X keyboard extension libraries.
+## </summary>
+## <param name="domain">
+##     <summary>
+##     Domain to not audit
+##     </summary>
+## </param>
+#
+interface(`xserver_read_xkb_libs',`
+       gen_require(`
+               type xkb_var_lib_t;
+       ')
+
+       files_search_var_lib($1)
+       allow $1 xkb_var_lib_t:dir list_dir_perms;
+       allow $1 xkb_var_lib_t:file r_file_perms;
+       allow $1 xkb_var_lib_t:lnk_file { getattr read };
+')
+
+########################################
+## <summary>
+##     Read xdm temporary files.
+## </summary>
+## <param name="domain">
+##     <summary>
+##     Domain to not audit
+##     </summary>
+## </param>
+#
+interface(`xserver_read_xdm_xserver_tmp_files',`
+       gen_require(`
+               type xdm_xserver_tmp_t;
+       ')
+
+       allow $1 xdm_xserver_tmp_t:file { getattr read };
+')
+
+########################################
+## <summary>
+##     Kill XDM X servers
+## </summary>
+## <param name="domain">
+##     <summary>
+##     Domain to not audit
+##     </summary>
+## </param>
+#
+interface(`xserver_kill_xdm_xserver',`
+       gen_require(`
+               type xdm_xserver_t;
+       ')
+
+       allow $1 xdm_xserver_t:process sigkill;
+')
+
+########################################
+## <summary>
+##     Do not audit attempts to read and write to
+##     a XDM X server socket.
+## </summary>
+## <param name="domain">
+##     <summary>
+##     Domain to not audit
+##     </summary>
+## </param>
+#
+interface(`xserver_dontaudit_rw_xdm_xserver_tcp_sockets',`
+       gen_require(`
+               type xdm_xserver_t;
+       ')
+
+       dontaudit $1 xdm_xserver_t:tcp_socket { read write };
+')
index 64e7d0c9cf78a968d91c2f3a9b67864d761ed0c7..2d7bfba0c38cf0c0e83e08071adbf51342fa546c 100644 (file)
@@ -429,6 +429,11 @@ ifdef(`targeted_policy',`
        unconfined_domtrans(xdm_xserver_t)
 ')
 
+optional_policy(`rhgb',`
+       rhgb_rw_shm(xdm_xserver_t)
+       rhgb_rw_tmpfs_files(xdm_xserver_t)
+')
+
 ifdef(`TODO',`
 allow xdm_t xconsole_device_t:fifo_file { getattr setattr };
 
index e581595b428007082dae2703da5635cbdc4cc872..f6d06101da32126c01dee396603220b96625e2a2 100644 (file)
@@ -167,3 +167,8 @@ optional_policy(`cron',`
 optional_policy(`nis',`
        nis_use_ypbind(fsadm_t)
 ')
+
+optional_policy(`rhgb',`
+       fs_dontaudit_write_ramfs_pipes(fsadm_t)
+       rhgb_stub(fsadm_t)
+')
index ea78ffd236de32a9570efb6be147ef016741423a..0b559a8f20cba31172cb2b465c51198682865fc8 100644 (file)
@@ -660,6 +660,11 @@ optional_policy(`quota',`
 
 optional_policy(`rhgb',`
        corecmd_shell_entry_type(initrc_t)
+       fs_write_ramfs_sockets(initrc_t)
+       fs_search_ramfs(initrc_t)
+
+       rhgb_rw_stream_sockets(initrc_t)
+       rhgb_stream_connect(initrc_t)
 ')
 
 optional_policy(`rpm',`
index 9254b81cc52920ab5b32ed5a6671a6a0ba26d8f2..6d863ab87e505223028370950e47ae0bc39d56b7 100644 (file)
@@ -143,6 +143,16 @@ optional_policy(`nscd',`
        nscd_socket_use(insmod_t)
 ')
 
+optional_policy(`rhgb',`
+       fs_manage_ramfs_files(insmod_t)
+
+       rhgb_use_fds(insmod_t)
+
+       ifdef(`hide_broken_symptoms',`
+               xserver_dontaudit_rw_xdm_xserver_tcp_sockets(insmod_t)
+       ')
+')
+
 optional_policy(`rpm',`
        rpm_rw_pipes(insmod_t)
 ')
index 0c77a4886ff8c4d2c88ca564e0d09978d2261867..190f3bd7f0256f79fb2a7e8a01e626b19b8301af 100644 (file)
@@ -128,6 +128,14 @@ optional_policy(`apm',`
        apm_use_fds(mount_t)
 ')
 
+optional_policy(`rhgb',`
+       ifdef(`hide_broken_symptoms',`
+               # for a bug in the X server
+               rhgb_dontaudit_rw_stream_sockets(mount_t)
+               term_dontaudit_use_ptmx(mount_t)
+       ')
+')
+
 # for kernel package installation
 optional_policy(`rpm',`
        rpm_rw_pipes(mount_t)