Chris PeBenito 0c54fc
## <summary>APT advanced package toll.</summary>
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
########################################
Chris PeBenito 0c54fc
## <summary>
Chris PeBenito 0c54fc
##	Execute apt programs in the apt domain.
Chris PeBenito 0c54fc
## </summary>
Chris PeBenito 0c54fc
## <param name="domain">
Chris PeBenito 0c54fc
##	<summary>
Chris PeBenito 0c54fc
##	The type of the process performing this action.
Chris PeBenito 0c54fc
##	</summary>
Chris PeBenito 0c54fc
## </param>
Chris PeBenito 0c54fc
#
Chris PeBenito 0c54fc
interface(`apt_domtrans',`
Chris PeBenito 0c54fc
	gen_require(`
Chris PeBenito 0c54fc
		type apt_t, apt_exec_t;
Chris PeBenito 0c54fc
	')
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
	files_search_usr($1)
Chris PeBenito 0c54fc
	corecmd_search_bin($1)
Chris PeBenito 0c54fc
	domain_auto_trans($1,apt_exec_t,apt_t)
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
	# allow basic communication
Chris PeBenito 0c54fc
	allow $1 apt_t:fd use;
Chris PeBenito 0c54fc
	allow apt_t $1:fd use;
Chris PeBenito 0c54fc
	allow apt_t $1:fifo_file rw_file_perms;
Chris PeBenito 0c54fc
	allow apt_t $1:process sigchld;
Chris PeBenito 0c54fc
')
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
########################################
Chris PeBenito 0c54fc
## <summary>
Chris PeBenito 0c54fc
##	Execute apt programs in the apt domain.
Chris PeBenito 0c54fc
## </summary>
Chris PeBenito 0c54fc
## <param name="domain">
Chris PeBenito 0c54fc
##	<summary>
Chris PeBenito 0c54fc
##	The type of the process performing this action.
Chris PeBenito 0c54fc
##	</summary>
Chris PeBenito 0c54fc
## </param>
Chris PeBenito 0c54fc
## <param name="role">
Chris PeBenito 0c54fc
##	<summary>
Chris PeBenito 0c54fc
##	The role to allow the apt domain.
Chris PeBenito 0c54fc
##	</summary>
Chris PeBenito 0c54fc
## </param>
Chris PeBenito 0c54fc
## <param name="terminal">
Chris PeBenito 0c54fc
##	<summary>
Chris PeBenito 0c54fc
##	The type of the terminal allow the apt domain to use.
Chris PeBenito 0c54fc
##	</summary>
Chris PeBenito 0c54fc
## </param>
Chris PeBenito 0c54fc
#
Chris PeBenito 0c54fc
interface(`apt_run',`
Chris PeBenito 0c54fc
	gen_require(`
Chris PeBenito 0c54fc
		type apt_t;
Chris PeBenito 0c54fc
	')
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
	apt_domtrans($1)
Chris PeBenito 0c54fc
	role $2 types apt_t;
Chris PeBenito 0c54fc
	allow apt_t $3:chr_file rw_term_perms;
Chris PeBenito 0c54fc
	# TODO: likely have to add dpkg_run here.
Chris PeBenito 0c54fc
')
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
########################################
Chris PeBenito 0c54fc
## <summary>
Chris PeBenito 0c54fc
##	Inherit and use file descriptors from apt.
Chris PeBenito 0c54fc
## </summary>
Chris PeBenito 0c54fc
## <param name="domain">
Chris PeBenito 0c54fc
##	<summary>
Chris PeBenito 0c54fc
##	The type of the process performing this action.
Chris PeBenito 0c54fc
##	</summary>
Chris PeBenito 0c54fc
## </param>
Chris PeBenito 0c54fc
#
Chris PeBenito 0c54fc
interface(`apt_use_fds',`
Chris PeBenito 0c54fc
	gen_require(`
Chris PeBenito 0c54fc
		type apt_t;
Chris PeBenito 0c54fc
	')
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
	allow $1 apt_t:fd use;
Chris PeBenito 0c54fc
	# TODO: enforce dpkg_use_fd?
Chris PeBenito 0c54fc
')
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
########################################
Chris PeBenito 0c54fc
## <summary>
Chris PeBenito 0c54fc
##	Read from an unnamed apt pipe.
Chris PeBenito 0c54fc
## </summary>
Chris PeBenito 0c54fc
## <param name="domain">
Chris PeBenito 0c54fc
##	<summary>
Chris PeBenito 0c54fc
##	The type of the process performing this action.
Chris PeBenito 0c54fc
##	</summary>
Chris PeBenito 0c54fc
## </param>
Chris PeBenito 0c54fc
#
Chris PeBenito 0c54fc
interface(`apt_read_pipes',`
Chris PeBenito 0c54fc
	gen_require(`
Chris PeBenito 0c54fc
		type apt_t;
Chris PeBenito 0c54fc
	')
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
	allow $1 apt_t:fifo_file r_file_perms;
Chris PeBenito 0c54fc
	# TODO: enforce dpkg_read_pipes?
Chris PeBenito 0c54fc
')
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
########################################
Chris PeBenito 0c54fc
## <summary>
Chris PeBenito 0c54fc
##	Read and write an unnamed apt pipe.
Chris PeBenito 0c54fc
## </summary>
Chris PeBenito 0c54fc
## <param name="domain">
Chris PeBenito 0c54fc
##	<summary>
Chris PeBenito 0c54fc
##	The type of the process performing this action.
Chris PeBenito 0c54fc
##	</summary>
Chris PeBenito 0c54fc
## </param>
Chris PeBenito 0c54fc
#
Chris PeBenito 0c54fc
interface(`apt_rw_pipes',`
Chris PeBenito 0c54fc
	gen_require(`
Chris PeBenito 0c54fc
		type apt_t;
Chris PeBenito 0c54fc
	')
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
	allow $1 apt_t:fifo_file rw_file_perms;
Chris PeBenito 0c54fc
	# TODO: enforce dpkg_rw_pipes?
Chris PeBenito 0c54fc
')
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
########################################
Chris PeBenito 0c54fc
## <summary>
Chris PeBenito 0c54fc
##	Read the apt package database.
Chris PeBenito 0c54fc
## </summary>
Chris PeBenito 0c54fc
## <param name="domain">
Chris PeBenito 0c54fc
##	<summary>
Chris PeBenito 0c54fc
##	The type of the process performing this action.
Chris PeBenito 0c54fc
##	</summary>
Chris PeBenito 0c54fc
## </param>
Chris PeBenito 0c54fc
#
Chris PeBenito 0c54fc
interface(`apt_read_db',`
Chris PeBenito 0c54fc
	gen_require(`
Chris PeBenito 0c54fc
		type apt_var_lib_t;
Chris PeBenito 0c54fc
	')
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
	files_search_var_lib($1)
Chris PeBenito 0c54fc
	allow $1 apt_var_lib_t:dir r_dir_perms;
Chris PeBenito 0c54fc
	allow $1 apt_var_lib_t:file { getattr read };
Chris PeBenito 0c54fc
	allow $1 apt_var_lib_t:lnk_file r_file_perms;
Chris PeBenito 0c54fc
')
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
########################################
Chris PeBenito 0c54fc
## <summary>
Chris PeBenito 0c54fc
##	Create, read, write, and delete the apt package database.
Chris PeBenito 0c54fc
## </summary>
Chris PeBenito 0c54fc
## <param name="domain">
Chris PeBenito 0c54fc
##	<summary>
Chris PeBenito 0c54fc
##	The type of the process performing this action.
Chris PeBenito 0c54fc
##	</summary>
Chris PeBenito 0c54fc
## </param>
Chris PeBenito 0c54fc
#
Chris PeBenito 0c54fc
interface(`apt_manage_db',`
Chris PeBenito 0c54fc
	gen_require(`
Chris PeBenito 0c54fc
		type apt_var_lib_t;
Chris PeBenito 0c54fc
	')
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
	files_search_var_lib($1)
Chris PeBenito 0c54fc
	allow $1 apt_var_lib_t:dir rw_dir_perms;
Chris PeBenito 0c54fc
	allow $1 apt_var_lib_t:file { getattr create read write append unlink };
Chris PeBenito 0c54fc
	allow $1 apt_var_lib_t:lnk_file { getattr read write unlink };
Chris PeBenito 0c54fc
')
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
########################################
Chris PeBenito 0c54fc
## <summary>
Chris PeBenito 0c54fc
##	Do not audit attempts to create, read, 
Chris PeBenito 0c54fc
##	write, and delete the apt package database.
Chris PeBenito 0c54fc
## </summary>
Chris PeBenito 0c54fc
## <param name="domain">
Chris PeBenito 0c54fc
##	<summary>
Chris PeBenito 0c54fc
##	Domain to not audit.
Chris PeBenito 0c54fc
##	</summary>
Chris PeBenito 0c54fc
## </param>
Chris PeBenito 0c54fc
#
Chris PeBenito 0c54fc
interface(`apt_dontaudit_manage_db',`
Chris PeBenito 0c54fc
	gen_require(`
Chris PeBenito 0c54fc
		type apt_var_lib_t;
Chris PeBenito 0c54fc
	')
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
	dontaudit $1 apt_var_lib_t:dir rw_dir_perms;
Chris PeBenito 0c54fc
	dontaudit $1 apt_var_lib_t:file create_file_perms;
Chris PeBenito 0c54fc
	dontaudit $1 apt_var_lib_t:lnk_file create_lnk_perms;
Chris PeBenito 0c54fc
')