1ec3d1a
## <summary>Policy for the Debian package manager.</summary>
1ec3d1a
# TODO: need debconf policy
1ec3d1a
# TODO: need install-menu policy
1ec3d1a
1ec3d1a
########################################
1ec3d1a
## <summary>
1ec3d1a
##	Execute dpkg programs in the dpkg domain.
1ec3d1a
## </summary>
1ec3d1a
## <param name="domain">
1ec3d1a
##	<summary>
1ec3d1a
##	Domain allowed to transition.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
#
1ec3d1a
interface(`dpkg_domtrans',`
1ec3d1a
	gen_require(`
1ec3d1a
		type dpkg_t, dpkg_exec_t;
1ec3d1a
	')
1ec3d1a
1ec3d1a
	files_search_usr($1)
1ec3d1a
	corecmd_search_bin($1)
1ec3d1a
	domtrans_pattern($1, dpkg_exec_t, dpkg_t)
1ec3d1a
')
1ec3d1a
1ec3d1a
########################################
1ec3d1a
## <summary>
1ec3d1a
##	Execute dpkg_script programs in the dpkg_script domain.
1ec3d1a
## </summary>
1ec3d1a
## <param name="domain">
1ec3d1a
##	<summary>
1ec3d1a
##	Domain allowed to transition.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
#
1ec3d1a
interface(`dpkg_domtrans_script',`
1ec3d1a
	gen_require(`
1ec3d1a
		type dpkg_script_t;
1ec3d1a
	')
1ec3d1a
1ec3d1a
	# transition to dpkg script:
1ec3d1a
	corecmd_shell_domtrans($1, dpkg_script_t)
1ec3d1a
	allow dpkg_script_t $1:fd use;
1ec3d1a
	allow dpkg_script_t $1:fifo_file rw_file_perms;
1ec3d1a
	allow dpkg_script_t $1:process sigchld;
1ec3d1a
')
1ec3d1a
1ec3d1a
########################################
1ec3d1a
## <summary>
1ec3d1a
##	Execute dpkg programs in the dpkg domain.
1ec3d1a
## </summary>
1ec3d1a
## <param name="domain">
1ec3d1a
##	<summary>
1ec3d1a
##	Domain allowed to transition.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
## <param name="role">
1ec3d1a
##	<summary>
1ec3d1a
##	The role to allow the dpkg domain.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
## <rolecap/>
1ec3d1a
#
1ec3d1a
interface(`dpkg_run',`
1ec3d1a
	gen_require(`
8b08bfc
		#attribute_role dpkg_roles;
8b08bfc
		type dpkg_t, dpkg_script_t;
Chris PeBenito 9401ae1
	')
Chris PeBenito 9401ae1
8b08bfc
	#dpkg_domtrans($1)
8b08bfc
	#roleattribute $2 dpkg_roles;
8b08bfc
Chris PeBenito 9401ae1
	dpkg_domtrans($1)
8b08bfc
        role $2 types dpkg_t;
8b08bfc
        role $2 types dpkg_script_t;
8b08bfc
        seutil_run_loadpolicy(dpkg_script_t, $2)
8b08bfc
1ec3d1a
')
1ec3d1a
1ec3d1a
########################################
1ec3d1a
## <summary>
1ec3d1a
##	Inherit and use file descriptors from dpkg.
1ec3d1a
## </summary>
1ec3d1a
## <param name="domain">
1ec3d1a
##	<summary>
1ec3d1a
##	Domain allowed access.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
#
1ec3d1a
interface(`dpkg_use_fds',`
1ec3d1a
	gen_require(`
1ec3d1a
		type dpkg_t;
1ec3d1a
	')
1ec3d1a
1ec3d1a
	allow $1 dpkg_t:fd use;
1ec3d1a
')
1ec3d1a
1ec3d1a
########################################
1ec3d1a
## <summary>
1ec3d1a
##	Read from an unnamed dpkg pipe.
1ec3d1a
## </summary>
1ec3d1a
## <param name="domain">
1ec3d1a
##	<summary>
1ec3d1a
##	Domain allowed access.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
#
1ec3d1a
interface(`dpkg_read_pipes',`
1ec3d1a
	gen_require(`
1ec3d1a
		type dpkg_t;
1ec3d1a
	')
1ec3d1a
1ec3d1a
	allow $1 dpkg_t:fifo_file read_fifo_file_perms;
1ec3d1a
')
1ec3d1a
1ec3d1a
########################################
1ec3d1a
## <summary>
1ec3d1a
##	Read and write an unnamed dpkg pipe.
1ec3d1a
## </summary>
1ec3d1a
## <param name="domain">
1ec3d1a
##	<summary>
1ec3d1a
##	Domain allowed access.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
#
1ec3d1a
interface(`dpkg_rw_pipes',`
1ec3d1a
	gen_require(`
1ec3d1a
		type dpkg_t;
1ec3d1a
	')
1ec3d1a
1ec3d1a
	allow $1 dpkg_t:fifo_file rw_fifo_file_perms;
1ec3d1a
')
1ec3d1a
1ec3d1a
########################################
1ec3d1a
## <summary>
1ec3d1a
##	Inherit and use file descriptors from dpkg scripts.
1ec3d1a
## </summary>
1ec3d1a
## <param name="domain">
1ec3d1a
##	<summary>
1ec3d1a
##	Domain allowed access.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
#
1ec3d1a
interface(`dpkg_use_script_fds',`
1ec3d1a
	gen_require(`
1ec3d1a
		type dpkg_script_t;
1ec3d1a
	')
1ec3d1a
1ec3d1a
	allow $1 dpkg_script_t:fd use;
1ec3d1a
')
1ec3d1a
1ec3d1a
########################################
1ec3d1a
## <summary>
1ec3d1a
##	Read the dpkg package database.
1ec3d1a
## </summary>
1ec3d1a
## <param name="domain">
1ec3d1a
##	<summary>
1ec3d1a
##	Domain allowed access.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
#
1ec3d1a
interface(`dpkg_read_db',`
1ec3d1a
	gen_require(`
1ec3d1a
		type dpkg_var_lib_t;
1ec3d1a
	')
1ec3d1a
1ec3d1a
	files_search_var_lib($1)
1ec3d1a
	allow $1 dpkg_var_lib_t:dir list_dir_perms;
1ec3d1a
	read_files_pattern($1, dpkg_var_lib_t, dpkg_var_lib_t)
1ec3d1a
	read_lnk_files_pattern($1, dpkg_var_lib_t, dpkg_var_lib_t)
1ec3d1a
')
1ec3d1a
1ec3d1a
########################################
1ec3d1a
## <summary>
1ec3d1a
##	Create, read, write, and delete the dpkg package database.
1ec3d1a
## </summary>
1ec3d1a
## <param name="domain">
1ec3d1a
##	<summary>
1ec3d1a
##	Domain allowed access.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
#
1ec3d1a
interface(`dpkg_manage_db',`
1ec3d1a
	gen_require(`
1ec3d1a
		type dpkg_var_lib_t;
1ec3d1a
	')
1ec3d1a
1ec3d1a
	files_search_var_lib($1)
1ec3d1a
	manage_files_pattern($1, dpkg_var_lib_t, dpkg_var_lib_t)
1ec3d1a
	manage_lnk_files_pattern($1, dpkg_var_lib_t, dpkg_var_lib_t)
1ec3d1a
')
1ec3d1a
1ec3d1a
########################################
1ec3d1a
## <summary>
1ec3d1a
##	Do not audit attempts to create, read, 
1ec3d1a
##	write, and delete the dpkg package database.
1ec3d1a
## </summary>
1ec3d1a
## <param name="domain">
1ec3d1a
##	<summary>
1ec3d1a
##	Domain to not audit.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
#
1ec3d1a
interface(`dpkg_dontaudit_manage_db',`
1ec3d1a
	gen_require(`
1ec3d1a
		type dpkg_var_lib_t;
1ec3d1a
	')
1ec3d1a
1ec3d1a
	dontaudit $1 dpkg_var_lib_t:dir rw_dir_perms;
1ec3d1a
	dontaudit $1 dpkg_var_lib_t:file manage_file_perms;
1ec3d1a
	dontaudit $1 dpkg_var_lib_t:lnk_file manage_lnk_file_perms;
1ec3d1a
')
1ec3d1a
1ec3d1a
########################################
1ec3d1a
## <summary>
1ec3d1a
##	Lock the dpkg package database.
1ec3d1a
## </summary>
1ec3d1a
## <param name="domain">
1ec3d1a
##	<summary>
1ec3d1a
##	Domain allowed access.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
#
1ec3d1a
interface(`dpkg_lock_db',`
1ec3d1a
	gen_require(`
1ec3d1a
		type dpkg_lock_t, dpkg_var_lib_t;
1ec3d1a
	')
1ec3d1a
1ec3d1a
	files_search_var_lib($1)
1ec3d1a
	allow $1 dpkg_var_lib_t:dir list_dir_perms;
1ec3d1a
	allow $1 dpkg_lock_t:file manage_file_perms;
1ec3d1a
')