2010-08-25 15:19:27 +00:00
|
|
|
policy_module(mount, 1.11.1)
|
2005-06-20 17:41:29 +00:00
|
|
|
|
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Declarations
|
|
|
|
#
|
|
|
|
|
2007-03-26 18:41:45 +00:00
|
|
|
## <desc>
|
|
|
|
## <p>
|
2007-12-07 15:44:53 +00:00
|
|
|
## Allow the mount command to mount any directory or file.
|
2007-03-26 18:41:45 +00:00
|
|
|
## </p>
|
|
|
|
## </desc>
|
2009-06-26 14:40:13 +00:00
|
|
|
gen_tunable(allow_mount_anyfile, false)
|
2007-03-26 18:41:45 +00:00
|
|
|
|
2005-09-26 20:26:32 +00:00
|
|
|
type mount_t;
|
2005-04-26 21:12:52 +00:00
|
|
|
type mount_exec_t;
|
2009-06-26 14:40:13 +00:00
|
|
|
init_system_domain(mount_t, mount_exec_t)
|
2005-05-05 18:30:00 +00:00
|
|
|
role system_r types mount_t;
|
2005-04-26 21:12:52 +00:00
|
|
|
|
2010-08-26 13:41:21 +00:00
|
|
|
type fusermount_exec_t;
|
|
|
|
domain_entry_file(mount_t, fusermount_exec_t)
|
|
|
|
|
|
|
|
typealias mount_t alias mount_ntfs_t;
|
|
|
|
typealias mount_exec_t alias mount_ntfs_exec_t;
|
|
|
|
|
2006-09-01 15:52:05 +00:00
|
|
|
type mount_loopback_t; # customizable
|
|
|
|
files_type(mount_loopback_t)
|
2010-08-26 13:41:21 +00:00
|
|
|
typealias mount_loopback_t alias mount_loop_t;
|
2006-09-01 15:52:05 +00:00
|
|
|
|
2005-04-26 21:12:52 +00:00
|
|
|
type mount_tmp_t;
|
2005-06-13 17:35:46 +00:00
|
|
|
files_tmp_file(mount_tmp_t)
|
2005-04-26 21:12:52 +00:00
|
|
|
|
2007-10-02 16:04:50 +00:00
|
|
|
# causes problems with interfaces when
|
|
|
|
# this is optionally declared in monolithic
|
|
|
|
# policy--duplicate type declaration
|
|
|
|
type unconfined_mount_t;
|
2009-06-26 14:40:13 +00:00
|
|
|
application_domain(unconfined_mount_t, mount_exec_t)
|
2010-08-26 13:41:21 +00:00
|
|
|
role system_r types unconfined_mount_t;
|
|
|
|
|
|
|
|
type mount_var_run_t;
|
|
|
|
files_pid_file(mount_var_run_t)
|
|
|
|
|
|
|
|
# showmount - show mount information for an NFS server
|
|
|
|
|
|
|
|
type showmount_t;
|
|
|
|
type showmount_exec_t;
|
|
|
|
application_domain(showmount_t, showmount_exec_t)
|
|
|
|
role system_r types showmount_t;
|
2006-04-19 15:25:22 +00:00
|
|
|
|
2005-04-26 21:12:52 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# mount local policy
|
|
|
|
#
|
|
|
|
|
2006-04-12 15:04:28 +00:00
|
|
|
# setuid/setgid needed to mount cifs
|
2010-08-26 13:41:21 +00:00
|
|
|
allow mount_t self:capability { fsetid ipc_lock setpcap sys_rawio sys_resource sys_admin dac_override dac_read_search chown sys_tty_config setuid setgid };
|
|
|
|
allow mount_t self:process { getcap getsched ptrace setcap setrlimit signal };
|
|
|
|
allow mount_t self:fifo_file rw_fifo_file_perms;
|
|
|
|
allow mount_t self:unix_stream_socket create_stream_socket_perms;
|
|
|
|
allow mount_t self:unix_dgram_socket create_socket_perms;
|
2005-04-26 21:12:52 +00:00
|
|
|
|
2006-12-12 20:08:08 +00:00
|
|
|
allow mount_t mount_loopback_t:file read_file_perms;
|
2006-12-04 20:10:56 +00:00
|
|
|
|
2006-12-12 20:08:08 +00:00
|
|
|
allow mount_t mount_tmp_t:file manage_file_perms;
|
|
|
|
allow mount_t mount_tmp_t:dir manage_dir_perms;
|
|
|
|
|
2006-12-04 20:10:56 +00:00
|
|
|
can_exec(mount_t, mount_exec_t)
|
2006-09-01 15:52:05 +00:00
|
|
|
|
2009-06-26 14:40:13 +00:00
|
|
|
files_tmp_filetrans(mount_t, mount_tmp_t, { file dir })
|
2005-04-26 21:12:52 +00:00
|
|
|
|
2010-08-26 13:41:21 +00:00
|
|
|
manage_dirs_pattern(mount_t,mount_var_run_t,mount_var_run_t)
|
|
|
|
manage_files_pattern(mount_t,mount_var_run_t,mount_var_run_t)
|
|
|
|
files_pid_filetrans(mount_t,mount_var_run_t,dir)
|
|
|
|
files_var_filetrans(mount_t,mount_var_run_t,dir)
|
|
|
|
|
|
|
|
# In order to mount reiserfs_t
|
|
|
|
kernel_dontaudit_getattr_core_if(mount_t)
|
|
|
|
kernel_list_unlabeled(mount_t)
|
|
|
|
kernel_mount_unlabeled(mount_t)
|
|
|
|
kernel_unmount_unlabeled(mount_t)
|
2005-04-26 21:12:52 +00:00
|
|
|
kernel_read_system_state(mount_t)
|
2010-08-26 13:41:21 +00:00
|
|
|
kernel_read_network_state(mount_t)
|
2006-10-31 21:01:48 +00:00
|
|
|
kernel_read_kernel_sysctls(mount_t)
|
2010-09-01 18:11:18 +00:00
|
|
|
kernel_manage_debugfs(mount_t)
|
2010-08-26 13:41:21 +00:00
|
|
|
kernel_setsched(mount_t)
|
|
|
|
kernel_use_fds(mount_t)
|
|
|
|
kernel_request_load_module(mount_t)
|
2005-04-26 21:12:52 +00:00
|
|
|
|
2009-08-05 14:16:41 +00:00
|
|
|
# required for mount.smbfs
|
|
|
|
corecmd_exec_bin(mount_t)
|
|
|
|
|
2010-08-26 13:41:21 +00:00
|
|
|
dev_getattr_generic_blk_files(mount_t)
|
2005-06-13 16:22:32 +00:00
|
|
|
dev_getattr_all_blk_files(mount_t)
|
|
|
|
dev_list_all_dev_nodes(mount_t)
|
2010-08-26 13:41:21 +00:00
|
|
|
dev_read_usbfs(mount_t)
|
|
|
|
dev_read_rand(mount_t)
|
|
|
|
dev_read_sysfs(mount_t)
|
2006-01-17 17:50:10 +00:00
|
|
|
dev_rw_lvm_control(mount_t)
|
2006-03-23 19:19:38 +00:00
|
|
|
dev_dontaudit_getattr_all_chr_files(mount_t)
|
2006-02-13 22:05:08 +00:00
|
|
|
dev_dontaudit_getattr_memory_dev(mount_t)
|
|
|
|
dev_getattr_sound_dev(mount_t)
|
2010-08-26 13:41:21 +00:00
|
|
|
ifdef(`hide_broken_symptoms',`
|
|
|
|
dev_rw_generic_blk_files(mount_t)
|
|
|
|
')
|
2010-08-18 15:36:35 +00:00
|
|
|
# Early devtmpfs, before udev relabel
|
|
|
|
dev_dontaudit_rw_generic_chr_files(mount_t)
|
2005-04-26 21:12:52 +00:00
|
|
|
|
2006-02-20 21:33:25 +00:00
|
|
|
domain_use_interactive_fds(mount_t)
|
2010-08-26 13:41:21 +00:00
|
|
|
domain_dontaudit_search_all_domains_state(mount_t)
|
2005-04-28 21:41:09 +00:00
|
|
|
|
2006-01-31 19:21:01 +00:00
|
|
|
files_search_all(mount_t)
|
2005-06-29 14:26:41 +00:00
|
|
|
files_read_etc_files(mount_t)
|
2005-06-13 17:35:46 +00:00
|
|
|
files_manage_etc_runtime_files(mount_t)
|
2009-06-26 14:40:13 +00:00
|
|
|
files_etc_filetrans_etc_runtime(mount_t, file)
|
2010-09-28 20:24:56 +00:00
|
|
|
# for when /etc/mtab loses its type
|
|
|
|
files_delete_etc_files(mount_t)
|
2005-06-13 17:35:46 +00:00
|
|
|
files_mounton_all_mountpoints(mount_t)
|
2010-08-26 13:41:21 +00:00
|
|
|
# ntfs-3g checks whether the mountpoint is writable before mounting
|
|
|
|
files_write_all_mountpoints(mount_t)
|
2005-06-13 17:35:46 +00:00
|
|
|
files_unmount_rootfs(mount_t)
|
2010-09-28 20:24:56 +00:00
|
|
|
|
2005-05-24 15:55:57 +00:00
|
|
|
# These rules need to be generalized. Only admin, initrc should have it:
|
2010-08-26 13:41:21 +00:00
|
|
|
files_relabel_all_file_type_fs(mount_t)
|
2005-06-08 13:12:00 +00:00
|
|
|
files_mount_all_file_type_fs(mount_t)
|
2005-09-02 20:55:17 +00:00
|
|
|
files_unmount_all_file_type_fs(mount_t)
|
2006-01-31 19:21:01 +00:00
|
|
|
files_read_isid_type_files(mount_t)
|
2006-03-30 15:59:39 +00:00
|
|
|
# For reading cert files
|
|
|
|
files_read_usr_files(mount_t)
|
2006-08-29 02:41:00 +00:00
|
|
|
files_list_mnt(mount_t)
|
2005-04-26 21:12:52 +00:00
|
|
|
|
2010-08-26 13:41:21 +00:00
|
|
|
fs_list_all(mount_t)
|
|
|
|
fs_getattr_all_fs(mount_t)
|
2009-08-05 14:16:41 +00:00
|
|
|
fs_mount_all_fs(mount_t)
|
|
|
|
fs_unmount_all_fs(mount_t)
|
|
|
|
fs_remount_all_fs(mount_t)
|
|
|
|
fs_relabelfrom_all_fs(mount_t)
|
2010-08-26 13:41:21 +00:00
|
|
|
fs_rw_anon_inodefs_files(mount_t)
|
2009-08-05 14:16:41 +00:00
|
|
|
fs_rw_tmpfs_chr_files(mount_t)
|
2010-08-26 13:41:21 +00:00
|
|
|
fs_rw_nfsd_fs(mount_t)
|
|
|
|
fs_manage_tmpfs_dirs(mount_t)
|
2009-08-05 14:16:41 +00:00
|
|
|
fs_read_tmpfs_symlinks(mount_t)
|
2010-08-26 13:41:21 +00:00
|
|
|
fs_read_fusefs_files(mount_t)
|
|
|
|
fs_manage_nfs_dirs(mount_t)
|
|
|
|
fs_read_nfs_symlinks(mount_t)
|
2010-09-13 14:26:10 +00:00
|
|
|
fs_manage_cgroup_dirs(mount_t)
|
|
|
|
fs_manage_cgroup_files(mount_t)
|
2009-08-05 14:16:41 +00:00
|
|
|
|
|
|
|
mls_file_read_all_levels(mount_t)
|
|
|
|
mls_file_write_all_levels(mount_t)
|
|
|
|
|
|
|
|
selinux_get_enforce_mode(mount_t)
|
2010-08-26 13:41:21 +00:00
|
|
|
selinux_dontaudit_write_fs(mount_t)
|
2009-08-05 14:16:41 +00:00
|
|
|
|
|
|
|
storage_raw_read_fixed_disk(mount_t)
|
|
|
|
storage_raw_write_fixed_disk(mount_t)
|
|
|
|
storage_raw_read_removable_device(mount_t)
|
|
|
|
storage_raw_write_removable_device(mount_t)
|
2010-08-26 13:41:21 +00:00
|
|
|
storage_rw_fuse(mount_t)
|
2009-08-05 14:16:41 +00:00
|
|
|
|
|
|
|
term_use_all_terms(mount_t)
|
|
|
|
|
|
|
|
auth_use_nsswitch(mount_t)
|
|
|
|
|
2006-03-02 23:41:11 +00:00
|
|
|
init_use_fds(mount_t)
|
2006-02-02 21:08:12 +00:00
|
|
|
init_use_script_ptys(mount_t)
|
2006-03-23 19:19:38 +00:00
|
|
|
init_dontaudit_getattr_initctl(mount_t)
|
2010-08-26 13:41:21 +00:00
|
|
|
init_stream_connect_script(mount_t)
|
|
|
|
init_rw_script_stream_sockets(mount_t)
|
2005-05-19 21:06:06 +00:00
|
|
|
|
2005-06-13 17:35:46 +00:00
|
|
|
logging_send_syslog_msg(mount_t)
|
2005-04-26 21:12:52 +00:00
|
|
|
|
|
|
|
miscfiles_read_localization(mount_t)
|
|
|
|
|
2005-09-15 21:03:29 +00:00
|
|
|
sysnet_use_portmap(mount_t)
|
|
|
|
|
2006-10-31 21:01:48 +00:00
|
|
|
seutil_read_config(mount_t)
|
2006-08-29 02:41:00 +00:00
|
|
|
|
2006-02-20 21:33:25 +00:00
|
|
|
userdom_use_all_users_fds(mount_t)
|
2010-08-26 13:41:21 +00:00
|
|
|
userdom_manage_user_home_content_dirs(mount_t)
|
|
|
|
userdom_read_user_home_content_symlinks(mount_t)
|
|
|
|
|
|
|
|
optional_policy(`
|
|
|
|
abrt_rw_fifo_file(mount_t)
|
|
|
|
')
|
2005-05-19 21:06:06 +00:00
|
|
|
|
2005-06-07 18:45:47 +00:00
|
|
|
ifdef(`distro_redhat',`
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2005-06-13 17:35:46 +00:00
|
|
|
auth_read_pam_console_data(mount_t)
|
2005-06-03 12:25:14 +00:00
|
|
|
# mount config by default sets fscontext=removable_t
|
2005-06-08 13:12:00 +00:00
|
|
|
fs_relabelfrom_dos_fs(mount_t)
|
2005-06-03 12:25:14 +00:00
|
|
|
')
|
|
|
|
')
|
2005-05-19 21:06:06 +00:00
|
|
|
|
2008-02-05 18:24:43 +00:00
|
|
|
ifdef(`distro_ubuntu',`
|
|
|
|
optional_policy(`
|
|
|
|
unconfined_domain(mount_t)
|
|
|
|
')
|
|
|
|
')
|
|
|
|
|
2010-08-26 13:41:21 +00:00
|
|
|
corecmd_exec_shell(mount_t)
|
|
|
|
|
|
|
|
modutils_domtrans_insmod(mount_t)
|
|
|
|
|
|
|
|
fstools_domtrans(mount_t)
|
|
|
|
|
2007-10-02 16:04:50 +00:00
|
|
|
tunable_policy(`allow_mount_anyfile',`
|
|
|
|
auth_read_all_dirs_except_shadow(mount_t)
|
|
|
|
auth_read_all_files_except_shadow(mount_t)
|
|
|
|
files_mounton_non_security(mount_t)
|
2010-08-26 13:41:21 +00:00
|
|
|
files_rw_all_inherited_files(mount_t)
|
2006-05-17 14:50:31 +00:00
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2005-06-03 12:25:14 +00:00
|
|
|
# for nfs
|
2007-06-27 15:23:21 +00:00
|
|
|
corenet_all_recvfrom_unlabeled(mount_t)
|
|
|
|
corenet_all_recvfrom_netlabel(mount_t)
|
2005-06-10 01:01:13 +00:00
|
|
|
corenet_tcp_sendrecv_all_if(mount_t)
|
|
|
|
corenet_raw_sendrecv_all_if(mount_t)
|
|
|
|
corenet_udp_sendrecv_all_if(mount_t)
|
|
|
|
corenet_tcp_sendrecv_all_nodes(mount_t)
|
|
|
|
corenet_raw_sendrecv_all_nodes(mount_t)
|
|
|
|
corenet_udp_sendrecv_all_nodes(mount_t)
|
|
|
|
corenet_tcp_sendrecv_all_ports(mount_t)
|
|
|
|
corenet_udp_sendrecv_all_ports(mount_t)
|
|
|
|
corenet_tcp_bind_all_nodes(mount_t)
|
|
|
|
corenet_udp_bind_all_nodes(mount_t)
|
|
|
|
corenet_tcp_bind_generic_port(mount_t)
|
|
|
|
corenet_udp_bind_generic_port(mount_t)
|
|
|
|
corenet_tcp_bind_reserved_port(mount_t)
|
|
|
|
corenet_udp_bind_reserved_port(mount_t)
|
2006-05-03 19:58:01 +00:00
|
|
|
corenet_tcp_bind_all_rpc_ports(mount_t)
|
|
|
|
corenet_udp_bind_all_rpc_ports(mount_t)
|
2006-05-29 15:04:49 +00:00
|
|
|
corenet_dontaudit_tcp_bind_all_reserved_ports(mount_t)
|
|
|
|
corenet_dontaudit_udp_bind_all_reserved_ports(mount_t)
|
2005-09-15 21:03:29 +00:00
|
|
|
corenet_tcp_connect_all_ports(mount_t)
|
2005-06-27 16:30:55 +00:00
|
|
|
|
2006-01-31 20:29:27 +00:00
|
|
|
fs_search_rpc(mount_t)
|
2005-12-12 21:47:43 +00:00
|
|
|
|
2006-09-13 14:23:04 +00:00
|
|
|
rpc_stub(mount_t)
|
2010-08-26 13:41:21 +00:00
|
|
|
|
|
|
|
rpc_domtrans_rpcd(mount_t)
|
2005-05-19 21:06:06 +00:00
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2006-03-02 23:41:11 +00:00
|
|
|
apm_use_fds(mount_t)
|
2005-10-10 18:11:46 +00:00
|
|
|
')
|
|
|
|
|
2010-08-26 13:41:21 +00:00
|
|
|
optional_policy(`
|
|
|
|
cron_system_entry(mount_t, mount_exec_t)
|
|
|
|
')
|
|
|
|
|
|
|
|
optional_policy(`
|
|
|
|
dbus_system_bus_client(mount_t)
|
|
|
|
|
|
|
|
optional_policy(`
|
|
|
|
hal_dbus_chat(mount_t)
|
|
|
|
')
|
|
|
|
')
|
|
|
|
|
|
|
|
|
|
|
|
optional_policy(`
|
|
|
|
hal_write_log(mount_t)
|
|
|
|
hal_use_fds(mount_t)
|
|
|
|
hal_dontaudit_rw_pipes(mount_t)
|
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2006-03-09 19:02:29 +00:00
|
|
|
ifdef(`hide_broken_symptoms',`
|
|
|
|
# for a bug in the X server
|
|
|
|
rhgb_dontaudit_rw_stream_sockets(mount_t)
|
|
|
|
term_dontaudit_use_ptmx(mount_t)
|
|
|
|
')
|
|
|
|
')
|
|
|
|
|
2010-08-31 12:54:18 +00:00
|
|
|
optional_policy(`
|
|
|
|
livecd_rw_tmp_files(mount_t)
|
|
|
|
')
|
|
|
|
|
2010-08-26 13:41:21 +00:00
|
|
|
# Needed for mount crypt https://bugzilla.redhat.com/show_bug.cgi?id=418711
|
|
|
|
optional_policy(`
|
|
|
|
lvm_domtrans(mount_t)
|
|
|
|
')
|
|
|
|
|
2005-07-12 20:34:24 +00:00
|
|
|
# for kernel package installation
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2006-02-02 21:08:12 +00:00
|
|
|
rpm_rw_pipes(mount_t)
|
2010-09-14 14:02:43 +00:00
|
|
|
rpm_dontaudit_leaks(mount_t)
|
2005-07-12 20:34:24 +00:00
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2005-09-14 18:33:53 +00:00
|
|
|
samba_domtrans_smbmount(mount_t)
|
2010-08-26 13:41:21 +00:00
|
|
|
samba_read_config(mount_t)
|
|
|
|
')
|
|
|
|
|
|
|
|
optional_policy(`
|
|
|
|
ssh_exec(mount_t)
|
|
|
|
')
|
|
|
|
|
|
|
|
optional_policy(`
|
|
|
|
usbmuxd_stream_connect(mount_t)
|
|
|
|
')
|
|
|
|
|
|
|
|
optional_policy(`
|
|
|
|
vmware_exec_host(mount_t)
|
2005-09-14 18:33:53 +00:00
|
|
|
')
|
2006-04-19 15:25:22 +00:00
|
|
|
|
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Unconfined mount local policy
|
|
|
|
#
|
|
|
|
|
2007-10-02 16:04:50 +00:00
|
|
|
optional_policy(`
|
2010-08-26 13:41:21 +00:00
|
|
|
unconfined_domain_noaudit(unconfined_mount_t)
|
|
|
|
')
|
|
|
|
|
|
|
|
optional_policy(`
|
|
|
|
userdom_unpriv_usertype(unconfined, unconfined_mount_t)
|
2009-06-26 14:40:13 +00:00
|
|
|
files_etc_filetrans_etc_runtime(unconfined_mount_t, file)
|
2006-04-19 15:25:22 +00:00
|
|
|
')
|
2010-08-26 13:41:21 +00:00
|
|
|
|
|
|
|
######################################
|
|
|
|
#
|
|
|
|
# showmount local policy
|
|
|
|
#
|
|
|
|
|
|
|
|
allow showmount_t self:tcp_socket create_stream_socket_perms;
|
|
|
|
allow showmount_t self:udp_socket create_socket_perms;
|
|
|
|
|
|
|
|
kernel_read_system_state(showmount_t)
|
|
|
|
|
|
|
|
corenet_all_recvfrom_unlabeled(showmount_t)
|
|
|
|
corenet_all_recvfrom_netlabel(showmount_t)
|
|
|
|
corenet_tcp_sendrecv_generic_if(showmount_t)
|
|
|
|
corenet_udp_sendrecv_generic_if(showmount_t)
|
|
|
|
corenet_tcp_sendrecv_generic_node(showmount_t)
|
|
|
|
corenet_udp_sendrecv_generic_node(showmount_t)
|
|
|
|
corenet_tcp_sendrecv_all_ports(showmount_t)
|
|
|
|
corenet_udp_sendrecv_all_ports(showmount_t)
|
|
|
|
corenet_tcp_bind_generic_node(showmount_t)
|
|
|
|
corenet_udp_bind_generic_node(showmount_t)
|
|
|
|
corenet_tcp_bind_all_rpc_ports(showmount_t)
|
|
|
|
corenet_udp_bind_all_rpc_ports(showmount_t)
|
|
|
|
corenet_tcp_connect_all_ports(showmount_t)
|
|
|
|
|
|
|
|
files_read_etc_files(showmount_t)
|
|
|
|
|
|
|
|
miscfiles_read_localization(showmount_t)
|
|
|
|
|
|
|
|
sysnet_dns_name_resolve(showmount_t)
|
|
|
|
|
|
|
|
userdom_use_user_terminals(showmount_t)
|