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 c0868a
	domtrans_pattern($1,apt_exec_t,apt_t)
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 bbcd3c
## <rolecap/>
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 c0868a
	allow $1 apt_t:fifo_file read_fifo_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 c0868a
	allow $1 apt_var_lib_t:dir list_dir_perms;
Chris PeBenito c0868a
	read_files_pattern($1,apt_var_lib_t,apt_var_lib_t)
Chris PeBenito c0868a
	read_lnk_files_pattern($1,apt_var_lib_t,apt_var_lib_t)
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 c0868a
	manage_files_pattern($1,apt_var_lib_t,apt_var_lib_t)
Chris PeBenito c0868a
	# cjp: shouldnt this be manage_lnk_files?
Chris PeBenito c0868a
	rw_lnk_files_pattern($1,apt_var_lib_t,apt_var_lib_t)
Chris PeBenito c0868a
	delete_lnk_files_pattern($1,apt_var_lib_t,apt_var_lib_t)
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 c0868a
	dontaudit $1 apt_var_lib_t:file manage_file_perms;
Chris PeBenito c0868a
	dontaudit $1 apt_var_lib_t:lnk_file manage_lnk_perms;
Chris PeBenito 0c54fc
')