Chris PeBenito 17de1b
Chris PeBenito d46cfe
policy_module(mount,1.7.1)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# Declarations
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 56e1b3
ifdef(`targeted_policy',`
Chris PeBenito 56e1b3
## <desc>
Chris PeBenito 56e1b3
## 

Chris PeBenito 56e1b3
## Allow mount to mount any file
Chris PeBenito 56e1b3
## 

Chris PeBenito 56e1b3
## </desc>
Chris PeBenito 56e1b3
gen_tunable(allow_mount_anyfile,false)
Chris PeBenito 56e1b3
')
Chris PeBenito 56e1b3
Chris PeBenito 17de1b
type mount_t;
Chris PeBenito 17de1b
type mount_exec_t;
Chris PeBenito 17de1b
init_system_domain(mount_t,mount_exec_t)
Chris PeBenito 17de1b
role system_r types mount_t;
Chris PeBenito 17de1b
Chris PeBenito eac818
type mount_loopback_t; # customizable
Chris PeBenito eac818
files_type(mount_loopback_t)
Chris PeBenito eac818
Chris PeBenito 17de1b
type mount_tmp_t;
Chris PeBenito 17de1b
files_tmp_file(mount_tmp_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
ifdef(`targeted_policy',`
Chris PeBenito 17de1b
	type unconfined_mount_t;
Chris PeBenito d46cfe
	application_domain(unconfined_mount_t,mount_exec_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# mount local policy
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# setuid/setgid needed to mount cifs 
Chris PeBenito 17de1b
allow mount_t self:capability { ipc_lock sys_rawio sys_admin dac_override chown sys_tty_config setuid setgid };
Chris PeBenito 17de1b
Chris PeBenito c0868a
allow mount_t mount_loopback_t:file read_file_perms;
Chris PeBenito d6d16b
allow mount_t self:netlink_route_socket r_netlink_socket_perms;
Chris PeBenito d6d16b
Chris PeBenito c0868a
allow mount_t mount_tmp_t:file manage_file_perms;
Chris PeBenito c0868a
allow mount_t mount_tmp_t:dir manage_dir_perms;
Chris PeBenito c0868a
Chris PeBenito d6d16b
can_exec(mount_t, mount_exec_t)
Chris PeBenito eac818
Chris PeBenito 17de1b
files_tmp_filetrans(mount_t,mount_tmp_t,{ file dir })
Chris PeBenito 17de1b
Chris PeBenito 17de1b
kernel_read_system_state(mount_t)
Chris PeBenito d9845a
kernel_read_kernel_sysctls(mount_t)
Chris PeBenito 17de1b
kernel_dontaudit_getattr_core_if(mount_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
dev_getattr_all_blk_files(mount_t)
Chris PeBenito 17de1b
dev_list_all_dev_nodes(mount_t)
Chris PeBenito 17de1b
dev_rw_lvm_control(mount_t)
Chris PeBenito 17de1b
dev_dontaudit_getattr_all_chr_files(mount_t)
Chris PeBenito 17de1b
dev_dontaudit_getattr_memory_dev(mount_t)
Chris PeBenito 17de1b
dev_getattr_sound_dev(mount_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
storage_raw_read_fixed_disk(mount_t)
Chris PeBenito 17de1b
storage_raw_write_fixed_disk(mount_t)
Chris PeBenito 17de1b
storage_raw_read_removable_device(mount_t)
Chris PeBenito 17de1b
storage_raw_write_removable_device(mount_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
fs_getattr_xattr_fs(mount_t)
Chris PeBenito 17de1b
fs_getattr_cifs(mount_t)
Chris PeBenito 17de1b
fs_mount_all_fs(mount_t)
Chris PeBenito 17de1b
fs_unmount_all_fs(mount_t)
Chris PeBenito 17de1b
fs_remount_all_fs(mount_t)
Chris PeBenito 17de1b
fs_relabelfrom_all_fs(mount_t)
Chris PeBenito 17de1b
fs_list_auto_mountpoints(mount_t)
Chris PeBenito 17de1b
fs_rw_tmpfs_chr_files(mount_t)
Chris PeBenito 17de1b
fs_read_tmpfs_symlinks(mount_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
term_use_all_terms(mount_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# required for mount.smbfs
Chris PeBenito 17de1b
corecmd_exec_bin(mount_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
domain_use_interactive_fds(mount_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
files_search_all(mount_t)
Chris PeBenito 17de1b
files_read_etc_files(mount_t)
Chris PeBenito 17de1b
files_manage_etc_runtime_files(mount_t)
Chris PeBenito 17de1b
files_etc_filetrans_etc_runtime(mount_t,file)
Chris PeBenito 17de1b
files_mounton_all_mountpoints(mount_t)
Chris PeBenito 17de1b
files_unmount_rootfs(mount_t)
Chris PeBenito 17de1b
# These rules need to be generalized.  Only admin, initrc should have it:
Chris PeBenito 17de1b
files_relabelto_all_file_type_fs(mount_t)
Chris PeBenito 17de1b
files_mount_all_file_type_fs(mount_t)
Chris PeBenito 17de1b
files_unmount_all_file_type_fs(mount_t)
Chris PeBenito 17de1b
# for when /etc/mtab loses its type
Chris PeBenito 17de1b
# cjp: this seems wrong, the type should probably be etc
Chris PeBenito 17de1b
files_read_isid_type_files(mount_t)
Chris PeBenito 17de1b
# For reading cert files
Chris PeBenito 17de1b
files_read_usr_files(mount_t)
Chris PeBenito a5e213
files_list_mnt(mount_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
init_use_fds(mount_t)
Chris PeBenito 17de1b
init_use_script_ptys(mount_t)
Chris PeBenito 17de1b
init_dontaudit_getattr_initctl(mount_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
libs_use_ld_so(mount_t)
Chris PeBenito 17de1b
libs_use_shared_libs(mount_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
logging_send_syslog_msg(mount_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
miscfiles_read_localization(mount_t)
Chris PeBenito 17de1b
Chris PeBenito f8233a
mls_file_read_all_levels(mount_t)
Chris PeBenito f8233a
mls_file_write_all_levels(mount_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
sysnet_use_portmap(mount_t)
Chris PeBenito 17de1b
Chris PeBenito a5e213
selinux_get_enforce_mode(mount_t)
Chris PeBenito d9845a
seutil_read_config(mount_t)
Chris PeBenito a5e213
Chris PeBenito 17de1b
userdom_use_all_users_fds(mount_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
ifdef(`distro_redhat',`
Chris PeBenito 17de1b
	optional_policy(`
Chris PeBenito 17de1b
		auth_read_pam_console_data(mount_t)
Chris PeBenito 17de1b
		# mount config by default sets fscontext=removable_t
Chris PeBenito 17de1b
		fs_relabelfrom_dos_fs(mount_t)
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
ifdef(`targeted_policy',`
Chris PeBenito 17de1b
	tunable_policy(`allow_mount_anyfile',`
Chris PeBenito 17de1b
		auth_read_all_dirs_except_shadow(mount_t)
Chris PeBenito 17de1b
		auth_read_all_files_except_shadow(mount_t)
Chris PeBenito 17de1b
		files_mounton_non_security(mount_t)
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	# for nfs
Chris PeBenito 190066
	corenet_all_recvfrom_unlabeled(mount_t)
Chris PeBenito 190066
	corenet_all_recvfrom_netlabel(mount_t)
Chris PeBenito 17de1b
	corenet_tcp_sendrecv_all_if(mount_t)
Chris PeBenito 17de1b
	corenet_raw_sendrecv_all_if(mount_t)
Chris PeBenito 17de1b
	corenet_udp_sendrecv_all_if(mount_t)
Chris PeBenito 17de1b
	corenet_tcp_sendrecv_all_nodes(mount_t)
Chris PeBenito 17de1b
	corenet_raw_sendrecv_all_nodes(mount_t)
Chris PeBenito 17de1b
	corenet_udp_sendrecv_all_nodes(mount_t)
Chris PeBenito 17de1b
	corenet_tcp_sendrecv_all_ports(mount_t)
Chris PeBenito 17de1b
	corenet_udp_sendrecv_all_ports(mount_t)
Chris PeBenito 17de1b
	corenet_tcp_bind_all_nodes(mount_t)
Chris PeBenito 17de1b
	corenet_udp_bind_all_nodes(mount_t)
Chris PeBenito 17de1b
	corenet_tcp_bind_generic_port(mount_t)
Chris PeBenito 17de1b
	corenet_udp_bind_generic_port(mount_t)
Chris PeBenito 17de1b
	corenet_tcp_bind_reserved_port(mount_t)
Chris PeBenito 17de1b
	corenet_udp_bind_reserved_port(mount_t)
Chris PeBenito 17de1b
	corenet_tcp_bind_all_rpc_ports(mount_t)
Chris PeBenito 17de1b
	corenet_udp_bind_all_rpc_ports(mount_t)
Chris PeBenito 17de1b
	corenet_dontaudit_tcp_bind_all_reserved_ports(mount_t)
Chris PeBenito 17de1b
	corenet_dontaudit_udp_bind_all_reserved_ports(mount_t)
Chris PeBenito 17de1b
	corenet_tcp_connect_all_ports(mount_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
	fs_search_rpc(mount_t)
Chris PeBenito 17de1b
Chris PeBenito 0d96ff
	sysnet_dns_name_resolve(mount_t)
Chris PeBenito 0d96ff
Chris PeBenito 0d96ff
	rpc_stub(mount_t)
Chris PeBenito 0d96ff
Chris PeBenito 17de1b
	optional_policy(`
Chris PeBenito 17de1b
		nis_use_ypbind(mount_t)
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	apm_use_fds(mount_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	ifdef(`hide_broken_symptoms',`
Chris PeBenito 17de1b
		# for a bug in the X server
Chris PeBenito 17de1b
		rhgb_dontaudit_rw_stream_sockets(mount_t)
Chris PeBenito 17de1b
		term_dontaudit_use_ptmx(mount_t)
Chris PeBenito 17de1b
	')
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# for kernel package installation
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	rpm_rw_pipes(mount_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	samba_domtrans_smbmount(mount_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito a5e213
optional_policy(`
Chris PeBenito a5e213
	nscd_socket_use(mount_t)
Chris PeBenito a5e213
')
Chris PeBenito a5e213
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# Unconfined mount local policy
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 17de1b
ifdef(`targeted_policy',`
Chris PeBenito 17de1b
	files_etc_filetrans_etc_runtime(unconfined_mount_t,file)
Chris PeBenito 17de1b
	unconfined_domain(unconfined_mount_t)
Chris PeBenito 17de1b
')