2006-03-08 18:43:05 +00:00
|
|
|
|
2009-08-05 14:59:21 +00:00
|
|
|
policy_module(apt, 1.6.0)
|
2006-03-08 18:43:05 +00:00
|
|
|
|
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Declarations
|
|
|
|
#
|
|
|
|
|
|
|
|
type apt_t;
|
|
|
|
type apt_exec_t;
|
2008-07-23 21:38:39 +00:00
|
|
|
init_system_domain(apt_t, apt_exec_t)
|
2006-03-08 18:43:05 +00:00
|
|
|
domain_system_change_exemption(apt_t)
|
|
|
|
role system_r types apt_t;
|
|
|
|
|
2008-03-04 19:48:58 +00:00
|
|
|
# pseudo terminal for running dpkg
|
|
|
|
type apt_devpts_t;
|
|
|
|
term_pty(apt_devpts_t)
|
|
|
|
|
2009-07-29 19:12:48 +00:00
|
|
|
# aptitude lock file
|
|
|
|
type apt_lock_t;
|
|
|
|
files_lock_file(apt_lock_t)
|
|
|
|
|
2006-03-08 18:43:05 +00:00
|
|
|
type apt_tmp_t;
|
|
|
|
files_tmp_file(apt_tmp_t)
|
|
|
|
|
|
|
|
type apt_tmpfs_t;
|
|
|
|
files_tmpfs_file(apt_tmpfs_t)
|
|
|
|
|
|
|
|
# package cache
|
|
|
|
type apt_var_cache_t alias var_cache_apt_t;
|
|
|
|
files_type(apt_var_cache_t)
|
|
|
|
|
2009-07-29 19:12:48 +00:00
|
|
|
# status files
|
|
|
|
type apt_var_lib_t alias var_lib_apt_t;
|
|
|
|
files_type(apt_var_lib_t)
|
2009-07-14 19:27:21 +00:00
|
|
|
|
|
|
|
# aptitude log file
|
2008-03-04 19:48:58 +00:00
|
|
|
type apt_var_log_t;
|
|
|
|
logging_log_file(apt_var_log_t)
|
|
|
|
|
2006-03-08 18:43:05 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# apt Local policy
|
|
|
|
#
|
|
|
|
|
|
|
|
allow apt_t self:capability { chown dac_override fowner fsetid };
|
|
|
|
allow apt_t self:process { signal setpgid fork };
|
|
|
|
allow apt_t self:fd use;
|
2006-12-12 20:08:08 +00:00
|
|
|
allow apt_t self:fifo_file rw_fifo_file_perms;
|
2006-03-08 18:43:05 +00:00
|
|
|
allow apt_t self:unix_dgram_socket create_socket_perms;
|
|
|
|
allow apt_t self:unix_stream_socket rw_stream_socket_perms;
|
|
|
|
allow apt_t self:unix_dgram_socket sendto;
|
|
|
|
allow apt_t self:unix_stream_socket connectto;
|
|
|
|
allow apt_t self:udp_socket { connect create_socket_perms };
|
|
|
|
allow apt_t self:tcp_socket create_stream_socket_perms;
|
|
|
|
allow apt_t self:shm create_shm_perms;
|
|
|
|
allow apt_t self:sem create_sem_perms;
|
|
|
|
allow apt_t self:msgq create_msgq_perms;
|
|
|
|
allow apt_t self:msg { send receive };
|
2009-07-14 19:27:21 +00:00
|
|
|
# Run update
|
|
|
|
allow apt_t self:netlink_route_socket r_netlink_socket_perms;
|
|
|
|
|
2009-07-29 19:12:48 +00:00
|
|
|
# lock files
|
|
|
|
allow apt_t apt_lock_t:dir manage_dir_perms;
|
|
|
|
allow apt_t apt_lock_t:file manage_file_perms;
|
2009-07-29 19:24:52 +00:00
|
|
|
files_lock_filetrans(apt_t, apt_lock_t, {dir file})
|
2006-03-08 18:43:05 +00:00
|
|
|
|
2008-07-23 21:38:39 +00:00
|
|
|
manage_dirs_pattern(apt_t, apt_tmp_t, apt_tmp_t)
|
|
|
|
manage_files_pattern(apt_t, apt_tmp_t, apt_tmp_t)
|
2006-03-08 18:43:05 +00:00
|
|
|
files_tmp_filetrans(apt_t, apt_tmp_t, { file dir })
|
|
|
|
|
2008-07-23 21:38:39 +00:00
|
|
|
manage_dirs_pattern(apt_t, apt_tmpfs_t, apt_tmpfs_t)
|
|
|
|
manage_files_pattern(apt_t, apt_tmpfs_t, apt_tmpfs_t)
|
|
|
|
manage_lnk_files_pattern(apt_t, apt_tmpfs_t, apt_tmpfs_t)
|
|
|
|
manage_fifo_files_pattern(apt_t, apt_tmpfs_t, apt_tmpfs_t)
|
|
|
|
manage_sock_files_pattern(apt_t, apt_tmpfs_t, apt_tmpfs_t)
|
|
|
|
fs_tmpfs_filetrans(apt_t, apt_tmpfs_t, { dir file lnk_file sock_file fifo_file })
|
2006-03-08 18:43:05 +00:00
|
|
|
|
2009-07-29 19:12:48 +00:00
|
|
|
# Access /var/cache/apt files
|
|
|
|
manage_files_pattern(apt_t, apt_var_cache_t, apt_var_cache_t)
|
|
|
|
files_var_filetrans(apt_t, apt_var_cache_t, dir)
|
|
|
|
|
2006-03-08 18:43:05 +00:00
|
|
|
# Access /var/lib/apt files
|
2008-07-23 21:38:39 +00:00
|
|
|
manage_files_pattern(apt_t, apt_var_lib_t, apt_var_lib_t)
|
|
|
|
files_var_lib_filetrans(apt_t, apt_var_lib_t, dir)
|
2006-03-08 18:43:05 +00:00
|
|
|
|
2009-07-14 19:27:21 +00:00
|
|
|
# log files
|
|
|
|
allow apt_t apt_var_log_t:file manage_file_perms;
|
2009-07-29 19:12:48 +00:00
|
|
|
logging_log_filetrans(apt_t, apt_var_log_t, file)
|
2009-07-14 19:27:21 +00:00
|
|
|
|
2006-03-08 18:43:05 +00:00
|
|
|
kernel_read_system_state(apt_t)
|
|
|
|
kernel_read_kernel_sysctls(apt_t)
|
|
|
|
|
|
|
|
# to launch dpkg-preconfigure
|
|
|
|
corecmd_exec_bin(apt_t)
|
|
|
|
corecmd_exec_shell(apt_t)
|
|
|
|
|
2007-06-27 15:23:21 +00:00
|
|
|
corenet_all_recvfrom_unlabeled(apt_t)
|
|
|
|
corenet_all_recvfrom_netlabel(apt_t)
|
2009-01-06 20:24:10 +00:00
|
|
|
corenet_tcp_sendrecv_generic_if(apt_t)
|
|
|
|
corenet_udp_sendrecv_generic_if(apt_t)
|
2009-01-09 19:48:02 +00:00
|
|
|
corenet_tcp_sendrecv_generic_node(apt_t)
|
|
|
|
corenet_udp_sendrecv_generic_node(apt_t)
|
2006-03-08 18:43:05 +00:00
|
|
|
corenet_tcp_sendrecv_all_ports(apt_t)
|
|
|
|
corenet_udp_sendrecv_all_ports(apt_t)
|
2009-07-29 19:12:48 +00:00
|
|
|
# TODO: really allow all these?
|
2009-01-09 19:48:02 +00:00
|
|
|
corenet_tcp_bind_generic_node(apt_t)
|
|
|
|
corenet_udp_bind_generic_node(apt_t)
|
2006-03-08 18:43:05 +00:00
|
|
|
corenet_tcp_connect_all_ports(apt_t)
|
2006-05-29 19:53:43 +00:00
|
|
|
corenet_sendrecv_all_client_packets(apt_t)
|
2006-03-08 18:43:05 +00:00
|
|
|
|
|
|
|
dev_read_urand(apt_t)
|
|
|
|
|
2006-09-04 18:22:12 +00:00
|
|
|
domain_getattr_all_domains(apt_t)
|
|
|
|
domain_use_interactive_fds(apt_t)
|
|
|
|
|
2006-03-08 18:43:05 +00:00
|
|
|
files_exec_usr_files(apt_t)
|
|
|
|
files_read_etc_files(apt_t)
|
|
|
|
files_read_etc_runtime_files(apt_t)
|
|
|
|
|
2006-09-13 18:35:10 +00:00
|
|
|
fs_getattr_all_fs(apt_t)
|
2006-09-04 18:22:12 +00:00
|
|
|
|
2008-03-04 19:48:58 +00:00
|
|
|
term_create_pty(apt_t, apt_devpts_t)
|
2006-03-08 18:43:05 +00:00
|
|
|
term_list_ptys(apt_t)
|
|
|
|
term_use_all_terms(apt_t)
|
|
|
|
|
|
|
|
libs_exec_ld_so(apt_t)
|
|
|
|
libs_exec_lib_files(apt_t)
|
|
|
|
|
|
|
|
logging_send_syslog_msg(apt_t)
|
|
|
|
|
|
|
|
miscfiles_read_localization(apt_t)
|
|
|
|
|
|
|
|
seutil_use_newrole_fds(apt_t)
|
|
|
|
|
|
|
|
sysnet_read_config(apt_t)
|
|
|
|
|
2008-11-05 16:10:46 +00:00
|
|
|
userdom_use_user_terminals(apt_t)
|
|
|
|
|
2006-03-08 18:43:05 +00:00
|
|
|
# with boolean, for cron-apt and such?
|
2006-03-24 16:13:54 +00:00
|
|
|
#optional_policy(`
|
2006-03-08 18:43:05 +00:00
|
|
|
# cron_system_entry(apt_t,apt_exec_t)
|
|
|
|
#')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2006-03-08 18:43:05 +00:00
|
|
|
# dpkg interaction
|
|
|
|
dpkg_read_db(apt_t)
|
|
|
|
dpkg_domtrans(apt_t)
|
|
|
|
dpkg_lock_db(apt_t)
|
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2006-03-08 18:43:05 +00:00
|
|
|
nis_use_ypbind(apt_t)
|
|
|
|
')
|
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2006-03-08 18:43:05 +00:00
|
|
|
rpm_read_db(apt_t)
|
|
|
|
rpm_domtrans(apt_t)
|
|
|
|
')
|
2007-10-02 16:04:50 +00:00
|
|
|
|
|
|
|
optional_policy(`
|
|
|
|
unconfined_domain(apt_t)
|
|
|
|
')
|