Chris PeBenito 0c54fc
## <summary>Policy for the Debian package manager.</summary>
Chris PeBenito 0c54fc
# TODO: need debconf policy
Chris PeBenito 0c54fc
# TODO: need install-menu policy
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
########################################
Chris PeBenito 0c54fc
## <summary>
Chris PeBenito 0c54fc
##	Execute dpkg programs in the dpkg 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(`dpkg_domtrans',`
Chris PeBenito 0c54fc
	gen_require(`
Chris PeBenito 0c54fc
		type dpkg_t, dpkg_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,dpkg_exec_t,dpkg_t)
Chris PeBenito 0c54fc
')
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
########################################
Chris PeBenito 0c54fc
## <summary>
Chris PeBenito 0c54fc
##	Execute dpkg_script programs in the dpkg_script domain.
Chris PeBenito 0c54fc
## </summary>
Chris PeBenito 0c54fc
## <param name="domain">
Chris PeBenito 0c54fc
##	<summary>
Chris PeBenito 0c54fc
##	Domain allowed access.
Chris PeBenito 0c54fc
##	</summary>
Chris PeBenito 0c54fc
## </param>
Chris PeBenito 0c54fc
#
Chris PeBenito 0c54fc
interface(`dpkg_domtrans_script',`
Chris PeBenito 0c54fc
	gen_require(`
Chris PeBenito 0c54fc
		type dpkg_script_t;
Chris PeBenito 0c54fc
	')
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
	# transition to dpkg script:
Chris PeBenito 0c54fc
	corecmd_shell_domtrans($1,dpkg_script_t)
Chris PeBenito 0c54fc
	allow dpkg_script_t $1:fd use;
Chris PeBenito 0c54fc
	allow dpkg_script_t $1:fifo_file rw_file_perms;
Chris PeBenito 0c54fc
	allow dpkg_script_t $1:process sigchld;
Chris PeBenito 0c54fc
')
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
########################################
Chris PeBenito 0c54fc
## <summary>
Chris PeBenito 0c54fc
##	Execute dpkg programs in the dpkg 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 dpkg 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 dpkg domain to use.
Chris PeBenito 0c54fc
##	</summary>
Chris PeBenito 0c54fc
## </param>
Chris PeBenito bbcd3c
## <rolecap/>
Chris PeBenito 0c54fc
#
Chris PeBenito 0c54fc
interface(`dpkg_run',`
Chris PeBenito 0c54fc
	gen_require(`
Chris PeBenito 0c54fc
		type dpkg_t, dpkg_script_t;
Chris PeBenito 0c54fc
	')
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
	dpkg_domtrans($1)
Chris PeBenito 0c54fc
	role $2 types dpkg_t;
Chris PeBenito 0c54fc
	role $2 types dpkg_script_t;
Chris PeBenito 0c54fc
	seutil_run_loadpolicy(dpkg_script_t,$2,$3)
Chris PeBenito 0c54fc
	allow dpkg_t $3:chr_file rw_term_perms;
Chris PeBenito 0c54fc
')
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
########################################
Chris PeBenito 0c54fc
## <summary>
Chris PeBenito 0c54fc
##	Inherit and use file descriptors from dpkg.
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(`dpkg_use_fds',`
Chris PeBenito 0c54fc
	gen_require(`
Chris PeBenito 0c54fc
		type dpkg_t;
Chris PeBenito 0c54fc
	')
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
	allow $1 dpkg_t:fd use;
Chris PeBenito 0c54fc
')
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
########################################
Chris PeBenito 0c54fc
## <summary>
Chris PeBenito 0c54fc
##	Read from an unnamed dpkg 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(`dpkg_read_pipes',`
Chris PeBenito 0c54fc
	gen_require(`
Chris PeBenito 0c54fc
		type dpkg_t;
Chris PeBenito 0c54fc
	')
Chris PeBenito 0c54fc
Chris PeBenito c0868a
	allow $1 dpkg_t:fifo_file read_fifo_file_perms;
Chris PeBenito 0c54fc
')
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
########################################
Chris PeBenito 0c54fc
## <summary>
Chris PeBenito 0c54fc
##	Read and write an unnamed dpkg 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(`dpkg_rw_pipes',`
Chris PeBenito 0c54fc
	gen_require(`
Chris PeBenito 0c54fc
		type dpkg_t;
Chris PeBenito 0c54fc
	')
Chris PeBenito 0c54fc
Chris PeBenito c0868a
	allow $1 dpkg_t:fifo_file rw_fifo_file_perms;
Chris PeBenito 0c54fc
')
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
########################################
Chris PeBenito 0c54fc
## <summary>
Chris PeBenito 0c54fc
##	Inherit and use file descriptors from dpkg scripts.
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(`dpkg_use_script_fds',`
Chris PeBenito 0c54fc
	gen_require(`
Chris PeBenito 0c54fc
		type dpkg_script_t;
Chris PeBenito 0c54fc
	')
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
	allow $1 dpkg_script_t:fd use;
Chris PeBenito 0c54fc
')
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
########################################
Chris PeBenito 0c54fc
## <summary>
Chris PeBenito 0c54fc
##	Read the dpkg 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(`dpkg_read_db',`
Chris PeBenito 0c54fc
	gen_require(`
Chris PeBenito 0c54fc
		type dpkg_var_lib_t;
Chris PeBenito 0c54fc
	')
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
	files_search_var_lib($1)
Chris PeBenito c0868a
	allow $1 dpkg_var_lib_t:dir list_dir_perms;
Chris PeBenito c0868a
	read_files_pattern($1,dpkg_var_lib_t,dpkg_var_lib_t)
Chris PeBenito c0868a
	read_lnk_files_pattern($1,dpkg_var_lib_t,dpkg_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 dpkg 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(`dpkg_manage_db',`
Chris PeBenito 0c54fc
	gen_require(`
Chris PeBenito 0c54fc
		type dpkg_var_lib_t;
Chris PeBenito 0c54fc
	')
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
	files_search_var_lib($1)
Chris PeBenito c0868a
	manage_files_pattern($1,dpkg_var_lib_t,dpkg_var_lib_t)
Chris PeBenito c0868a
	manage_lnk_files_pattern($1,dpkg_var_lib_t,dpkg_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 dpkg 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(`dpkg_dontaudit_manage_db',`
Chris PeBenito 0c54fc
	gen_require(`
Chris PeBenito 0c54fc
		type dpkg_var_lib_t;
Chris PeBenito 0c54fc
	')
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
	dontaudit $1 dpkg_var_lib_t:dir rw_dir_perms;
Chris PeBenito 0c54fc
	dontaudit $1 dpkg_var_lib_t:file manage_file_perms;
Chris PeBenito c0868a
	dontaudit $1 dpkg_var_lib_t:lnk_file manage_lnk_file_perms;
Chris PeBenito 0c54fc
')
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
########################################
Chris PeBenito 0c54fc
## <summary>
Chris PeBenito 0c54fc
##	Lock the dpkg 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(`dpkg_lock_db',`
Chris PeBenito 0c54fc
	gen_require(`
Chris PeBenito ff4085
		type dpkg_lock_t, dpkg_var_lib_t;
Chris PeBenito 0c54fc
	')
Chris PeBenito 0c54fc
Chris PeBenito 0c54fc
	files_search_var_lib($1)
Chris PeBenito c0868a
	allow $1 dpkg_var_lib_t:dir list_dir_perms;
Chris PeBenito 0c54fc
	allow $1 dpkg_lock_t:file { getattr create read write append unlink lock };
Chris PeBenito 0c54fc
')