Chris PeBenito 57869a
## <summary>Policy for GNU Privacy Guard and related programs.</summary>
Chris PeBenito b2b38c
Chris PeBenito b2b38c
#######################################
Chris PeBenito 414e41
## <summary>
Chris PeBenito e88003
##	The per user domain template for the gpg module.
Chris PeBenito 414e41
## </summary>
Chris PeBenito 414e41
## <desc>
Chris PeBenito 414e41
##	

Chris PeBenito 414e41
##	This template creates the types and rules for GPG,
Chris PeBenito 414e41
##	GPG-agent, and GPG helper programs.  This protects
Chris PeBenito 414e41
##	the user keys and secrets, and runs the programs
Chris PeBenito 414e41
##	in domains specific to the user type.
Chris PeBenito 414e41
##	

Chris PeBenito 414e41
##	

Chris PeBenito e88003
##	This is invoked automatically for each user and
Chris PeBenito e88003
##	generally does not need to be invoked directly
Chris PeBenito e88003
##	by policy writers.
Chris PeBenito 414e41
##	

Chris PeBenito 414e41
## </desc>
Chris PeBenito 414e41
## <param name="userdomain_prefix">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito 414e41
##	The prefix of the user domain (e.g., user
Chris PeBenito 414e41
##	is the prefix for user_t).
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 414e41
## </param>
Chris PeBenito fe2102
## <param name="userdomain">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito fe2102
##	The user domain.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 451c1e
## </param>
Chris PeBenito fe2102
## <param name="role">
Chris PeBenito 885b83
##	<summary>
Chris PeBenito fe2102
##	The role associated with the user.
Chris PeBenito 885b83
##	</summary>
Chris PeBenito 451c1e
## </param>
Chris PeBenito b2b38c
#
Chris PeBenito 199895
template(`gpg_per_userdomain_template',`
Chris PeBenito 12ae75
	gen_require(`
Chris PeBenito 12ae75
		type gpg_exec_t, gpg_helper_exec_t;
Chris PeBenito 12ae75
		type gpg_agent_exec_t, pinentry_exec_t;
Chris PeBenito 12ae75
	')
Chris PeBenito 12ae75
Chris PeBenito 0c73cd
	########################################
Chris PeBenito 0c73cd
	#
Chris PeBenito 0c73cd
	# Declarations
Chris PeBenito 0c73cd
	#
Chris PeBenito b2b38c
Chris PeBenito 0c73cd
	type $1_gpg_t;
Chris PeBenito c9428d
	domain_type($1_gpg_t)
Chris PeBenito c9428d
	domain_entry_file($1_gpg_t,gpg_exec_t)
Chris PeBenito 451c1e
	role $3 types $1_gpg_t;
Chris PeBenito b2b38c
Chris PeBenito 0c73cd
	type $1_gpg_agent_t;
Chris PeBenito c9428d
	domain_type($1_gpg_agent_t)
Chris PeBenito c9428d
	domain_entry_file($1_gpg_agent_t,gpg_agent_exec_t)
Chris PeBenito 451c1e
	role $3 types $1_gpg_agent_t;
Chris PeBenito b2b38c
Chris PeBenito 0c73cd
	type $1_gpg_agent_tmp_t;
Chris PeBenito c9428d
	files_tmp_file($1_gpg_agent_tmp_t)
Chris PeBenito b2b38c
Chris PeBenito 6820a3
	type $1_gpg_secret_t;
Chris PeBenito 103fe2
	userdom_user_home_content($1,$1_gpg_secret_t)
Chris PeBenito b2b38c
Chris PeBenito 0c73cd
	type $1_gpg_helper_t;
Chris PeBenito c9428d
	domain_type($1_gpg_helper_t)
Chris PeBenito 4483ee
	domain_entry_file($1_gpg_helper_t,gpg_helper_exec_t)
Chris PeBenito 451c1e
	role $3 types $1_gpg_helper_t;
Chris PeBenito b2b38c
Chris PeBenito 0c73cd
	type $1_gpg_pinentry_t;
Chris PeBenito c9428d
	domain_type($1_gpg_pinentry_t)
Chris PeBenito 4483ee
	domain_entry_file($1_gpg_pinentry_t,pinentry_exec_t)
Chris PeBenito 451c1e
	role $3 types $1_gpg_pinentry_t;
Chris PeBenito b2b38c
Chris PeBenito 0c73cd
	########################################
Chris PeBenito 0c73cd
	#
Chris PeBenito 0c73cd
	# GPG local policy
Chris PeBenito 0c73cd
	#
Chris PeBenito b2b38c
Chris PeBenito 0c73cd
	# transition from the userdomain to the derived domain
Chris PeBenito 451c1e
	domain_auto_trans($2,gpg_exec_t,$1_gpg_t)
Chris PeBenito b2b38c
Chris PeBenito 451c1e
	allow $2 $1_gpg_t:fd use;
Chris PeBenito 451c1e
	allow $1_gpg_t $2:fd use;
Chris PeBenito 451c1e
	allow $1_gpg_t $2:fifo_file rw_file_perms;
Chris PeBenito 451c1e
	allow $1_gpg_t $2:process sigchld;
Chris PeBenito b2b38c
Chris PeBenito 0c73cd
	allow $1_gpg_t self:capability { ipc_lock setuid };
Chris PeBenito 451c1e
	allow { $2 $1_gpg_t } $1_gpg_t:process signal;
Chris PeBenito 0c73cd
	# setrlimit is for ulimit -c 0
Chris PeBenito cff75c
	allow $1_gpg_t self:process { setrlimit setcap setpgid };
Chris PeBenito b2b38c
Chris PeBenito cc41a9
	allow $1_gpg_t self:fifo_file rw_file_perms;
Chris PeBenito cc41a9
	allow $1_gpg_t self:tcp_socket create_stream_socket_perms;
Chris PeBenito b2b38c
Chris PeBenito cc41a9
	allow $1_gpg_t $1_gpg_secret_t:dir rw_dir_perms;
Chris PeBenito cc41a9
	allow $1_gpg_t $1_gpg_secret_t:file create_file_perms;
Chris PeBenito cc41a9
	allow $1_gpg_t $1_gpg_secret_t:lnk_file create_lnk_perms;
Chris PeBenito b2b38c
Chris PeBenito 0fd9dc
	corenet_tcp_sendrecv_all_if($1_gpg_t)
Chris PeBenito 0fd9dc
	corenet_raw_sendrecv_all_if($1_gpg_t)
Chris PeBenito 0fd9dc
	corenet_udp_sendrecv_all_if($1_gpg_t)
Chris PeBenito 0fd9dc
	corenet_tcp_sendrecv_all_nodes($1_gpg_t)
Chris PeBenito 0fd9dc
	corenet_raw_sendrecv_all_nodes($1_gpg_t)
Chris PeBenito 0fd9dc
	corenet_udp_sendrecv_all_nodes($1_gpg_t)
Chris PeBenito 0fd9dc
	corenet_tcp_sendrecv_all_ports($1_gpg_t)
Chris PeBenito 0fd9dc
	corenet_udp_sendrecv_all_ports($1_gpg_t)
Chris PeBenito bd7037
	corenet_non_ipsec_sendrecv($1_gpg_t)
Chris PeBenito 0fd9dc
	corenet_tcp_bind_all_nodes($1_gpg_t)
Chris PeBenito 0fd9dc
	corenet_udp_bind_all_nodes($1_gpg_t)
Chris PeBenito cff75c
	corenet_tcp_connect_all_ports($1_gpg_t)
Chris PeBenito b2b38c
Karl MacMillan f0c985
	dev_read_rand($1_gpg_t)
Karl MacMillan f0c985
	dev_read_urand($1_gpg_t)
Chris PeBenito b2b38c
Chris PeBenito 0fd9dc
	fs_getattr_xattr_fs($1_gpg_t)
Chris PeBenito b2b38c
Chris PeBenito 15722e
	domain_use_interactive_fds($1_gpg_t)
Chris PeBenito ebdc3b
Chris PeBenito 8fd367
	files_read_etc_files($1_gpg_t)
Chris PeBenito c9428d
	files_read_usr_files($1_gpg_t)
Chris PeBenito ebdc3b
	files_dontaudit_search_var($1_gpg_t)
Chris PeBenito b2b38c
Chris PeBenito c9428d
	libs_use_shared_libs($1_gpg_t)
Chris PeBenito c9428d
	libs_use_ld_so($1_gpg_t)
Chris PeBenito b2b38c
Chris PeBenito 0c73cd
	miscfiles_read_localization($1_gpg_t)
Chris PeBenito b2b38c
Chris PeBenito c9428d
	logging_send_syslog_msg($1_gpg_t)
Chris PeBenito b2b38c
Chris PeBenito c9428d
	sysnet_read_config($1_gpg_t)
Chris PeBenito b2b38c
Chris PeBenito 451c1e
	userdom_use_user_terminals($1,$1_gpg_t)
Chris PeBenito 451c1e
Chris PeBenito 132880
	optional_policy(`nis',`
Chris PeBenito ab940a
		nis_use_ypbind($1_gpg_t)
Chris PeBenito ab940a
	')
Chris PeBenito b2b38c
Chris PeBenito ab940a
	ifdef(`TODO',`
Chris PeBenito cff75c
	# Read content to encrypt/decrypt/sign
Chris PeBenito cff75c
	read_content($1_gpg_t, $1)
Chris PeBenito cff75c
Chris PeBenito cff75c
	# Write content to encrypt/decrypt/sign
Chris PeBenito cff75c
	write_trusted($1_gpg_t, $1)
Chris PeBenito b2b38c
Chris PeBenito 0c73cd
	ifdef(`gnome-pty-helper.te', `allow $1_gpg_t $1_gph_t:fd use;')
Chris PeBenito b2b38c
Chris PeBenito 0c73cd
	# allow ps to show gpg
Chris PeBenito 0c73cd
	can_ps($1_t, $1_gpg_t)
Chris PeBenito b2b38c
Chris PeBenito 0c73cd
	') dnl end TODO
Chris PeBenito b2b38c
Chris PeBenito 0c73cd
	########################################
Chris PeBenito 0c73cd
	#
Chris PeBenito 0c73cd
	# GPG helper local policy
Chris PeBenito 0c73cd
	#
Chris PeBenito b2b38c
Chris PeBenito 0c73cd
	# for helper programs (which automatically fetch keys)
Chris PeBenito 0c73cd
	# Note: this is only tested with the hkp interface. If you use eg the 
Chris PeBenito 0c73cd
	# mail interface you will likely need additional permissions.
Chris PeBenito b2b38c
Chris PeBenito d35c62
	# communicate with the user 
Chris PeBenito 451c1e
	allow $1_gpg_helper_t $2:fd use;
Chris PeBenito 451c1e
	allow $1_gpg_helper_t $2:fifo_file write;
Chris PeBenito d35c62
Chris PeBenito 0c73cd
	# transition from the gpg domain to the helper domain
Chris PeBenito d35c62
	domain_auto_trans($1_gpg_t,gpg_helper_exec_t,$1_gpg_helper_t)
Chris PeBenito b2b38c
Chris PeBenito 0c73cd
	allow $1_gpg_t $1_gpg_helper_t:fd use;
Chris PeBenito 0c73cd
	allow $1_gpg_helper_t $1_gpg_t:fd use;
Chris PeBenito 0c73cd
	allow $1_gpg_helper_t $1_gpg_t:fifo_file rw_file_perms;
Chris PeBenito 0c73cd
	allow $1_gpg_helper_t $1_gpg_t:process sigchld;
Chris PeBenito b2b38c
Chris PeBenito cc41a9
	allow $1_gpg_helper_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito b2b38c
Chris PeBenito cc41a9
	allow $1_gpg_helper_t self:tcp_socket { connect connected_socket_perms };
Chris PeBenito cc41a9
	allow $1_gpg_helper_t self:udp_socket { connect connected_socket_perms };
Chris PeBenito b2b38c
Chris PeBenito 0c73cd
	dontaudit $1_gpg_helper_t $1_gpg_secret_t:file read;
Chris PeBenito b2b38c
Chris PeBenito 0fd9dc
	corenet_tcp_sendrecv_all_if($1_gpg_helper_t)
Chris PeBenito 0fd9dc
	corenet_raw_sendrecv_all_if($1_gpg_helper_t)
Chris PeBenito 0fd9dc
	corenet_udp_sendrecv_all_if($1_gpg_helper_t)
Chris PeBenito 0fd9dc
	corenet_tcp_sendrecv_all_nodes($1_gpg_helper_t)
Chris PeBenito 0fd9dc
	corenet_udp_sendrecv_all_nodes($1_gpg_helper_t)
Chris PeBenito 0fd9dc
	corenet_raw_sendrecv_all_nodes($1_gpg_helper_t)
Chris PeBenito 0fd9dc
	corenet_tcp_sendrecv_all_ports($1_gpg_helper_t)
Chris PeBenito 0fd9dc
	corenet_udp_sendrecv_all_ports($1_gpg_helper_t)
Chris PeBenito bd7037
	corenet_non_ipsec_sendrecv($1_gpg_helper_t)
Chris PeBenito 0fd9dc
	corenet_tcp_bind_all_nodes($1_gpg_helper_t)
Chris PeBenito 0fd9dc
	corenet_udp_bind_all_nodes($1_gpg_helper_t)
Chris PeBenito cff75c
	corenet_tcp_connect_all_ports($1_gpg_helper_t)
Chris PeBenito b2b38c
Karl MacMillan f0c985
	dev_read_urand($1_gpg_helper_t)
Chris PeBenito b2b38c
Chris PeBenito 8fd367
	files_read_etc_files($1_gpg_helper_t)
Chris PeBenito 0c73cd
	# for nscd
Chris PeBenito c9428d
	files_dontaudit_search_var($1_gpg_helper_t)
Chris PeBenito b2b38c
Chris PeBenito c9428d
	libs_use_ld_so($1_gpg_helper_t)
Chris PeBenito c9428d
	libs_use_shared_libs($1_gpg_helper_t)
Chris PeBenito b2b38c
Chris PeBenito c9428d
	sysnet_read_config($1_gpg_helper_t)
Chris PeBenito b2b38c
Chris PeBenito 3eed10
	tunable_policy(`use_nfs_home_dirs',`
Chris PeBenito d35c62
		fs_dontaudit_rw_nfs_files($1_gpg_helper_t)
Chris PeBenito 3eed10
	')
Chris PeBenito d35c62
Chris PeBenito 3eed10
	tunable_policy(`use_samba_home_dirs',`
Chris PeBenito d35c62
		fs_dontaudit_rw_cifs_files($1_gpg_helper_t)
Chris PeBenito 3eed10
	')
Chris PeBenito b2b38c
Chris PeBenito d35c62
	ifdef(`TODO',`
Chris PeBenito b2b38c
Chris PeBenito cff75c
	ifdef(`xdm.te',`
Chris PeBenito cff75c
		can_pipe_xdm($1_gpg_t)
Chris PeBenito 0c73cd
	')
Chris PeBenito 0c73cd
	') dnl end TODO
Chris PeBenito b2b38c
Chris PeBenito 0c73cd
	########################################
Chris PeBenito 0c73cd
	#
Chris PeBenito 0c73cd
	# GPG agent local policy
Chris PeBenito 0c73cd
	#
Chris PeBenito b2b38c
Chris PeBenito 0c73cd
	# rlimit: gpg-agent wants to prevent coredumps
Chris PeBenito 0c73cd
	allow $1_gpg_agent_t self:process setrlimit;
Chris PeBenito b2b38c
Chris PeBenito cc41a9
	allow $1_gpg_agent_t self:unix_stream_socket create_stream_socket_perms ;
Chris PeBenito cc41a9
	allow $1_gpg_agent_t self:fifo_file rw_file_perms;
Chris PeBenito b2b38c
Chris PeBenito ebdc3b
	# read and write ~/.gnupg (gpg-agent stores secret keys in ~/.gnupg/private-keys-v1.d )
Chris PeBenito ebdc3b
	allow $1_gpg_agent_t $1_gpg_secret_t:dir create_dir_perms;
Chris PeBenito ebdc3b
	allow $1_gpg_agent_t $1_gpg_secret_t:file create_file_perms;
Chris PeBenito ebdc3b
	allow $1_gpg_agent_t $1_gpg_secret_t:lnk_file create_lnk_perms;
Chris PeBenito ebdc3b
Chris PeBenito ebdc3b
	# allow gpg to connect to the gpg agent
Chris PeBenito ebdc3b
	allow $1_gpg_t $1_gpg_agent_tmp_t:dir search;
Chris PeBenito ebdc3b
	allow $1_gpg_t $1_gpg_agent_tmp_t:sock_file write;
Chris PeBenito ebdc3b
	allow $1_gpg_t $1_gpg_agent_t:unix_stream_socket connectto;
Chris PeBenito ebdc3b
Chris PeBenito ebdc3b
	# Allow the user shell to signal the gpg-agent program.
Chris PeBenito 451c1e
	allow $2 $1_gpg_agent_t:process { signal sigkill };
Chris PeBenito ebdc3b
Chris PeBenito 451c1e
	allow $2 $1_gpg_agent_tmp_t:dir create_dir_perms;
Chris PeBenito 451c1e
	allow $2 $1_gpg_agent_tmp_t:file create_file_perms;
Chris PeBenito 451c1e
	allow $2 $1_gpg_agent_tmp_t:sock_file create_file_perms;
Chris PeBenito 103fe2
	files_tmp_filetrans($1_gpg_agent_t, $1_gpg_agent_tmp_t, { file sock_file dir })
Chris PeBenito 0c73cd
Chris PeBenito ebdc3b
	corecmd_search_bin($1_gpg_agent_t)
Chris PeBenito ebdc3b
Chris PeBenito d35c62
	# Transition from the user domain to the derived domain.
Chris PeBenito 451c1e
	domain_auto_trans($2, gpg_agent_exec_t, $1_gpg_agent_t)
Chris PeBenito d35c62
Chris PeBenito 15722e
	domain_use_interactive_fds($1_gpg_agent_t)
Chris PeBenito b2b38c
Chris PeBenito c9428d
	libs_use_ld_so($1_gpg_agent_t)
Chris PeBenito c9428d
	libs_use_shared_libs($1_gpg_agent_t)
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	miscfiles_read_localization($1_gpg_agent_t)
Chris PeBenito 0c73cd
Chris PeBenito 451c1e
	# Write to the user domain tty.
Chris PeBenito 451c1e
	userdom_use_user_terminals($1,$1_gpg_agent_t)
Chris PeBenito 451c1e
Chris PeBenito d35c62
	tunable_policy(`use_nfs_home_dirs',`
Chris PeBenito d35c62
		fs_manage_nfs_dirs($1_gpg_agent_t)
Chris PeBenito d35c62
		fs_manage_nfs_files($1_gpg_agent_t)
Chris PeBenito d35c62
		fs_manage_nfs_symlinks($1_gpg_agent_t)
Chris PeBenito d35c62
	')
Chris PeBenito d35c62
Chris PeBenito d35c62
	tunable_policy(`use_samba_home_dirs',`
Chris PeBenito d35c62
		fs_manage_cifs_dirs($1_gpg_agent_t)
Chris PeBenito d35c62
		fs_manage_cifs_files($1_gpg_agent_t)
Chris PeBenito d35c62
		fs_manage_cifs_symlinks($1_gpg_agent_t)
Chris PeBenito d35c62
	')
Chris PeBenito d35c62
Chris PeBenito 0c73cd
	ifdef(`TODO',`
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	# allow ps to show gpg-agent
Chris PeBenito 0c73cd
	can_ps($1_t, $1_gpg_agent_t)
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	allow $1_gpg_agent_t proc_t:dir search;
Chris PeBenito 0c73cd
	allow $1_gpg_agent_t proc_t:lnk_file read;
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	# read and write ~/.gnupg (gpg-agent stores secret keys in ~/.gnupg/private-keys-v1.d )
Chris PeBenito 0c73cd
	allow $1_gpg_agent_t { home_root_t $1_home_dir_t }:dir search;
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	') dnl endif TODO
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	##############################
Chris PeBenito 0c73cd
	#
Chris PeBenito 0c73cd
	# Pinentry local policy
Chris PeBenito 0c73cd
	#
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	# we need to allow gpg-agent to call pinentry so it can get the passphrase 
Chris PeBenito 0c73cd
	# from the user.
Chris PeBenito d35c62
	domain_auto_trans($1_gpg_agent_t,pinentry_exec_t,$1_gpg_pinentry_t)
Chris PeBenito b2b38c
Chris PeBenito 0c73cd
	allow $1_gpg_pinentry_t $1_gpg_agent_t:fd use;
Chris PeBenito 0c73cd
	allow $1_gpg_agent_t $1_gpg_pinentry_t:fd use;
Chris PeBenito 0c73cd
	allow $1_gpg_agent_t $1_gpg_pinentry_t:fifo_file rw_file_perms;
Chris PeBenito 0c73cd
	allow $1_gpg_agent_t $1_gpg_pinentry_t:process sigchld;
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	allow $1_gpg_pinentry_t self:unix_stream_socket { connect create getattr read shutdown write };
Chris PeBenito cc41a9
	allow $1_gpg_pinentry_t self:fifo_file rw_file_perms;
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	# read /proc/meminfo
Chris PeBenito 0c73cd
	kernel_read_system_state($1_gpg_pinentry_t)
Chris PeBenito 0c73cd
Chris PeBenito c9428d
	files_read_usr_files($1_gpg_pinentry_t)
Chris PeBenito 0c73cd
	# read /etc/X11/qtrc
Chris PeBenito 8fd367
	files_read_etc_files($1_gpg_pinentry_t)
Chris PeBenito 0c73cd
Chris PeBenito c9428d
	libs_use_ld_so($1_gpg_pinentry_t)
Chris PeBenito c9428d
	libs_use_shared_libs($1_gpg_pinentry_t)
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	miscfiles_read_fonts($1_gpg_pinentry_t)
Chris PeBenito 0c73cd
	miscfiles_read_localization($1_gpg_pinentry_t)
Chris PeBenito 0c73cd
Chris PeBenito ebdc3b
	tunable_policy(`use_nfs_home_dirs',`
Chris PeBenito ebdc3b
		fs_read_nfs_files($1_gpg_pinentry_t)
Chris PeBenito ebdc3b
	')
Chris PeBenito 0c73cd
Chris PeBenito ebdc3b
	tunable_policy(`use_samba_home_dirs',`
Chris PeBenito ebdc3b
		fs_read_cifs_files($1_gpg_pinentry_t)
Chris PeBenito ebdc3b
	')
Chris PeBenito ebdc3b
Chris PeBenito ebdc3b
	ifdef(`TODO',`
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	ifdef(`xdm.te', `
Chris PeBenito 0c73cd
		allow $1_gpg_pinentry_t xdm_xserver_tmp_t:dir search;
Chris PeBenito 0c73cd
		allow $1_gpg_pinentry_t xdm_xserver_tmp_t:sock_file { read write };
Chris PeBenito ebdc3b
		allow $1_gpg_pinentry_t xdm_xserver_t:unix_stream_socket connectto;
Chris PeBenito 0c73cd
	')
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	allow $1_gpg_pinentry_t { tmp_t home_root_t }:dir { getattr search };
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	# for .Xauthority
Chris PeBenito 0c73cd
	allow $1_gpg_pinentry_t $1_home_dir_t:dir { getattr search };
Chris PeBenito cc41a9
	allow $1_gpg_pinentry_t $1_home_t:file r_file_perms;
Chris PeBenito 0c73cd
	# wants to put some lock files into the user home dir, seems to work fine without
Chris PeBenito 0c73cd
	dontaudit $1_gpg_pinentry_t $1_home_t:dir { read write };
Chris PeBenito 0c73cd
	dontaudit $1_gpg_pinentry_t $1_home_t:file write;
Chris PeBenito 0c73cd
Chris PeBenito 3eed10
	tunable_policy(`use_nfs_home_dirs',`
Chris PeBenito ebdc3b
		dontaudit $1_gpg_pinentry_t nfs_t:dir write;
Chris PeBenito 0c73cd
		dontaudit $1_gpg_pinentry_t nfs_t:file write;
Chris PeBenito 3eed10
	')
Chris PeBenito 0c73cd
Chris PeBenito 3eed10
	tunable_policy(`use_samba_home_dirs',`
Chris PeBenito ebdc3b
		dontaudit $1_gpg_pinentry_t cifs_t:dir write;
Chris PeBenito 0c73cd
		dontaudit $1_gpg_pinentry_t cifs_t:file write;
Chris PeBenito 3eed10
	')
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	dontaudit $1_gpg_pinentry_t { sysctl_t sysctl_kernel_t }:dir { getattr search };
Chris PeBenito 0c73cd
	') dnl end TODO
Chris PeBenito 0c73cd
')
Chris PeBenito 004db9
Chris PeBenito 185272
########################################
Chris PeBenito 185272
## <summary>
Chris PeBenito 185272
##      Transition to a user gpg domain.
Chris PeBenito 185272
## </summary>
Chris PeBenito 185272
## <desc>
Chris PeBenito 185272
##      

Chris PeBenito 185272
##      Transition to a user gpg domain.
Chris PeBenito 185272
##      

Chris PeBenito 185272
##      

Chris PeBenito 185272
##      This is a templated interface, and should only
Chris PeBenito 185272
##      be called from a per-userdomain template.
Chris PeBenito 185272
##      

Chris PeBenito 185272
## </desc>
Chris PeBenito 185272
## <param name="userdomain_prefix">
Chris PeBenito 185272
##	<summary>
Chris PeBenito 185272
##      The prefix of the user domain (e.g., user
Chris PeBenito 185272
##      is the prefix for user_t).
Chris PeBenito 185272
##	</summary>
Chris PeBenito 185272
## </param>
Chris PeBenito 185272
## <param name="domain">
Chris PeBenito 185272
##	<summary>
Chris PeBenito 185272
##      Domain allowed access.
Chris PeBenito 185272
##	</summary>
Chris PeBenito 185272
## </param>
Chris PeBenito 185272
#
Chris PeBenito 185272
template(`gpg_domtrans_user_gpg',`
Chris PeBenito 185272
	gen_require(`
Chris PeBenito 185272
		type $1_gpg_t, gpg_exec_t;
Chris PeBenito 185272
	')
Chris PeBenito 185272
Chris PeBenito 185272
	domain_auto_trans($2, gpg_exec_t, $1_gpg_t)
Chris PeBenito 185272
	allow $2 $1_gpg_t:fd use;
Chris PeBenito 185272
	allow $1_gpg_t $2:fd use;
Chris PeBenito 185272
	allow $1_gpg_t $2:fifo_file rw_file_perms;
Chris PeBenito 185272
	allow $1_gpg_t $2:process sigchld;
Chris PeBenito 185272
')
Chris PeBenito 185272
Chris PeBenito edf241
########################################
Chris PeBenito edf241
## <summary>
Chris PeBenito edf241
##      Send generic signals to user gpg processes.
Chris PeBenito edf241
## </summary>
Chris PeBenito edf241
## <desc>
Chris PeBenito edf241
##      

Chris PeBenito edf241
##      This is a templated interface, and should only
Chris PeBenito edf241
##      be called from a per-userdomain template.
Chris PeBenito edf241
##      

Chris PeBenito edf241
## </desc>
Chris PeBenito edf241
## <param name="userdomain_prefix">
Chris PeBenito edf241
##	<summary>
Chris PeBenito edf241
##      The prefix of the user domain (e.g., user
Chris PeBenito edf241
##      is the prefix for user_t).
Chris PeBenito edf241
##	</summary>
Chris PeBenito edf241
## </param>
Chris PeBenito edf241
## <param name="domain">
Chris PeBenito edf241
##	<summary>
Chris PeBenito edf241
##      Domain allowed access.
Chris PeBenito edf241
##	</summary>
Chris PeBenito edf241
## </param>
Chris PeBenito edf241
#
Chris PeBenito edf241
template(`gpg_signal_user_gpg',`
Chris PeBenito edf241
	gen_require(`
Chris PeBenito edf241
		type $1_gpg_t;
Chris PeBenito edf241
	')
Chris PeBenito edf241
Chris PeBenito edf241
	allow $2 $1_gpg_t:process signal;
Chris PeBenito edf241
')