selinux-refpolicy/policy/modules/apps/gift.if

197 lines
5.6 KiB
Plaintext
Raw Normal View History

2006-04-24 20:21:27 +00:00
## <summary>giFT peer to peer file sharing tool</summary>
#######################################
## <summary>
2006-09-06 22:07:25 +00:00
## The per role template for the gift module.
2006-04-24 20:21:27 +00:00
## </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>
#
2006-09-06 22:07:25 +00:00
template(`gift_per_role_template',`
2006-04-24 20:21:27 +00:00
##############################
#
# Declarations
#
type $1_gift_t;
application_domain($1_gift_t, gift_exec_t)
2006-04-24 20:21:27 +00:00
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)
2006-04-24 20:21:27 +00:00
type $1_gift_tmpfs_t;
files_tmpfs_file($1_gift_tmpfs_t)
type $1_giftd_t;
application_domain($1_giftd_t, giftd_exec_t)
2006-04-24 20:21:27 +00:00
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 })
2006-04-24 20:21:27 +00:00
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)
2006-04-24 20:21:27 +00:00
# Launch gift daemon
2006-12-12 20:08:08 +00:00
domtrans_pattern($1_gift_t, giftd_exec_t, $1_giftd_t)
2006-04-24 20:21:27 +00:00
# transition from user domain
2006-12-12 20:08:08 +00:00
domtrans_pattern($2, gift_exec_t, $1_gift_t)
2006-04-24 20:21:27 +00:00
# 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)
2006-04-24 20:21:27 +00:00
# Allow the user domain to signal/ps.
ps_process_pattern($2, $1_gift_t)
2006-12-12 20:08:08 +00:00
allow $2 $1_gift_t:process signal_perms;
2006-04-24 20:21:27 +00:00
# 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)
2006-04-24 20:21:27 +00:00
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)
2006-05-29 18:25:58 +00:00
corenet_sendrecv_giftd_client_packets($1_gift_t)
2006-04-24 20:21:27 +00:00
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)
2006-04-24 20:21:27 +00:00
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_x_domain_template($1, $1_gift, $1_gift_t, $1_gift_tmpfs_t)
2006-04-24 20:21:27 +00:00
')
##############################
#
# 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)
2006-04-24 20:21:27 +00:00
2006-12-12 20:08:08 +00:00
domtrans_pattern($2, giftd_exec_t, $1_giftd_t)
2006-04-24 20:21:27 +00:00
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)
2006-04-24 20:21:27 +00:00
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)
2006-05-29 18:25:58 +00:00
corenet_sendrecv_all_client_packets($1_giftd_t)
2006-04-24 20:21:27 +00:00
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)
')
')