Chris PeBenito 9570b2
policy_module(apt, 1.6.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 0bfccd
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 b5aaa7
# aptitude lock file
Chris PeBenito b5aaa7
type apt_lock_t;
Chris PeBenito b5aaa7
files_lock_file(apt_lock_t)
Chris PeBenito b5aaa7
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
# 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 b5aaa7
# status files
Chris PeBenito b5aaa7
type apt_var_lib_t alias var_lib_apt_t;
Chris PeBenito b5aaa7
files_type(apt_var_lib_t)
Manoj Srivastava 6a192f
Manoj Srivastava 6a192f
# aptitude log file
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 };
Manoj Srivastava 6a192f
# Run update
Manoj Srivastava 6a192f
allow apt_t self:netlink_route_socket r_netlink_socket_perms;
Manoj Srivastava 6a192f
Chris PeBenito b5aaa7
# lock files
Chris PeBenito b5aaa7
allow apt_t apt_lock_t:dir manage_dir_perms;
Chris PeBenito b5aaa7
allow apt_t apt_lock_t:file manage_file_perms;
Chris PeBenito 2a4740
files_lock_filetrans(apt_t, apt_lock_t, {dir file})
Chris PeBenito 0c54fc
Chris PeBenito 0bfccd
manage_dirs_pattern(apt_t, apt_tmp_t, apt_tmp_t)
Chris PeBenito 0bfccd
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 0bfccd
manage_dirs_pattern(apt_t, apt_tmpfs_t, apt_tmpfs_t)
Chris PeBenito 0bfccd
manage_files_pattern(apt_t, apt_tmpfs_t, apt_tmpfs_t)
Chris PeBenito 0bfccd
manage_lnk_files_pattern(apt_t, apt_tmpfs_t, apt_tmpfs_t)
Chris PeBenito 0bfccd
manage_fifo_files_pattern(apt_t, apt_tmpfs_t, apt_tmpfs_t)
Chris PeBenito 0bfccd
manage_sock_files_pattern(apt_t, apt_tmpfs_t, apt_tmpfs_t)
Chris PeBenito 0bfccd
fs_tmpfs_filetrans(apt_t, apt_tmpfs_t, { dir file lnk_file sock_file fifo_file })
Chris PeBenito 0c54fc
Chris PeBenito b5aaa7
# Access /var/cache/apt files
Chris PeBenito b5aaa7
manage_files_pattern(apt_t, apt_var_cache_t, apt_var_cache_t)
Chris PeBenito b5aaa7
files_var_filetrans(apt_t, apt_var_cache_t, dir)
Chris PeBenito b5aaa7
Chris PeBenito 0c54fc
# Access /var/lib/apt files
Chris PeBenito 0bfccd
manage_files_pattern(apt_t, apt_var_lib_t, apt_var_lib_t)
Chris PeBenito 0bfccd
files_var_lib_filetrans(apt_t, apt_var_lib_t, dir)
Chris PeBenito 0c54fc
Manoj Srivastava 6a192f
# log files
Manoj Srivastava 6a192f
allow apt_t apt_var_log_t:file manage_file_perms;
Chris PeBenito b5aaa7
logging_log_filetrans(apt_t, apt_var_log_t, file)
Manoj Srivastava 6a192f
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 668b30
corenet_tcp_sendrecv_generic_if(apt_t)
Chris PeBenito 668b30
corenet_udp_sendrecv_generic_if(apt_t)
Chris PeBenito c12621
corenet_tcp_sendrecv_generic_node(apt_t)
Chris PeBenito c12621
corenet_udp_sendrecv_generic_node(apt_t)
Chris PeBenito 0c54fc
corenet_tcp_sendrecv_all_ports(apt_t)
Chris PeBenito 0c54fc
corenet_udp_sendrecv_all_ports(apt_t)
Chris PeBenito b5aaa7
# TODO: really allow all these?
Chris PeBenito c12621
corenet_tcp_bind_generic_node(apt_t)
Chris PeBenito c12621
corenet_udp_bind_generic_node(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_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 296273
userdom_use_user_terminals(apt_t)
Chris PeBenito 296273
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
')