Chris PeBenito 0c54fc
Chris PeBenito 9d0c9b
policy_module(apt,1.0.1)
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
########################################
Chris PeBenito 0c54fc
#
Chris PeBenito 0c54fc
# Declarations
Chris PeBenito 0c54fc
#
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
type apt_t;
Chris PeBenito 0c54fc
type apt_exec_t;
Chris PeBenito 0c54fc
init_system_domain(apt_t,apt_exec_t)
Chris PeBenito 0c54fc
domain_system_change_exemption(apt_t)
Chris PeBenito 0c54fc
domain_getattr_all_domains(apt_t)
Chris PeBenito 0c54fc
role system_r types apt_t;
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
type apt_tmp_t;
Chris PeBenito 0c54fc
files_tmp_file(apt_tmp_t)
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
type apt_tmpfs_t;
Chris PeBenito 0c54fc
files_tmpfs_file(apt_tmpfs_t)
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
# status files
Chris PeBenito 0c54fc
type apt_var_lib_t alias var_lib_apt_t;
Chris PeBenito 0c54fc
files_type(apt_var_lib_t)
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
# package cache
Chris PeBenito 0c54fc
type apt_var_cache_t alias var_cache_apt_t;
Chris PeBenito 0c54fc
files_type(apt_var_cache_t)
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
########################################
Chris PeBenito 0c54fc
#
Chris PeBenito 0c54fc
# apt Local policy
Chris PeBenito 0c54fc
#
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
allow apt_t self:capability { chown dac_override fowner fsetid };
Chris PeBenito 0c54fc
allow apt_t self:process { signal setpgid fork };
Chris PeBenito 0c54fc
allow apt_t self:fd use;
Chris PeBenito 0c54fc
allow apt_t self:fifo_file rw_file_perms;
Chris PeBenito 0c54fc
allow apt_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 0c54fc
allow apt_t self:unix_stream_socket rw_stream_socket_perms;
Chris PeBenito 0c54fc
allow apt_t self:unix_dgram_socket sendto;
Chris PeBenito 0c54fc
allow apt_t self:unix_stream_socket connectto;
Chris PeBenito 0c54fc
allow apt_t self:udp_socket { connect create_socket_perms };
Chris PeBenito 0c54fc
allow apt_t self:tcp_socket create_stream_socket_perms;
Chris PeBenito 0c54fc
allow apt_t self:shm create_shm_perms;
Chris PeBenito 0c54fc
allow apt_t self:sem create_sem_perms;
Chris PeBenito 0c54fc
allow apt_t self:msgq create_msgq_perms;
Chris PeBenito 0c54fc
allow apt_t self:msg { send receive };
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
# Access /var/cache/apt files
Chris PeBenito 0c54fc
allow apt_t apt_var_cache_t:file create_file_perms;
Chris PeBenito 0c54fc
allow apt_t apt_var_cache_t:dir rw_dir_perms;
Chris PeBenito 0c54fc
files_var_filetrans(apt_t,apt_var_cache_t,dir)
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
allow apt_t apt_tmp_t:dir create_dir_perms;
Chris PeBenito 0c54fc
allow apt_t apt_tmp_t:file create_file_perms;
Chris PeBenito 0c54fc
files_tmp_filetrans(apt_t, apt_tmp_t, { file dir })
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
allow apt_t apt_tmpfs_t:dir create_dir_perms;
Chris PeBenito 0c54fc
allow apt_t apt_tmpfs_t:file create_file_perms;
Chris PeBenito 0c54fc
allow apt_t apt_tmpfs_t:lnk_file create_file_perms;
Chris PeBenito 0c54fc
allow apt_t apt_tmpfs_t:sock_file create_file_perms;
Chris PeBenito 0c54fc
allow apt_t apt_tmpfs_t:fifo_file create_file_perms;
Chris PeBenito 0c54fc
fs_tmpfs_filetrans(apt_t,apt_tmpfs_t,{ dir file lnk_file sock_file fifo_file })
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
# Access /var/lib/apt files
Chris PeBenito 0c54fc
allow apt_t apt_var_lib_t:file create_file_perms;
Chris PeBenito 0c54fc
allow apt_t apt_var_lib_t:dir rw_dir_perms;
Chris PeBenito 0c54fc
files_var_lib_filetrans(apt_t,apt_var_lib_t,dir)
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
kernel_read_system_state(apt_t)
Chris PeBenito 0c54fc
kernel_read_kernel_sysctls(apt_t)
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
# to launch dpkg-preconfigure
Chris PeBenito 0c54fc
corecmd_exec_bin(apt_t)
Chris PeBenito 0c54fc
corecmd_exec_shell(apt_t)
Chris PeBenito 0c54fc
corecmd_exec_sbin(apt_t)
Chris PeBenito 0c54fc
Chris PeBenito 9d0c9b
corenet_non_ipsec_sendrecv(apt_t)
Chris PeBenito 0c54fc
corenet_tcp_sendrecv_all_if(apt_t)
Chris PeBenito 0c54fc
corenet_udp_sendrecv_all_if(apt_t)
Chris PeBenito 0c54fc
corenet_tcp_sendrecv_all_nodes(apt_t)
Chris PeBenito 0c54fc
corenet_udp_sendrecv_all_nodes(apt_t)
Chris PeBenito 0c54fc
corenet_tcp_sendrecv_all_ports(apt_t)
Chris PeBenito 0c54fc
corenet_udp_sendrecv_all_ports(apt_t)
Chris PeBenito 0c54fc
# TODO: reall allow all these?
Chris PeBenito 0c54fc
corenet_tcp_bind_all_nodes(apt_t)
Chris PeBenito 0c54fc
corenet_udp_bind_all_nodes(apt_t)
Chris PeBenito 0c54fc
corenet_tcp_connect_all_ports(apt_t)
Chris PeBenito 9d0c9b
corenet_sendrecv_all_client_packets(apt_t)
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
dev_read_urand(apt_t)
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
files_exec_usr_files(apt_t)
Chris PeBenito 0c54fc
files_read_etc_files(apt_t)
Chris PeBenito 0c54fc
files_read_etc_runtime_files(apt_t)
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
term_list_ptys(apt_t)
Chris PeBenito 0c54fc
term_use_all_terms(apt_t)
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
libs_use_ld_so(apt_t)
Chris PeBenito 0c54fc
libs_use_shared_libs(apt_t)
Chris PeBenito 0c54fc
libs_exec_ld_so(apt_t)
Chris PeBenito 0c54fc
libs_exec_lib_files(apt_t)
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
logging_send_syslog_msg(apt_t)
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
miscfiles_read_localization(apt_t)
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
seutil_use_newrole_fds(apt_t)
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
sysnet_read_config(apt_t)
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
ifdef(`targeted_policy',`
Chris PeBenito 0c54fc
	unconfined_domain(apt_t)
Chris PeBenito 0c54fc
')
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
# with boolean, for cron-apt and such?
Chris PeBenito bb7170
#optional_policy(`
Chris PeBenito 0c54fc
#	cron_system_entry(apt_t,apt_exec_t)
Chris PeBenito 0c54fc
#')
Chris PeBenito 0c54fc
Chris PeBenito bb7170
optional_policy(`
Chris PeBenito 0c54fc
	# dpkg interaction
Chris PeBenito 0c54fc
	dpkg_read_db(apt_t)
Chris PeBenito 0c54fc
	dpkg_domtrans(apt_t)
Chris PeBenito 0c54fc
	dpkg_lock_db(apt_t)
Chris PeBenito 0c54fc
')
Chris PeBenito 0c54fc
Chris PeBenito bb7170
optional_policy(`
Chris PeBenito 0c54fc
	nis_use_ypbind(apt_t)
Chris PeBenito 0c54fc
')
Chris PeBenito 0c54fc
Chris PeBenito bb7170
optional_policy(`
Chris PeBenito 0c54fc
	rpm_read_db(apt_t)
Chris PeBenito 0c54fc
	rpm_domtrans(apt_t)
Chris PeBenito 0c54fc
')