|
Dominick Grift |
d3144af |
## <summary>Package Management System.</summary>
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
########################################
|
|
|
1ec3d1a |
## <summary>
|
|
|
1ec3d1a |
## Execute emerge in the portage domain.
|
|
|
1ec3d1a |
## </summary>
|
|
|
1ec3d1a |
## <param name="domain">
|
|
|
1ec3d1a |
## <summary>
|
|
|
1ec3d1a |
## Domain allowed to transition.
|
|
|
1ec3d1a |
## </summary>
|
|
|
1ec3d1a |
## </param>
|
|
|
1ec3d1a |
#
|
|
|
1ec3d1a |
interface(`portage_domtrans',`
|
|
|
1ec3d1a |
gen_require(`
|
|
|
1ec3d1a |
type portage_t, portage_exec_t;
|
|
|
1ec3d1a |
')
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
corecmd_search_bin($1)
|
|
|
1ec3d1a |
domtrans_pattern($1, portage_exec_t, portage_t)
|
|
|
1ec3d1a |
')
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
########################################
|
|
|
1ec3d1a |
## <summary>
|
|
Dominick Grift |
d3144af |
## Execute emerge in the portage domain,
|
|
Dominick Grift |
d3144af |
## and allow the specified role the
|
|
Dominick Grift |
d3144af |
## portage domain.
|
|
|
1ec3d1a |
## </summary>
|
|
|
1ec3d1a |
## <param name="domain">
|
|
|
1ec3d1a |
## <summary>
|
|
|
1ec3d1a |
## Domain allowed to transition.
|
|
|
1ec3d1a |
## </summary>
|
|
|
1ec3d1a |
## </param>
|
|
|
1ec3d1a |
## <param name="role">
|
|
|
1ec3d1a |
## <summary>
|
|
Dominick Grift |
d3144af |
## Role allowed access.
|
|
|
1ec3d1a |
## </summary>
|
|
|
1ec3d1a |
## </param>
|
|
|
1ec3d1a |
## <rolecap/>
|
|
|
1ec3d1a |
#
|
|
|
1ec3d1a |
interface(`portage_run',`
|
|
|
1ec3d1a |
gen_require(`
|
|
|
b43f464 |
attribute_role portage_roles;
|
|
Chris PeBenito |
9401ae1 |
')
|
|
Chris PeBenito |
9401ae1 |
|
|
|
b43f464 |
portage_domtrans($1)
|
|
|
b43f464 |
roleattribute $2 portage_roles;
|
|
|
1ec3d1a |
')
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
########################################
|
|
|
1ec3d1a |
## <summary>
|
|
|
1ec3d1a |
## Template for portage sandbox.
|
|
|
1ec3d1a |
## </summary>
|
|
|
1ec3d1a |
## <desc>
|
|
|
1ec3d1a |
##
|
|
|
1ec3d1a |
## Template for portage sandbox. Portage
|
|
|
1ec3d1a |
## does all compiling in the sandbox.
|
|
|
1ec3d1a |
##
|
|
|
1ec3d1a |
## </desc>
|
|
|
1ec3d1a |
## <param name="domain">
|
|
|
1ec3d1a |
## <summary>
|
|
|
1ec3d1a |
## Domain Allowed Access
|
|
|
1ec3d1a |
## </summary>
|
|
|
1ec3d1a |
## </param>
|
|
|
1ec3d1a |
#
|
|
|
1ec3d1a |
interface(`portage_compile_domain',`
|
|
|
1ec3d1a |
gen_require(`
|
|
|
1ec3d1a |
class dbus send_msg;
|
|
Chris PeBenito |
9401ae1 |
type portage_devpts_t, portage_log_t, portage_srcrepo_t, portage_tmp_t;
|
|
|
1ec3d1a |
type portage_tmpfs_t;
|
|
|
1ec3d1a |
')
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
allow $1 self:capability { fowner fsetid mknod setgid setuid chown dac_override net_raw };
|
|
|
1ec3d1a |
dontaudit $1 self:capability sys_chroot;
|
|
|
1ec3d1a |
allow $1 self:process { setpgid setsched setrlimit signal_perms execmem setfscreate };
|
|
|
1ec3d1a |
allow $1 self:process ~{ ptrace setcurrent setexec setrlimit execmem execstack execheap };
|
|
|
1ec3d1a |
allow $1 self:fd use;
|
|
|
1ec3d1a |
allow $1 self:fifo_file rw_fifo_file_perms;
|
|
|
1ec3d1a |
allow $1 self:shm create_shm_perms;
|
|
|
1ec3d1a |
allow $1 self:sem create_sem_perms;
|
|
|
1ec3d1a |
allow $1 self:msgq create_msgq_perms;
|
|
|
1ec3d1a |
allow $1 self:msg { send receive };
|
|
|
1ec3d1a |
allow $1 self:unix_dgram_socket create_socket_perms;
|
|
|
1ec3d1a |
allow $1 self:unix_stream_socket create_stream_socket_perms;
|
|
|
1ec3d1a |
allow $1 self:unix_dgram_socket sendto;
|
|
|
1ec3d1a |
allow $1 self:unix_stream_socket connectto;
|
|
|
1ec3d1a |
# really shouldnt need this
|
|
|
1ec3d1a |
allow $1 self:tcp_socket create_stream_socket_perms;
|
|
|
1ec3d1a |
allow $1 self:udp_socket create_socket_perms;
|
|
|
1ec3d1a |
# misc networking stuff (esp needed for compiling perl):
|
|
|
1ec3d1a |
allow $1 self:rawip_socket { create ioctl };
|
|
|
1ec3d1a |
# needed for merging dbus:
|
|
|
1ec3d1a |
allow $1 self:netlink_selinux_socket { bind create read };
|
|
|
1ec3d1a |
allow $1 self:dbus send_msg;
|
|
|
1ec3d1a |
|
|
Dominick Grift |
d3144af |
allow $1 portage_devpts_t:chr_file { rw_chr_file_perms setattr_chr_file_perms };
|
|
|
1ec3d1a |
term_create_pty($1, portage_devpts_t)
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
# write compile logs
|
|
Dominick Grift |
d3144af |
allow $1 portage_log_t:dir setattr_dir_perms;
|
|
Dominick Grift |
d3144af |
allow $1 portage_log_t:file { write_file_perms setattr_file_perms };
|
|
|
1ec3d1a |
|
|
Chris PeBenito |
9401ae1 |
# Support live ebuilds (-9999)
|
|
Chris PeBenito |
9401ae1 |
manage_dirs_pattern($1, portage_srcrepo_t, portage_srcrepo_t)
|
|
Chris PeBenito |
9401ae1 |
manage_files_pattern($1, portage_srcrepo_t, portage_srcrepo_t)
|
|
Chris PeBenito |
9401ae1 |
manage_lnk_files_pattern($1, portage_srcrepo_t, portage_srcrepo_t)
|
|
Chris PeBenito |
9401ae1 |
|
|
|
1ec3d1a |
# run scripts out of the build directory
|
|
|
1ec3d1a |
can_exec(portage_sandbox_t, portage_tmp_t)
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
manage_dirs_pattern($1, portage_tmp_t, portage_tmp_t)
|
|
|
1ec3d1a |
manage_files_pattern($1, portage_tmp_t, portage_tmp_t)
|
|
|
1ec3d1a |
manage_lnk_files_pattern($1, portage_tmp_t, portage_tmp_t)
|
|
|
1ec3d1a |
manage_fifo_files_pattern($1, portage_tmp_t, portage_tmp_t)
|
|
|
1ec3d1a |
manage_sock_files_pattern($1, portage_tmp_t, portage_tmp_t)
|
|
|
1ec3d1a |
files_tmp_filetrans($1, portage_tmp_t, { dir file lnk_file sock_file fifo_file })
|
|
|
1ec3d1a |
# SELinux-enabled programs running in the sandbox
|
|
|
1ec3d1a |
allow $1 portage_tmp_t:file relabel_file_perms;
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
manage_files_pattern($1, portage_tmpfs_t, portage_tmpfs_t)
|
|
|
1ec3d1a |
manage_lnk_files_pattern($1, portage_tmpfs_t, portage_tmpfs_t)
|
|
|
1ec3d1a |
manage_fifo_files_pattern($1, portage_tmpfs_t, portage_tmpfs_t)
|
|
|
1ec3d1a |
manage_sock_files_pattern($1, portage_tmpfs_t, portage_tmpfs_t)
|
|
|
1ec3d1a |
fs_tmpfs_filetrans($1, portage_tmpfs_t, { dir file lnk_file sock_file fifo_file })
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
kernel_read_system_state($1)
|
|
|
1ec3d1a |
kernel_read_network_state($1)
|
|
|
1ec3d1a |
kernel_read_software_raid_state($1)
|
|
|
1ec3d1a |
kernel_getattr_core_if($1)
|
|
|
1ec3d1a |
kernel_getattr_message_if($1)
|
|
|
1ec3d1a |
kernel_read_kernel_sysctls($1)
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
corecmd_exec_all_executables($1)
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
# really shouldnt need this but some packages test
|
|
|
1ec3d1a |
# network access, such as during configure
|
|
|
1ec3d1a |
# also distcc--need to reinvestigate confining distcc client
|
|
|
b43f464 |
corenet_all_recvfrom_unlabeled($1)
|
|
|
1ec3d1a |
corenet_all_recvfrom_netlabel($1)
|
|
|
1ec3d1a |
corenet_tcp_sendrecv_generic_if($1)
|
|
|
1ec3d1a |
corenet_udp_sendrecv_generic_if($1)
|
|
|
1ec3d1a |
corenet_raw_sendrecv_generic_if($1)
|
|
|
1ec3d1a |
corenet_tcp_sendrecv_generic_node($1)
|
|
|
1ec3d1a |
corenet_udp_sendrecv_generic_node($1)
|
|
|
1ec3d1a |
corenet_raw_sendrecv_generic_node($1)
|
|
|
1ec3d1a |
corenet_tcp_sendrecv_all_ports($1)
|
|
|
1ec3d1a |
corenet_udp_sendrecv_all_ports($1)
|
|
|
1ec3d1a |
corenet_tcp_connect_all_reserved_ports($1)
|
|
|
1ec3d1a |
corenet_tcp_connect_distccd_port($1)
|
|
Sven Vermeulen |
fd0d760 |
corenet_tcp_connect_git_port($1)
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
dev_read_sysfs($1)
|
|
|
1ec3d1a |
dev_read_rand($1)
|
|
|
1ec3d1a |
dev_read_urand($1)
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
domain_use_interactive_fds($1)
|
|
|
1ec3d1a |
domain_dontaudit_read_all_domains_state($1)
|
|
|
1ec3d1a |
# SELinux-aware installs doing relabels in the sandbox
|
|
|
1ec3d1a |
domain_obj_id_change_exemption($1)
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
files_exec_etc_files($1)
|
|
|
1ec3d1a |
files_exec_usr_src_files($1)
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
fs_getattr_xattr_fs($1)
|
|
|
1ec3d1a |
fs_list_noxattr_fs($1)
|
|
|
1ec3d1a |
fs_read_noxattr_fs_files($1)
|
|
|
1ec3d1a |
fs_read_noxattr_fs_symlinks($1)
|
|
|
1ec3d1a |
fs_search_auto_mountpoints($1)
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
selinux_validate_context($1)
|
|
|
1ec3d1a |
# needed for merging dbus:
|
|
|
1ec3d1a |
selinux_compute_access_vector($1)
|
|
|
1ec3d1a |
|
|
James Carter |
6a26a93 |
files_list_non_auth_dirs($1)
|
|
James Carter |
6a26a93 |
files_read_non_auth_files($1)
|
|
James Carter |
6a26a93 |
files_read_non_auth_symlinks($1)
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
libs_exec_lib_files($1)
|
|
|
1ec3d1a |
# some config scripts use ldd
|
|
|
1ec3d1a |
libs_exec_ld_so($1)
|
|
Sven Vermeulen |
22dd658 |
libs_exec_ldconfig($1)
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
logging_send_syslog_msg($1)
|
|
|
1ec3d1a |
|
|
Chris PeBenito |
9401ae1 |
userdom_use_user_terminals($1)
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
# SELinux-enabled programs running in the sandbox
|
|
|
1ec3d1a |
seutil_libselinux_linked($1)
|
|
|
1ec3d1a |
|
|
Chris PeBenito |
9401ae1 |
tunable_policy(`portage_use_nfs',`
|
|
Chris PeBenito |
9401ae1 |
fs_getattr_nfs($1)
|
|
Chris PeBenito |
9401ae1 |
fs_manage_nfs_dirs($1)
|
|
Chris PeBenito |
9401ae1 |
fs_manage_nfs_files($1)
|
|
Chris PeBenito |
9401ae1 |
fs_manage_nfs_symlinks($1)
|
|
Chris PeBenito |
9401ae1 |
')
|
|
Chris PeBenito |
9401ae1 |
|
|
|
1ec3d1a |
ifdef(`TODO',`
|
|
|
1ec3d1a |
# some gui ebuilds want to interact with X server, like xawtv
|
|
|
1ec3d1a |
optional_policy(`
|
|
Dominick Grift |
d3144af |
allow $1 xdm_xserver_tmp_t:dir { add_entry_dir_perms del_entry_dir_perms };
|
|
Dominick Grift |
d3144af |
allow $1 xdm_xserver_tmp_t:sock_file { create_file_perms delete_file_perms write_file_perms };
|
|
|
1ec3d1a |
')
|
|
|
1ec3d1a |
') dnl end TODO
|
|
|
1ec3d1a |
')
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
########################################
|
|
|
1ec3d1a |
## <summary>
|
|
Dominick Grift |
d3144af |
## Execute tree management functions
|
|
Dominick Grift |
d3144af |
## (fetching, layman, ...) in the
|
|
Dominick Grift |
d3144af |
## portage fetch domain.
|
|
Sven Vermeulen |
dd4050a |
## </summary>
|
|
Sven Vermeulen |
dd4050a |
## <param name="domain">
|
|
Sven Vermeulen |
dd4050a |
## <summary>
|
|
Sven Vermeulen |
dd4050a |
## Domain allowed to transition.
|
|
Sven Vermeulen |
dd4050a |
## </summary>
|
|
Sven Vermeulen |
dd4050a |
## </param>
|
|
Sven Vermeulen |
dd4050a |
#
|
|
Sven Vermeulen |
dd4050a |
interface(`portage_domtrans_fetch',`
|
|
Sven Vermeulen |
dd4050a |
gen_require(`
|
|
Sven Vermeulen |
dd4050a |
type portage_fetch_t, portage_fetch_exec_t;
|
|
Sven Vermeulen |
dd4050a |
')
|
|
Sven Vermeulen |
dd4050a |
|
|
Sven Vermeulen |
dd4050a |
corecmd_search_bin($1)
|
|
Sven Vermeulen |
dd4050a |
domtrans_pattern($1, portage_fetch_exec_t, portage_fetch_t)
|
|
Sven Vermeulen |
dd4050a |
')
|
|
Sven Vermeulen |
dd4050a |
|
|
Sven Vermeulen |
dd4050a |
########################################
|
|
Sven Vermeulen |
dd4050a |
## <summary>
|
|
Dominick Grift |
d3144af |
## Execute tree management functions
|
|
Dominick Grift |
d3144af |
## (fetching, layman, ...) in the
|
|
Dominick Grift |
d3144af |
## portage fetch domain, and allow
|
|
Dominick Grift |
d3144af |
## the specified role the portage
|
|
Dominick Grift |
d3144af |
## fetch domain.
|
|
Sven Vermeulen |
dd4050a |
## </summary>
|
|
Sven Vermeulen |
dd4050a |
## <param name="domain">
|
|
Sven Vermeulen |
dd4050a |
## <summary>
|
|
Sven Vermeulen |
dd4050a |
## Domain allowed to transition.
|
|
Sven Vermeulen |
dd4050a |
## </summary>
|
|
Sven Vermeulen |
dd4050a |
## </param>
|
|
Sven Vermeulen |
dd4050a |
## <param name="role">
|
|
Sven Vermeulen |
dd4050a |
## <summary>
|
|
Dominick Grift |
d3144af |
## Role allowed access.
|
|
Sven Vermeulen |
dd4050a |
## </summary>
|
|
Sven Vermeulen |
dd4050a |
## </param>
|
|
Sven Vermeulen |
dd4050a |
## <rolecap/>
|
|
Sven Vermeulen |
dd4050a |
#
|
|
Sven Vermeulen |
dd4050a |
interface(`portage_run_fetch',`
|
|
Sven Vermeulen |
dd4050a |
gen_require(`
|
|
Dominick Grift |
d3144af |
attribute_role portage_fetch_roles;
|
|
Sven Vermeulen |
dd4050a |
')
|
|
Sven Vermeulen |
dd4050a |
|
|
Sven Vermeulen |
dd4050a |
portage_domtrans_fetch($1)
|
|
Dominick Grift |
d3144af |
roleattribute $2 portage_fetch_roles;
|
|
Sven Vermeulen |
dd4050a |
')
|
|
Sven Vermeulen |
dd4050a |
|
|
Sven Vermeulen |
dd4050a |
########################################
|
|
Sven Vermeulen |
dd4050a |
## <summary>
|
|
Dominick Grift |
d3144af |
## Execute gcc-config in the gcc config domain.
|
|
|
1ec3d1a |
## </summary>
|
|
|
1ec3d1a |
## <param name="domain">
|
|
|
1ec3d1a |
## <summary>
|
|
|
1ec3d1a |
## Domain allowed to transition.
|
|
|
1ec3d1a |
## </summary>
|
|
|
1ec3d1a |
## </param>
|
|
|
1ec3d1a |
#
|
|
|
1ec3d1a |
interface(`portage_domtrans_gcc_config',`
|
|
|
1ec3d1a |
gen_require(`
|
|
|
1ec3d1a |
type gcc_config_t, gcc_config_exec_t;
|
|
|
1ec3d1a |
')
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
corecmd_search_bin($1)
|
|
|
1ec3d1a |
domtrans_pattern($1, gcc_config_exec_t, gcc_config_t)
|
|
|
1ec3d1a |
')
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
########################################
|
|
|
1ec3d1a |
## <summary>
|
|
Dominick Grift |
d3144af |
## Execute gcc-config in the gcc config
|
|
Dominick Grift |
d3144af |
## domain, and allow the specified role
|
|
Dominick Grift |
d3144af |
## the gcc_config domain.
|
|
|
1ec3d1a |
## </summary>
|
|
|
1ec3d1a |
## <param name="domain">
|
|
|
1ec3d1a |
## <summary>
|
|
|
1ec3d1a |
## Domain allowed to transition.
|
|
|
1ec3d1a |
## </summary>
|
|
|
1ec3d1a |
## </param>
|
|
|
1ec3d1a |
## <param name="role">
|
|
|
1ec3d1a |
## <summary>
|
|
Dominick Grift |
d3144af |
## Role allowed access.
|
|
|
1ec3d1a |
## </summary>
|
|
|
1ec3d1a |
## </param>
|
|
|
1ec3d1a |
## <rolecap/>
|
|
|
1ec3d1a |
#
|
|
|
1ec3d1a |
interface(`portage_run_gcc_config',`
|
|
|
1ec3d1a |
gen_require(`
|
|
Dominick Grift |
d3144af |
attribute_role gcc_config_roles;
|
|
|
1ec3d1a |
')
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
portage_domtrans_gcc_config($1)
|
|
Dominick Grift |
d3144af |
roleattribute $2 gcc_config_roles;
|
|
|
1ec3d1a |
')
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
########################################
|
|
|
1ec3d1a |
## <summary>
|
|
Chris PeBenito |
9401ae1 |
## Do not audit attempts to use
|
|
Chris PeBenito |
9401ae1 |
## portage file descriptors.
|
|
Chris PeBenito |
9401ae1 |
## </summary>
|
|
Chris PeBenito |
9401ae1 |
## <param name="domain">
|
|
Chris PeBenito |
9401ae1 |
## <summary>
|
|
Chris PeBenito |
9401ae1 |
## Domain to not audit.
|
|
Chris PeBenito |
9401ae1 |
## </summary>
|
|
Chris PeBenito |
9401ae1 |
## </param>
|
|
Chris PeBenito |
9401ae1 |
#
|
|
Chris PeBenito |
9401ae1 |
interface(`portage_dontaudit_use_fds',`
|
|
Chris PeBenito |
9401ae1 |
gen_require(`
|
|
Chris PeBenito |
9401ae1 |
type portage_t;
|
|
Chris PeBenito |
9401ae1 |
')
|
|
Chris PeBenito |
9401ae1 |
|
|
Chris PeBenito |
9401ae1 |
dontaudit $1 portage_t:fd use;
|
|
Chris PeBenito |
9401ae1 |
')
|
|
Chris PeBenito |
9401ae1 |
|
|
Chris PeBenito |
9401ae1 |
########################################
|
|
Chris PeBenito |
9401ae1 |
## <summary>
|
|
|
1ec3d1a |
## Do not audit attempts to search the
|
|
|
1ec3d1a |
## portage temporary directories.
|
|
|
1ec3d1a |
## </summary>
|
|
|
1ec3d1a |
## <param name="domain">
|
|
|
1ec3d1a |
## <summary>
|
|
|
1ec3d1a |
## Domain to not audit.
|
|
|
1ec3d1a |
## </summary>
|
|
|
1ec3d1a |
## </param>
|
|
|
1ec3d1a |
#
|
|
|
1ec3d1a |
interface(`portage_dontaudit_search_tmp',`
|
|
|
1ec3d1a |
gen_require(`
|
|
|
1ec3d1a |
type portage_tmp_t;
|
|
|
1ec3d1a |
')
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
dontaudit $1 portage_tmp_t:dir search_dir_perms;
|
|
|
1ec3d1a |
')
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
########################################
|
|
|
1ec3d1a |
## <summary>
|
|
|
1ec3d1a |
## Do not audit attempts to read and write
|
|
|
1ec3d1a |
## the portage temporary files.
|
|
|
1ec3d1a |
## </summary>
|
|
|
1ec3d1a |
## <param name="domain">
|
|
|
1ec3d1a |
## <summary>
|
|
|
1ec3d1a |
## Domain to not audit.
|
|
|
1ec3d1a |
## </summary>
|
|
|
1ec3d1a |
## </param>
|
|
|
1ec3d1a |
#
|
|
|
1ec3d1a |
interface(`portage_dontaudit_rw_tmp_files',`
|
|
|
1ec3d1a |
gen_require(`
|
|
|
1ec3d1a |
type portage_tmp_t;
|
|
|
1ec3d1a |
')
|
|
|
1ec3d1a |
|
|
|
1ec3d1a |
dontaudit $1 portage_tmp_t:file rw_file_perms;
|
|
|
1ec3d1a |
')
|