Chris PeBenito 57869a
## <summary>Policy for GNU Privacy Guard and related programs.</summary>
Chris PeBenito b2b38c
Chris PeBenito 296273
############################################################
Chris PeBenito 414e41
## <summary>
Chris PeBenito 296273
##	Role access for gpg
Chris PeBenito 414e41
## </summary>
Chris PeBenito 296273
## <param name="role">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 296273
##	Role allowed access
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 451c1e
## </param>
Chris PeBenito 296273
## <param name="domain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 296273
##	User domain for the role
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 451c1e
## </param>
Chris PeBenito b2b38c
#
Chris PeBenito 296273
interface(`gpg_role',`
Chris PeBenito 12ae75
	gen_require(`
Chris PeBenito 296273
		type gpg_t, gpg_exec_t;
Chris PeBenito 296273
		type gpg_agent_t, gpg_agent_exec_t;
Chris PeBenito 296273
		type gpg_agent_tmp_t;
Chris PeBenito 296273
		type gpg_helper_t, gpg_pinentry_t;
Chris PeBenito 857d37
		type gpg_pinentry_tmp_t;
Chris PeBenito 12ae75
	')
Chris PeBenito 12ae75
Chris PeBenito 296273
	role $1 types { gpg_t gpg_agent_t gpg_helper_t gpg_pinentry_t };
Chris PeBenito b2b38c
Chris PeBenito 1f6524
	# transition from the userdomain to the derived domain
Chris PeBenito 296273
	domtrans_pattern($2, gpg_exec_t, gpg_t)
Chris PeBenito 1f6524
Chris PeBenito 1f6524
	# allow ps to show gpg
Chris PeBenito 296273
	ps_process_pattern($2, gpg_t)
Chris PeBenito ca7fa5
	allow $2 gpg_t:process { signull sigstop signal sigkill };
Chris PeBenito b2b38c
Chris PeBenito 857d37
	# communicate with the user
Chris PeBenito 296273
	allow gpg_helper_t $2:fd use;
Chris PeBenito 296273
	allow gpg_helper_t $2:fifo_file write;
Chris PeBenito ebdc3b
Chris PeBenito 1f6524
	# allow ps to show gpg-agent
Chris PeBenito 296273
	ps_process_pattern($2, gpg_agent_t)
Chris PeBenito 1f6524
Chris PeBenito ebdc3b
	# Allow the user shell to signal the gpg-agent program.
Chris PeBenito 296273
	allow $2 gpg_agent_t:process { signal sigkill };
Chris PeBenito 0c73cd
Chris PeBenito 296273
	manage_dirs_pattern($2, gpg_agent_tmp_t, gpg_agent_tmp_t)
Chris PeBenito 296273
	manage_files_pattern($2, gpg_agent_tmp_t, gpg_agent_tmp_t)
Chris PeBenito 296273
	manage_sock_files_pattern($2, gpg_agent_tmp_t, gpg_agent_tmp_t)
Chris PeBenito 296273
	files_tmp_filetrans(gpg_agent_t, gpg_agent_tmp_t, { file sock_file dir })
Chris PeBenito 0c73cd
Chris PeBenito 296273
	# Transition from the user domain to the agent domain.
Chris PeBenito 296273
	domtrans_pattern($2, gpg_agent_exec_t, gpg_agent_t)
Chris PeBenito e4f73a
Chris PeBenito 857d37
	manage_sock_files_pattern($2, gpg_pinentry_tmp_t, gpg_pinentry_tmp_t)
Chris PeBenito 857d37
	relabel_sock_files_pattern($2, gpg_pinentry_tmp_t, gpg_pinentry_tmp_t)
Chris PeBenito 857d37
Chris PeBenito 857d37
	optional_policy(`
Chris PeBenito 857d37
		gpg_pinentry_dbus_chat($2)
Chris PeBenito 857d37
	')
Chris PeBenito 857d37
Chris PeBenito e4f73a
	ifdef(`hide_broken_symptoms',`
Chris PeBenito e4f73a
		#Leaked File Descriptors
Chris PeBenito 857d37
		dontaudit gpg_t $2:socket_class_set { read write };
Chris PeBenito e4f73a
		dontaudit gpg_t $2:fifo_file rw_fifo_file_perms;
Chris PeBenito e4f73a
	')
Chris PeBenito 0c73cd
')
Chris PeBenito 004db9
Chris PeBenito 185272
########################################
Chris PeBenito 185272
## <summary>
Chris PeBenito ff8f0a
##	Transition to a user gpg domain.
Chris PeBenito 185272
## </summary>
Chris PeBenito 185272
## <param name="domain">
Chris PeBenito 185272
##	<summary>
Chris PeBenito ff8f0a
##	Domain allowed access.
Chris PeBenito 185272
##	</summary>
Chris PeBenito 185272
## </param>
Chris PeBenito 185272
#
Chris PeBenito 296273
interface(`gpg_domtrans',`
Chris PeBenito 185272
	gen_require(`
Chris PeBenito 296273
		type gpg_t, gpg_exec_t;
Chris PeBenito 185272
	')
Chris PeBenito 185272
Chris PeBenito 296273
	domtrans_pattern($1, gpg_exec_t, gpg_t)
Chris PeBenito 185272
')
Chris PeBenito 185272
Chris PeBenito edf241
########################################
Chris PeBenito edf241
## <summary>
Chris PeBenito ff8f0a
##	Send generic signals to user gpg processes.
Chris PeBenito edf241
## </summary>
Chris PeBenito edf241
## <param name="domain">
Chris PeBenito edf241
##	<summary>
Chris PeBenito ff8f0a
##	Domain allowed access.
Chris PeBenito edf241
##	</summary>
Chris PeBenito edf241
## </param>
Chris PeBenito edf241
#
Chris PeBenito 296273
interface(`gpg_signal',`
Chris PeBenito edf241
	gen_require(`
Chris PeBenito 296273
		type gpg_t;
Chris PeBenito edf241
	')
Chris PeBenito edf241
Chris PeBenito 296273
	allow $1 gpg_t:process signal;
Chris PeBenito edf241
')
Chris PeBenito 857d37
Chris PeBenito 857d37
########################################
Chris PeBenito 857d37
## <summary>
Chris PeBenito 857d37
##	Read and write GPG agent pipes.
Chris PeBenito 857d37
## </summary>
Chris PeBenito 857d37
## <param name="domain">
Chris PeBenito 857d37
##	<summary>
Chris PeBenito 857d37
##	Domain allowed access.
Chris PeBenito 857d37
##	</summary>
Chris PeBenito 857d37
## </param>
Chris PeBenito 857d37
#
Chris PeBenito 857d37
interface(`gpg_rw_agent_pipes',`
Chris PeBenito 857d37
	# Just wants read/write could this be a leak?
Chris PeBenito 857d37
	gen_require(`
Chris PeBenito 857d37
		type gpg_agent_t;
Chris PeBenito 857d37
	')
Chris PeBenito 857d37
Chris PeBenito 857d37
	allow $1 gpg_agent_t:fifo_file rw_fifo_file_perms;
Chris PeBenito 857d37
')
Chris PeBenito 857d37
Chris PeBenito 857d37
########################################
Chris PeBenito 857d37
## <summary>
Chris PeBenito 857d37
##	Send messages to and from GPG
Chris PeBenito 857d37
##	Pinentry over DBUS.
Chris PeBenito 857d37
## </summary>
Chris PeBenito 857d37
## <param name="domain">
Chris PeBenito 857d37
##	<summary>
Chris PeBenito 857d37
##	Domain allowed access.
Chris PeBenito 857d37
##	</summary>
Chris PeBenito 857d37
## </param>
Chris PeBenito 857d37
#
Chris PeBenito 857d37
interface(`gpg_pinentry_dbus_chat',`
Chris PeBenito 857d37
	gen_require(`
Chris PeBenito 857d37
		type gpg_pinentry_t;
Chris PeBenito 857d37
		class dbus send_msg;
Chris PeBenito 857d37
	')
Chris PeBenito 857d37
Chris PeBenito 857d37
	allow $1 gpg_pinentry_t:dbus send_msg;
Chris PeBenito 857d37
	allow gpg_pinentry_t $1:dbus send_msg;
Chris PeBenito 857d37
')
Chris PeBenito 857d37
Chris PeBenito 857d37
########################################
Chris PeBenito 857d37
## <summary>
Chris PeBenito 857d37
##	List Gnu Privacy Guard user secrets.
Chris PeBenito 857d37
## </summary>
Chris PeBenito 857d37
## <param name="domain">
Chris PeBenito 857d37
##	<summary>
Chris PeBenito 857d37
##	Domain allowed access.
Chris PeBenito 857d37
##	</summary>
Chris PeBenito 857d37
## </param>
Chris PeBenito 857d37
#
Chris PeBenito 857d37
interface(`gpg_list_user_secrets',`
Chris PeBenito 857d37
	gen_require(`
Chris PeBenito 857d37
		type gpg_secret_t;
Chris PeBenito 857d37
	')
Chris PeBenito 857d37
Chris PeBenito 857d37
	list_dirs_pattern($1, gpg_secret_t, gpg_secret_t)
Chris PeBenito 857d37
	userdom_search_user_home_dirs($1)
Chris PeBenito 857d37
')