1900668638
The latest revision of the labeled policy patches which enable both labeled and unlabeled policy support for NetLabel. This revision takes into account Chris' feedback from the first version and reduces the number of interface calls in each domain down to two at present: one for unlabeled access, one for NetLabel access. The older, transport layer specific interfaces, are still present for use by third-party modules but are not used in the default policy modules. trunk: Use netmsg initial SID for MLS-only Netlabel packets, from Paul Moore. This patch changes the policy to use the netmsg initial SID as the "base" SID/context for NetLabel packets which only have MLS security attributes. Currently we use the unlabeled initial SID which makes it very difficult to distinquish between actual unlabeled packets and those packets which have MLS security attributes.
199 lines
5.6 KiB
Plaintext
199 lines
5.6 KiB
Plaintext
## <summary>giFT peer to peer file sharing tool</summary>
|
|
|
|
#######################################
|
|
## <summary>
|
|
## The per role template for the gift module.
|
|
## </summary>
|
|
## <desc>
|
|
## <p>
|
|
## This template creates a derived domains which are used
|
|
## for gift client sessions and gift daemons.
|
|
## </p>
|
|
## <p>
|
|
## This template is invoked automatically for each user, and
|
|
## generally does not need to be invoked directly
|
|
## by policy writers.
|
|
## </p>
|
|
## </desc>
|
|
## <param name="userdomain_prefix">
|
|
## <summary>
|
|
## The prefix of the user domain (e.g., user
|
|
## is the prefix for user_t).
|
|
## </summary>
|
|
## </param>
|
|
## <param name="user_domain">
|
|
## <summary>
|
|
## The type of the user domain.
|
|
## </summary>
|
|
## </param>
|
|
## <param name="user_role">
|
|
## <summary>
|
|
## The role associated with the user domain.
|
|
## </summary>
|
|
## </param>
|
|
#
|
|
template(`gift_per_role_template',`
|
|
|
|
##############################
|
|
#
|
|
# Declarations
|
|
#
|
|
|
|
type $1_gift_t;
|
|
domain_type($1_gift_t)
|
|
domain_entry_file($1_gift_t,gift_exec_t)
|
|
role $3 types $1_gift_t;
|
|
|
|
type $1_gift_home_t alias $1_gift_rw_t;
|
|
files_poly_member($1_gift_home_t)
|
|
userdom_user_home_content($1,$1_gift_home_t)
|
|
|
|
type $1_gift_tmpfs_t;
|
|
files_tmpfs_file($1_gift_tmpfs_t)
|
|
|
|
type $1_giftd_t;
|
|
domain_type($1_giftd_t)
|
|
domain_entry_file($1_giftd_t,giftd_exec_t)
|
|
role $3 types $1_giftd_t;
|
|
|
|
##############################
|
|
#
|
|
# giFT user interface local policy
|
|
#
|
|
|
|
allow $1_gift_t self:tcp_socket create_socket_perms;
|
|
|
|
manage_files_pattern($1_gift_t,$1_gift_tmpfs_t,$1_gift_tmpfs_t)
|
|
manage_lnk_files_pattern($1_gift_t,$1_gift_tmpfs_t,$1_gift_tmpfs_t)
|
|
manage_fifo_files_pattern($1_gift_t,$1_gift_tmpfs_t,$1_gift_tmpfs_t)
|
|
manage_sock_files_pattern($1_gift_t,$1_gift_tmpfs_t,$1_gift_tmpfs_t)
|
|
fs_tmpfs_filetrans($1_gift_t,$1_gift_tmpfs_t,{ dir file lnk_file sock_file fifo_file })
|
|
|
|
manage_dirs_pattern($1_gift_t,$1_gift_home_t,$1_gift_home_t)
|
|
manage_files_pattern($1_gift_t,$1_gift_home_t,$1_gift_home_t)
|
|
manage_lnk_files_pattern($1_gift_t,$1_gift_home_t,$1_gift_home_t)
|
|
userdom_user_home_dir_filetrans($1,$1_gift_t,$1_gift_home_t,dir)
|
|
|
|
# Launch gift daemon
|
|
domtrans_pattern($1_gift_t, giftd_exec_t, $1_giftd_t)
|
|
|
|
# transition from user domain
|
|
domtrans_pattern($2, gift_exec_t, $1_gift_t)
|
|
|
|
# user managed content
|
|
manage_dirs_pattern($2,$1_gift_home_t,$1_gift_home_t)
|
|
manage_files_pattern($2,$1_gift_home_t,$1_gift_home_t)
|
|
manage_lnk_files_pattern($2,$1_gift_home_t,$1_gift_home_t)
|
|
relabel_dirs_pattern($2,$1_gift_home_t,$1_gift_home_t)
|
|
relabel_files_pattern($2,$1_gift_home_t,$1_gift_home_t)
|
|
relabel_lnk_files_pattern($2,$1_gift_home_t,$1_gift_home_t)
|
|
|
|
# Allow the user domain to signal/ps.
|
|
ps_process_pattern($2,$1_gift_t)
|
|
allow $2 $1_gift_t:process signal_perms;
|
|
|
|
# Read /proc/meminfo
|
|
kernel_read_system_state($1_giftd_t)
|
|
|
|
# Connect to gift daemon
|
|
corenet_all_recvfrom_unlabeled($1_gift_t)
|
|
corenet_all_recvfrom_netlabel($1_gift_t)
|
|
corenet_tcp_sendrecv_generic_if($1_gift_t)
|
|
corenet_tcp_sendrecv_all_nodes($1_gift_t)
|
|
corenet_tcp_sendrecv_giftd_port($1_gift_t)
|
|
corenet_tcp_connect_giftd_port($1_gift_t)
|
|
corenet_sendrecv_giftd_client_packets($1_gift_t)
|
|
|
|
fs_search_auto_mountpoints($1_gift_t)
|
|
|
|
sysnet_read_config($1_gift_t)
|
|
|
|
# giftui looks in .icons, .themes.
|
|
userdom_dontaudit_read_user_home_content_files($1,$1_gift_t)
|
|
|
|
tunable_policy(`use_nfs_home_dirs',`
|
|
fs_manage_nfs_dirs($1_gift_t)
|
|
fs_manage_nfs_files($1_gift_t)
|
|
fs_manage_nfs_symlinks($1_gift_t)
|
|
')
|
|
|
|
tunable_policy(`use_samba_home_dirs',`
|
|
fs_manage_cifs_dirs($1_gift_t)
|
|
fs_manage_cifs_files($1_gift_t)
|
|
fs_manage_cifs_symlinks($1_gift_t)
|
|
')
|
|
|
|
# optional_policy(`
|
|
# gnome_user_application($1,$1_gift,$1_gift_t)
|
|
# ')
|
|
|
|
optional_policy(`
|
|
nscd_socket_use($1_gift_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
xserver_user_client_template($1,$1_gift_t,$1_gift_tmpfs_t)
|
|
')
|
|
|
|
##############################
|
|
#
|
|
# giFT server local policy
|
|
#
|
|
|
|
allow $1_giftd_t self:process { signal setsched };
|
|
allow $1_giftd_t self:unix_stream_socket create_socket_perms;
|
|
allow $1_giftd_t self:tcp_socket create_stream_socket_perms;
|
|
allow $1_giftd_t self:udp_socket create_socket_perms;
|
|
|
|
manage_dirs_pattern($1_giftd_t,$1_gift_home_t,$1_gift_home_t)
|
|
manage_files_pattern($1_giftd_t,$1_gift_home_t,$1_gift_home_t)
|
|
manage_lnk_files_pattern($1_giftd_t,$1_gift_home_t,$1_gift_home_t)
|
|
userdom_user_home_dir_filetrans($1,$1_giftd_t,$1_gift_home_t,dir)
|
|
|
|
domtrans_pattern($2, giftd_exec_t, $1_giftd_t)
|
|
|
|
kernel_read_system_state($1_giftd_t)
|
|
kernel_read_kernel_sysctls($1_giftd_t)
|
|
|
|
# Serve content on various p2p networks. Ports can be random.
|
|
corenet_all_recvfrom_unlabeled($1_giftd_t)
|
|
corenet_all_recvfrom_netlabel($1_giftd_t)
|
|
corenet_tcp_sendrecv_generic_if($1_giftd_t)
|
|
corenet_udp_sendrecv_generic_if($1_giftd_t)
|
|
corenet_tcp_sendrecv_all_nodes($1_giftd_t)
|
|
corenet_udp_sendrecv_all_nodes($1_giftd_t)
|
|
corenet_tcp_sendrecv_all_ports($1_giftd_t)
|
|
corenet_udp_sendrecv_all_ports($1_giftd_t)
|
|
corenet_tcp_bind_all_nodes($1_giftd_t)
|
|
corenet_udp_bind_all_nodes($1_giftd_t)
|
|
corenet_tcp_bind_all_ports($1_giftd_t)
|
|
corenet_udp_bind_all_ports($1_giftd_t)
|
|
corenet_tcp_connect_all_ports($1_giftd_t)
|
|
corenet_sendrecv_all_client_packets($1_giftd_t)
|
|
|
|
files_read_usr_files($1_giftd_t)
|
|
# Read /etc/mtab
|
|
files_read_etc_runtime_files($1_giftd_t)
|
|
|
|
libs_use_ld_so($1_giftd_t)
|
|
libs_use_shared_libs($1_giftd_t)
|
|
|
|
miscfiles_read_localization($1_giftd_t)
|
|
|
|
sysnet_read_config($1_giftd_t)
|
|
|
|
userdom_use_user_terminals($1,$1_giftd_t)
|
|
|
|
tunable_policy(`use_nfs_home_dirs',`
|
|
fs_manage_nfs_dirs($1_giftd_t)
|
|
fs_manage_nfs_files($1_giftd_t)
|
|
fs_manage_nfs_symlinks($1_giftd_t)
|
|
')
|
|
|
|
tunable_policy(`use_samba_home_dirs',`
|
|
fs_manage_cifs_dirs($1_giftd_t)
|
|
fs_manage_cifs_files($1_giftd_t)
|
|
fs_manage_cifs_symlinks($1_giftd_t)
|
|
')
|
|
')
|