Chris PeBenito 0c54fc
Chris PeBenito 0a14f3
policy_module(apt,1.4.0)
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
role system_r types apt_t;
Chris PeBenito 0c54fc
Chris PeBenito e065ac
# pseudo terminal for running dpkg
Chris PeBenito e065ac
type apt_devpts_t;
Chris PeBenito e065ac
term_pty(apt_devpts_t)
Chris PeBenito e065ac
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 e065ac
type apt_var_log_t;
Chris PeBenito e065ac
logging_log_file(apt_var_log_t)
Chris PeBenito e065ac
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 c0868a
allow apt_t self:fifo_file rw_fifo_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 c0868a
manage_files_pattern(apt_t,apt_var_cache_t,apt_var_cache_t)
Chris PeBenito 0c54fc
files_var_filetrans(apt_t,apt_var_cache_t,dir)
Chris PeBenito 0c54fc
Chris PeBenito c0868a
manage_dirs_pattern(apt_t,apt_tmp_t,apt_tmp_t)
Chris PeBenito c0868a
manage_files_pattern(apt_t,apt_tmp_t,apt_tmp_t)
Chris PeBenito 0c54fc
files_tmp_filetrans(apt_t, apt_tmp_t, { file dir })
Chris PeBenito 0c54fc
Chris PeBenito c0868a
manage_dirs_pattern(apt_t,apt_tmpfs_t,apt_tmpfs_t)
Chris PeBenito c0868a
manage_files_pattern(apt_t,apt_tmpfs_t,apt_tmpfs_t)
Chris PeBenito c0868a
manage_lnk_files_pattern(apt_t,apt_tmpfs_t,apt_tmpfs_t)
Chris PeBenito c0868a
manage_fifo_files_pattern(apt_t,apt_tmpfs_t,apt_tmpfs_t)
Chris PeBenito c0868a
manage_sock_files_pattern(apt_t,apt_tmpfs_t,apt_tmpfs_t)
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 c0868a
manage_files_pattern(apt_t,apt_var_lib_t,apt_var_lib_t)
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
Chris PeBenito 190066
corenet_all_recvfrom_unlabeled(apt_t)
Chris PeBenito 190066
corenet_all_recvfrom_netlabel(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 13d7ce
domain_getattr_all_domains(apt_t)
Chris PeBenito 13d7ce
domain_use_interactive_fds(apt_t)
Chris PeBenito 13d7ce
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 73ca55
fs_getattr_all_fs(apt_t)
Chris PeBenito 13d7ce
Chris PeBenito e065ac
term_create_pty(apt_t, apt_devpts_t)
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
# 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
')
Chris PeBenito 350b6a
Chris PeBenito 350b6a
optional_policy(`
Chris PeBenito 350b6a
	unconfined_domain(apt_t)
Chris PeBenito 350b6a
')