policy_module(rpc, 1.15.1) ######################################## # # Declarations # ## ##

## Allow gssd to list tmp directories and read the kerberos credential cache. ##

##
gen_tunable(gssd_read_tmp, true) ## ##

## Allow nfs servers to modify public files ## used for public file transfer services. Files/Directories must be ## labeled public_content_rw_t. ##

##
gen_tunable(nfsd_anon_write, false) ## ##

## Allow rpcd_t to manage fuse files ##

##
gen_tunable(rpcd_use_fusefs, false) attribute rpc_domain; type exports_t; files_config_file(exports_t) rpc_domain_template(gssd) type gssd_keytab_t; files_type(gssd_keytab_t) type gssd_tmp_t; files_tmp_file(gssd_tmp_t) type rpcd_var_run_t; files_pid_file(rpcd_var_run_t) type rpcd_lock_t; files_lock_file(rpcd_lock_t) # rpcd_t is the domain of rpc daemons. # rpc_exec_t is the type of rpc daemon programs. rpc_domain_template(rpcd) type rpcd_initrc_exec_t; init_script_file(rpcd_initrc_exec_t) type rpcd_unit_file_t; systemd_unit_file(rpcd_unit_file_t) rpc_domain_template(nfsd) type nfsd_initrc_exec_t; init_script_file(nfsd_initrc_exec_t) type nfsd_unit_file_t; systemd_unit_file(nfsd_unit_file_t) type var_lib_nfs_t; files_mountpoint(var_lib_nfs_t) type nfsd_tmp_t; files_tmp_file(nfsd_tmp_t) ######################################## # # Common rpc domain local policy # dontaudit rpc_domain self:capability { net_admin sys_tty_config }; allow rpc_domain self:process signal_perms; allow rpc_domain self:unix_stream_socket { accept listen }; allow rpc_domain self:tcp_socket { accept listen }; manage_dirs_pattern(rpc_domain, var_lib_nfs_t, var_lib_nfs_t) manage_files_pattern(rpc_domain, var_lib_nfs_t, var_lib_nfs_t) kernel_read_kernel_sysctls(rpc_domain) kernel_rw_rpc_sysctls(rpc_domain) dev_read_sysfs(rpc_domain) dev_read_urand(rpc_domain) dev_read_rand(rpc_domain) corenet_tcp_sendrecv_generic_if(rpc_domain) corenet_udp_sendrecv_generic_if(rpc_domain) corenet_tcp_sendrecv_generic_node(rpc_domain) corenet_udp_sendrecv_generic_node(rpc_domain) corenet_tcp_sendrecv_all_ports(rpc_domain) corenet_udp_sendrecv_all_ports(rpc_domain) corenet_tcp_bind_generic_node(rpc_domain) corenet_udp_bind_generic_node(rpc_domain) corenet_sendrecv_all_server_packets(rpc_domain) corenet_tcp_bind_reserved_port(rpc_domain) corenet_tcp_connect_all_ports(rpc_domain) corenet_sendrecv_portmap_client_packets(rpc_domain) corenet_dontaudit_tcp_bind_all_ports(rpc_domain) corenet_dontaudit_udp_bind_all_ports(rpc_domain) corenet_tcp_bind_generic_port(rpc_domain) corenet_udp_bind_generic_port(rpc_domain) corenet_tcp_bind_all_rpc_ports(rpc_domain) corenet_udp_bind_all_rpc_ports(rpc_domain) fs_rw_rpc_named_pipes(rpc_domain) fs_search_auto_mountpoints(rpc_domain) files_read_etc_runtime_files(rpc_domain) files_read_usr_files(rpc_domain) files_list_home(rpc_domain) userdom_dontaudit_use_unpriv_user_fds(rpc_domain) optional_policy(` rpcbind_stream_connect(rpc_domain) ') optional_policy(` seutil_sigchld_newrole(rpc_domain) ') optional_policy(` udev_read_db(rpc_domain) ') ######################################## # # RPC local policy # allow rpcd_t self:capability { setpcap sys_admin chown dac_read_search dac_override setgid setuid }; allow rpcd_t self:capability2 block_suspend; allow rpcd_t self:process { getcap setcap }; allow rpcd_t self:fifo_file rw_fifo_file_perms; allow rpcd_t rpcd_var_run_t:dir setattr_dir_perms; manage_dirs_pattern(rpcd_t, rpcd_var_run_t, rpcd_var_run_t) manage_files_pattern(rpcd_t, rpcd_var_run_t, rpcd_var_run_t) files_pid_filetrans(rpcd_t, rpcd_var_run_t, { file dir }) read_lnk_files_pattern(rpcd_t, var_lib_nfs_t, var_lib_nfs_t) allow rpcd_t rpcd_lock_t:file manage_file_perms; files_lock_filetrans(rpcd_t, rpcd_lock_t, file) # rpc.statd executes sm-notify can_exec(rpcd_t, rpcd_exec_t) kernel_read_system_state(rpcd_t) kernel_write_proc_files(rpcd_t) kernel_read_network_state(rpcd_t) # for rpc.rquotad kernel_read_sysctl(rpcd_t) kernel_rw_fs_sysctls(rpcd_t) kernel_dontaudit_getattr_core_if(rpcd_t) kernel_signal(rpcd_t) corecmd_exec_bin(rpcd_t) files_manage_mounttab(rpcd_t) files_getattr_all_dirs(rpcd_t) fs_list_rpc(rpcd_t) fs_read_rpc_files(rpcd_t) fs_read_nfsd_files(rpcd_t) fs_read_rpc_symlinks(rpcd_t) fs_rw_rpc_sockets(rpcd_t) fs_get_all_fs_quotas(rpcd_t) fs_set_xattr_fs_quotas(rpcd_t) fs_getattr_all_fs(rpcd_t) fs_watch_rpc_dirs(rpcd_t) storage_getattr_fixed_disk_dev(rpcd_t) init_read_utmp(rpcd_t) selinux_dontaudit_read_fs(rpcd_t) miscfiles_read_generic_certs(rpcd_t) userdom_signal_unpriv_users(rpcd_t) userdom_read_user_home_content_files(rpcd_t) tunable_policy(`rpcd_use_fusefs',` fs_manage_fusefs_dirs(rpcd_t) fs_manage_fusefs_files(rpcd_t) fs_read_fusefs_symlinks(rpcd_t) fs_getattr_fusefs(rpcd_t) ') ifdef(`distro_debian',` term_dontaudit_use_unallocated_ttys(rpcd_t) ') optional_policy(` automount_signal(rpcd_t) automount_dontaudit_write_pipes(rpcd_t) ') optional_policy(` domain_unconfined_signal(rpcd_t) ') optional_policy(` quota_manage_db(rpcd_t) ') optional_policy(` nis_read_ypserv_config(rpcd_t) ') optional_policy(` quota_read_db(rpcd_t) ') optional_policy(` rhcs_manage_cluster_tmp_files(rpcd_t) ') optional_policy(` samba_stream_connect_nmbd(rpcd_t) ') ######################################## # # NFSD local policy # allow nfsd_t self:capability { dac_read_search dac_override sys_admin sys_chroot sys_rawio sys_resource }; allow nfsd_t self:process { setcap }; allow nfsd_t exports_t:file read_file_perms; allow nfsd_t exports_t:dir list_dir_perms; manage_dirs_pattern(nfsd_t, nfsd_tmp_t, nfsd_tmp_t) manage_files_pattern(nfsd_t, nfsd_tmp_t, nfsd_tmp_t) files_tmp_filetrans(nfsd_t, nfsd_tmp_t, { file dir }) manage_files_pattern(nfsd_t, rpcd_var_run_t, rpcd_var_run_t) files_pid_filetrans(nfsd_t, rpcd_var_run_t, { file }) # for /proc/fs/nfs/exports - should we have a new type? kernel_read_system_state(nfsd_t) kernel_read_network_state(nfsd_t) kernel_dontaudit_getattr_core_if(nfsd_t) kernel_dontaudit_setsched(nfsd_t) kernel_request_load_module(nfsd_t) kernel_mounton_proc(nfsd_t) kernel_read_net_sysctls(nfsd_t) kernel_rw_rpc_sysctls_dirs(nfsd_t) kernel_create_rpc_sysctls(nfsd_t) kernel_rw_fs_sysctls(nfsd_t) corecmd_exec_shell(nfsd_t) corenet_tcp_bind_all_rpc_ports(nfsd_t) corenet_udp_bind_all_rpc_ports(nfsd_t) corenet_tcp_bind_nfs_port(nfsd_t) corenet_udp_bind_nfs_port(nfsd_t) corenet_udp_bind_mountd_port(nfsd_t) corenet_tcp_bind_mountd_port(nfsd_t) dev_dontaudit_getattr_all_blk_files(nfsd_t) dev_dontaudit_getattr_all_chr_files(nfsd_t) dev_rw_lvm_control(nfsd_t) # does not really need this, but it is easier to just allow it files_search_pids(nfsd_t) # for exportfs and rpc.mountd files_getattr_tmp_dirs(nfsd_t) # cjp: this should really have its own type files_manage_mounttab(nfsd_t) files_read_etc_runtime_files(nfsd_t) fs_read_configfs_files(nfsd_t) fs_read_configfs_dirs(nfsd_t) fs_mounton_nfsd_fs(nfsd_t) fs_mount_nfsd_fs(nfsd_t) fs_getattr_all_fs(nfsd_t) fs_getattr_all_dirs(nfsd_t) fs_manage_nfsd_fs(nfsd_t) storage_raw_read_fixed_disk(nfsd_t) storage_raw_read_removable_device(nfsd_t) allow nfsd_t nfsd_unit_file_t:file manage_file_perms; systemd_unit_file_filetrans(nfsd_t, nfsd_unit_file_t, file) systemd_create_unit_file_dirs(nfsd_t) systemd_create_unit_file_lnk(nfsd_t) # Read access to public_content_t and public_content_rw_t miscfiles_read_public_files(nfsd_t) userdom_filetrans_home_content(nfsd_t) userdom_list_user_tmp(nfsd_t) # Write access to public_content_t and public_content_rw_t tunable_policy(`nfsd_anon_write',` miscfiles_manage_public_files(nfsd_t) ') tunable_policy(`nfs_export_all_rw',` dev_getattr_all_blk_files(nfsd_t) dev_getattr_all_chr_files(nfsd_t) fs_read_noxattr_fs_files(nfsd_t) ') tunable_policy(`nfs_export_all_ro',` dev_getattr_all_blk_files(nfsd_t) dev_getattr_all_chr_files(nfsd_t) files_getattr_all_pipes(nfsd_t) files_getattr_all_sockets(nfsd_t) fs_read_noxattr_fs_files(nfsd_t) files_read_non_security_files(nfsd_t) ') optional_policy(` glusterd_manage_log(nfsd_t) glusterd_manage_pid(nfsd_t) ') optional_policy(` dbus_system_bus_client(nfsd_t) dbus_acquire_svc_system_dbusd(nfsd_t) ') optional_policy(` kerberos_read_keytab(nfsd_t) ') optional_policy(` fsadm_manage_pid(nfsd_t) ') optional_policy(` mount_exec(nfsd_t) mount_manage_pid_files(nfsd_t) ') ######################################## # # GSSD local policy # allow gssd_t self:capability { dac_read_search setuid setgid sys_nice }; allow gssd_t self:process { getsched setsched }; allow gssd_t self:fifo_file rw_fifo_file_perms; allow gssd_t gssd_keytab_t:file read_file_perms; manage_dirs_pattern(gssd_t, gssd_tmp_t, gssd_tmp_t) manage_files_pattern(gssd_t, gssd_tmp_t, gssd_tmp_t) files_tmp_filetrans(gssd_t, gssd_tmp_t, { file dir }) kernel_read_system_state(gssd_t) kernel_read_network_state(gssd_t) kernel_read_network_state_symlinks(gssd_t) kernel_request_load_module(gssd_t) kernel_read_net_sysctls(gssd_t) kernel_signal(gssd_t) corecmd_exec_bin(gssd_t) domain_manage_all_domains_keyrings(gssd_t) fs_list_rpc(gssd_t) fs_rw_rpc_sockets(gssd_t) fs_read_rpc_files(gssd_t) fs_read_nfsd_files(gssd_t) fs_list_tmpfs(gssd_t) fs_watch_rpc_dirs(gssd_t) files_list_tmp(gssd_t) files_read_usr_symlinks(gssd_t) files_dontaudit_write_var_dirs(gssd_t) auth_use_nsswitch(gssd_t) auth_manage_cache(gssd_t) auth_login_manage_key(gssd_t) miscfiles_read_generic_certs(gssd_t) userdom_signal_all_users(gssd_t) userdom_manage_all_users_keys(gssd_t) tunable_policy(`gssd_read_tmp',` userdom_list_user_tmp(gssd_t) userdom_read_user_tmp_files(gssd_t) userdom_read_user_tmp_symlinks(gssd_t) userdom_manage_user_tmp_files(gssd_t) files_read_generic_tmp_files(gssd_t) ') optional_policy(` automount_signal(gssd_t) ') optional_policy(` realmd_read_var_lib(gssd_t) ') optional_policy(` gssproxy_stream_connect(gssd_t) ') optional_policy(` kerberos_manage_host_rcache(gssd_t) kerberos_read_home_content(gssd_t) kerberos_read_keytab(gssd_t) kerberos_tmp_filetrans_host_rcache(gssd_t, "nfs_0") kerberos_use(gssd_t) ') optional_policy(` mount_signal(gssd_t) ') optional_policy(` pcscd_read_pid_files(gssd_t) ') optional_policy(` xserver_rw_xdm_tmp_files(gssd_t) ') ######################################## # # nfsidmap policy # type nfsidmap_exec_t; files_type(nfsidmap_exec_t) type nfsidmap_t; domain_type(nfsidmap_t) domain_entry_file(nfsidmap_t, nfsidmap_exec_t) role system_r types nfsidmap_t; allow nfsidmap_t self:key write; allow nfsidmap_t self:netlink_route_socket r_netlink_socket_perms; allow nfsidmap_t self:udp_socket create_socket_perms; kernel_setattr_key(nfsidmap_t) sysnet_read_config(nfsidmap_t) optional_policy(` auth_read_passwd(nfsidmap_t) ') optional_policy(` logging_send_syslog_msg(nfsidmap_t) ') optional_policy(` # /etc/request-key.d/id_resolver.conf keyutils_request_domtrans_to(nfsidmap_t, nfsidmap_exec_t) ') optional_policy(` systemd_machined_stream_connect(nfsidmap_t) systemd_userdbd_stream_connect(nfsidmap_t) ')