Rpc patch from Dan Walsh.

This commit is contained in:
Chris PeBenito 2010-04-05 14:26:21 -04:00
parent 20fa703294
commit 372acd0037
3 changed files with 96 additions and 36 deletions

View File

@ -2,6 +2,9 @@
# /etc
#
/etc/exports -- gen_context(system_u:object_r:exports_t,s0)
/etc/rc\.d/init\.d/nfs -- gen_context(system_u:object_r:nfsd_initrc_exec_t,s0)
/etc/rc\.d/init\.d/nfslock -- gen_context(system_u:object_r:rpcd_initrc_exec_t,s0)
/etc/rc\.d/init\.d/rpcidmapd -- gen_context(system_u:object_r:rpcd_initrc_exec_t,s0)
#
# /sbin

View File

@ -92,13 +92,14 @@ template(`rpc_domain_template', `
corenet_udp_bind_all_rpc_ports($1_t)
corenet_sendrecv_generic_server_packets($1_t)
fs_rw_rpc_named_pipes($1_t)
fs_rw_rpc_named_pipes($1_t)
fs_search_auto_mountpoints($1_t)
files_read_etc_files($1_t)
files_read_etc_runtime_files($1_t)
files_search_var($1_t)
files_search_var_lib($1_t)
files_list_home($1_t)
auth_use_nsswitch($1_t)
@ -108,6 +109,10 @@ template(`rpc_domain_template', `
userdom_dontaudit_use_unpriv_user_fds($1_t)
optional_policy(`
rpcbind_stream_connect($1_t)
')
optional_policy(`
seutil_sigchld_newrole($1_t)
')
@ -204,12 +209,30 @@ interface(`rpc_domtrans_nfsd',`
domtrans_pattern($1, nfsd_exec_t, nfsd_t)
')
########################################
#######################################
## <summary>
## Execute domain in nfsd domain.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`rpc_initrc_domtrans_nfsd',`
gen_require(`
type nfsd_initrc_exec_t;
')
init_labeled_script_domtrans($1, nfsd_initrc_exec_t)
')
########################################
## <summary>
## Execute domain in rpcd domain.
## </summary>
## <param name="domain">
## <summary>
## The type of the process performing this action.
## </summary>
## </param>
@ -223,6 +246,24 @@ interface(`rpc_domtrans_rpcd',`
allow rpcd_t $1:process signal;
')
#######################################
## <summary>
## Execute domain in rpcd domain.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`rpc_initrc_domtrans_rpcd',`
gen_require(`
type rpcd_initrc_exec_t;
')
init_labeled_script_domtrans($1, rpcd_initrc_exec_t)
')
########################################
## <summary>
## Read NFS exported content.
@ -236,7 +277,7 @@ interface(`rpc_domtrans_rpcd',`
#
interface(`rpc_read_nfs_content',`
gen_require(`
type nfsd_ro_t, nfsd_rw_t;
type nfsd_ro_t, nfsd_rw_t;
')
allow $1 { nfsd_ro_t nfsd_rw_t }:dir list_dir_perms;
@ -257,7 +298,7 @@ interface(`rpc_read_nfs_content',`
#
interface(`rpc_manage_nfs_rw_content',`
gen_require(`
type nfsd_rw_t;
type nfsd_rw_t;
')
manage_dirs_pattern($1, nfsd_rw_t, nfsd_rw_t)
@ -278,7 +319,7 @@ interface(`rpc_manage_nfs_rw_content',`
#
interface(`rpc_manage_nfs_ro_content',`
gen_require(`
type nfsd_ro_t;
type nfsd_ro_t;
')
manage_dirs_pattern($1, nfsd_ro_t, nfsd_ro_t)
@ -298,7 +339,7 @@ interface(`rpc_manage_nfs_ro_content',`
#
interface(`rpc_udp_rw_nfs_sockets',`
gen_require(`
type nfsd_t;
type nfsd_t;
')
allow $1 nfsd_t:udp_socket rw_socket_perms;

View File

@ -1,5 +1,5 @@
policy_module(rpc, 1.11.0)
policy_module(rpc, 1.11.1)
########################################
#
@ -37,8 +37,14 @@ files_pid_file(rpcd_var_run_t)
# 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);
rpc_domain_template(nfsd)
type nfsd_initrc_exec_t;
init_script_file(nfsd_initrc_exec_t);
type nfsd_rw_t;
files_type(nfsd_rw_t)
@ -53,7 +59,8 @@ files_mountpoint(var_lib_nfs_t)
# RPC local policy
#
allow rpcd_t self:capability { chown dac_override setgid setuid };
allow rpcd_t self:capability { sys_admin chown dac_override setgid setuid };
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;
@ -63,13 +70,14 @@ files_pid_filetrans(rpcd_t, rpcd_var_run_t, file)
# rpc.statd executes sm-notify
can_exec(rpcd_t, rpcd_exec_t)
kernel_read_system_state(rpcd_t)
kernel_read_system_state(rpcd_t)
kernel_read_network_state(rpcd_t)
# for rpc.rquotad
kernel_read_sysctl(rpcd_t)
kernel_request_load_module(gssd_t)
kernel_rw_fs_sysctls(rpcd_t)
kernel_dontaudit_getattr_core_if(rpcd_t)
kernel_signal(rpcd_t)
kernel_signal(rpcd_t)
corecmd_exec_bin(rpcd_t)
@ -79,9 +87,9 @@ files_getattr_all_dirs(rpcd_t)
fs_list_rpc(rpcd_t)
fs_read_rpc_files(rpcd_t)
fs_read_rpc_symlinks(rpcd_t)
fs_rw_rpc_sockets(rpcd_t)
fs_get_all_fs_quotas(rpcd_t)
fs_getattr_all_fs(rpcd_t)
fs_rw_rpc_sockets(rpcd_t)
fs_get_all_fs_quotas(rpcd_t)
fs_getattr_all_fs(rpcd_t)
storage_getattr_fixed_disk_dev(rpcd_t)
@ -93,6 +101,7 @@ seutil_dontaudit_search_config(rpcd_t)
optional_policy(`
automount_signal(rpcd_t)
automount_dontaudit_write_pipes(rpcd_t)
')
optional_policy(`
@ -110,9 +119,9 @@ allow nfsd_t exports_t:file read_file_perms;
allow nfsd_t { nfsd_rw_t nfsd_ro_t }:dir list_dir_perms;
# 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_read_system_state(nfsd_t)
kernel_read_network_state(nfsd_t)
kernel_dontaudit_getattr_core_if(nfsd_t)
corenet_tcp_bind_all_rpc_ports(nfsd_t)
corenet_udp_bind_all_rpc_ports(nfsd_t)
@ -122,19 +131,21 @@ 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)
files_search_pids(nfsd_t)
# for exportfs and rpc.mountd
files_getattr_tmp_dirs(nfsd_t)
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_mount_nfsd_fs(nfsd_t)
fs_search_nfsd_fs(nfsd_t)
fs_getattr_all_fs(nfsd_t)
fs_mount_nfsd_fs(nfsd_t)
fs_search_nfsd_fs(nfsd_t)
fs_getattr_all_fs(nfsd_t)
fs_getattr_all_dirs(nfsd_t)
fs_rw_nfsd_fs(nfsd_t)
fs_rw_nfsd_fs(nfsd_t)
storage_dontaudit_read_fixed_disk(nfsd_t)
storage_raw_read_removable_device(nfsd_t)
# Read access to public_content_t and public_content_rw_t
miscfiles_read_public_files(nfsd_t)
@ -142,13 +153,13 @@ miscfiles_read_public_files(nfsd_t)
# Write access to public_content_t and public_content_rw_t
tunable_policy(`allow_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)
fs_read_noxattr_fs_files(nfsd_t)
auth_manage_all_files_except_shadow(nfsd_t)
')
@ -180,29 +191,34 @@ 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_search_network_sysctl(gssd_t)
kernel_read_network_state_symlinks(gssd_t)
kernel_search_network_sysctl(gssd_t)
kernel_signal(gssd_t)
corecmd_exec_bin(gssd_t)
fs_list_rpc(gssd_t)
fs_rw_rpc_sockets(gssd_t)
fs_read_rpc_files(gssd_t)
fs_list_rpc(gssd_t)
fs_rw_rpc_sockets(gssd_t)
fs_read_rpc_files(gssd_t)
files_list_tmp(gssd_t)
files_read_usr_symlinks(gssd_t)
fs_list_inotifyfs(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_manage_cache(gssd_t)
miscfiles_read_certs(gssd_t)
mount_signal(gssd_t)
userdom_signal_all_users(gssd_t)
tunable_policy(`allow_gssd_read_tmp',`
userdom_list_user_tmp(gssd_t)
userdom_read_user_tmp_files(gssd_t)
userdom_read_user_tmp_symlinks(gssd_t)
userdom_list_user_tmp(gssd_t)
userdom_read_user_tmp_files(gssd_t)
userdom_read_user_tmp_symlinks(gssd_t)
')
optional_policy(`
@ -210,7 +226,7 @@ optional_policy(`
')
optional_policy(`
kerberos_keytab_template(gssd, gssd_t)
kerberos_keytab_template(gssd, gssd_t)
')
optional_policy(`