Chris PeBenito b5aaa7
## <summary>APT advanced package tool.</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>
Dominick Grift 77e4b5
##	Domain allowed to transition.
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 0bfccd
	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>
Dominick Grift 77e4b5
##	Domain allowed to transition.
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 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
	# 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 a72e42
##	Domain allowed access.
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>
Manoj Srivastava 6a192f
##	Do not audit attempts to use file descriptors from apt.
Manoj Srivastava 6a192f
## </summary>
Manoj Srivastava 6a192f
## <param name="domain">
Manoj Srivastava 6a192f
##	<summary>
Dominick Grift 77e4b5
##	Domain to not audit.
Manoj Srivastava 6a192f
##	</summary>
Manoj Srivastava 6a192f
## </param>
Manoj Srivastava 6a192f
#
Manoj Srivastava 6a192f
interface(`apt_dontaudit_use_fds',`
Manoj Srivastava 6a192f
	gen_require(`
Manoj Srivastava 6a192f
		type apt_t;
Manoj Srivastava 6a192f
	')
Manoj Srivastava 6a192f
Manoj Srivastava 6a192f
	dontaudit $1 apt_t:fd use;
Manoj Srivastava 6a192f
')
Manoj Srivastava 6a192f
Manoj Srivastava 6a192f
########################################
Manoj Srivastava 6a192f
## <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 a72e42
##	Domain allowed access.
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 a72e42
##	Domain allowed access.
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 e065ac
##	Read from and write to apt ptys.
Chris PeBenito e065ac
## </summary>
Chris PeBenito e065ac
## <param name="domain">
Chris PeBenito e065ac
##	<summary>
Chris PeBenito e065ac
##	Domain allowed access.
Chris PeBenito e065ac
##	</summary>
Chris PeBenito e065ac
## </param>
Chris PeBenito e065ac
#
Chris PeBenito e065ac
interface(`apt_use_ptys',`
Chris PeBenito e065ac
	gen_require(`
Chris PeBenito e065ac
		type apt_devpts_t;
Chris PeBenito e065ac
	')
Chris PeBenito e065ac
Chris PeBenito e065ac
	allow $1 apt_devpts_t:chr_file rw_term_perms;
Chris PeBenito e065ac
')
Chris PeBenito e065ac
Chris PeBenito e065ac
########################################
Chris PeBenito e065ac
## <summary>
Manoj Srivastava 6a192f
##	Read the apt package cache.
Manoj Srivastava 6a192f
## </summary>
Manoj Srivastava 6a192f
## <param name="domain">
Manoj Srivastava 6a192f
##	<summary>
Chris PeBenito a72e42
##	Domain allowed access.
Manoj Srivastava 6a192f
##	</summary>
Manoj Srivastava 6a192f
## </param>
Manoj Srivastava 6a192f
#
Manoj Srivastava 6a192f
interface(`apt_read_cache',`
Manoj Srivastava 6a192f
	gen_require(`
Manoj Srivastava 6a192f
		type apt_var_cache_t;
Manoj Srivastava 6a192f
	')
Manoj Srivastava 6a192f
Manoj Srivastava 6a192f
	files_search_var($1)
Manoj Srivastava 6a192f
	allow $1 apt_var_cache_t:dir list_dir_perms;
Manoj Srivastava 6a192f
	dontaudit $1 apt_var_cache_t:dir write;
Manoj Srivastava 6a192f
	allow $1 apt_var_cache_t:file read_file_perms;
Manoj Srivastava 6a192f
')
Manoj Srivastava 6a192f
Manoj Srivastava 6a192f
########################################
Manoj Srivastava 6a192f
## <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 a72e42
##	Domain allowed access.
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 0bfccd
	read_files_pattern($1, apt_var_lib_t, apt_var_lib_t)
Chris PeBenito 0bfccd
	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 a72e42
##	Domain allowed access.
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 0bfccd
	manage_files_pattern($1, apt_var_lib_t, apt_var_lib_t)
Chris PeBenito c0868a
	# cjp: shouldnt this be manage_lnk_files?
Chris PeBenito 0bfccd
	rw_lnk_files_pattern($1, apt_var_lib_t, apt_var_lib_t)
Chris PeBenito 0bfccd
	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 b34db7
	dontaudit $1 apt_var_lib_t:lnk_file manage_lnk_file_perms;
Chris PeBenito 0c54fc
')