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 414e41
##	The prefix of the user domain (e.g., user
Chris PeBenito 414e41
##	is the prefix for user_t).
Chris PeBenito 414e41
## </param>
Chris PeBenito b2b38c
#
Chris PeBenito 199895
template(`gpg_per_userdomain_template',`
Chris PeBenito fa7bea
	gen_require(`$0'_depend)
Chris PeBenito b2b38c
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 0c73cd
	role $1_r 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 0c73cd
	role $1_r 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 0c73cd
	type $1_gpg_secret_t; #, $1_file_type;
Chris PeBenito 8fd367
	files_type($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 0c73cd
	role $1_r 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 0c73cd
	role $1_r 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 d35c62
	domain_auto_trans($1_t,gpg_exec_t,$1_gpg_t)
Chris PeBenito b2b38c
Chris PeBenito 0c73cd
	allow $1_t $1_gpg_t:fd use;
Chris PeBenito 0c73cd
	allow $1_gpg_t $1_t:fd use;
Chris PeBenito 0c73cd
	allow $1_gpg_t $1_t:fifo_file rw_file_perms;
Chris PeBenito 0c73cd
	allow $1_gpg_t $1_t:process sigchld;
Chris PeBenito b2b38c
Chris PeBenito 0c73cd
	allow $1_gpg_t self:capability { ipc_lock setuid };
Chris PeBenito 0c73cd
	allow { $1_t $1_gpg_t } $1_gpg_t:process signal;
Chris PeBenito 0c73cd
	# setrlimit is for ulimit -c 0
Chris PeBenito 0c73cd
	allow $1_gpg_t self:process { setrlimit setcap };
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 ebdc3b
	allow $1_t $1_gpg_secret_t:file getattr;
Chris PeBenito ebdc3b
	allow $1_t $1_gpg_secret_t:dir rw_dir_perms;
Chris PeBenito ebdc3b
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 0fd9dc
	corenet_tcp_bind_all_nodes($1_gpg_t)
Chris PeBenito 0fd9dc
	corenet_udp_bind_all_nodes($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 ebdc3b
	domain_use_wide_inherit_fd($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 ebdc3b
	# should not need read access...
Chris PeBenito ebdc3b
	files_list_home($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 0c73cd
	# Legacy
Chris PeBenito 3eed10
	tunable_policy(`allow_gpg_execstack',`
Chris PeBenito 0c73cd
		allow $1_gpg_t self:process execmem;
Chris PeBenito c9428d
		libs_legacy_use_shared_libs($1_gpg_t)
Chris PeBenito c9428d
		libs_legacy_use_ld_so($1_gpg_t)
Chris PeBenito 0c73cd
		miscfiles_legacy_read_localization($1_gpg_t)
Chris PeBenito 0c73cd
		# Not quite sure why this is needed... 
Chris PeBenito 0c73cd
		allow $1_gpg_t gpg_exec_t:file execmod;
Chris PeBenito 3eed10
	')
Chris PeBenito b2b38c
Chris PeBenito d35c62
	tunable_policy(`use_nfs_home_dirs',`
Chris PeBenito d35c62
		fs_manage_nfs_dirs($1_gpg_t)
Chris PeBenito d35c62
		fs_manage_nfs_files($1_gpg_t)
Chris PeBenito d35c62
		fs_manage_nfs_symlinks($1_gpg_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_t)
Chris PeBenito d35c62
		fs_manage_cifs_files($1_gpg_t)
Chris PeBenito d35c62
		fs_manage_cifs_symlinks($1_gpg_t)
Chris PeBenito d35c62
	')
Chris PeBenito d35c62
Chris PeBenito ab940a
	optional_policy(`nis.te',`
Chris PeBenito ab940a
		nis_use_ypbind($1_gpg_t)
Chris PeBenito ab940a
	')
Chris PeBenito b2b38c
Chris PeBenito ab940a
	ifdef(`TODO',`
Chris PeBenito b2b38c
Chris PeBenito 0c73cd
	access_terminal($1_gpg_t, $1)
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
	# use $1_gpg_secret_t for files it creates
Chris PeBenito 0c73cd
	# NB we are doing the type transition for directory creation only!
Chris PeBenito 0c73cd
	# so ~/.gnupg will be of $1_gpg_secret_t, then files created under it such as
Chris PeBenito 0c73cd
	# secring.gpg will be of $1_gpg_secret_t too.  But when you use gpg to decrypt
Chris PeBenito 0c73cd
	# a file and write output to your home directory it will use user_home_t.
Chris PeBenito 0c73cd
	file_type_auto_trans($1_gpg_t, $1_home_dir_t, $1_gpg_secret_t, dir)
Chris PeBenito b2b38c
Chris PeBenito 0c73cd
	file_type_auto_trans($1_gpg_t, $1_home_dir_t, $1_home_t, file)
Chris PeBenito 0c73cd
	create_dir_file($1_gpg_t, $1_home_t)
Chris PeBenito b2b38c
Chris PeBenito 0c73cd
	# allow the usual access to /tmp
Chris PeBenito 0c73cd
	file_type_auto_trans($1_gpg_t, tmp_t, $1_tmp_t)
Chris PeBenito b2b38c
Chris PeBenito 0c73cd
	rw_dir_create_file($1_gpg_t, $1_file_type)
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 d35c62
	allow $1_gpg_helper_t $1_t:fd use;
Chris PeBenito d35c62
	allow $1_gpg_helper_t $1_t: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 0fd9dc
	corenet_tcp_bind_all_nodes($1_gpg_helper_t)
Chris PeBenito 0fd9dc
	corenet_udp_bind_all_nodes($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 0c73cd
	ifdef(`xdm.te', `
Chris PeBenito 0c73cd
		dontaudit $1_gpg_t xdm_t:fd use;
Chris PeBenito 0c73cd
		dontaudit $1_gpg_t xdm_t:fifo_file read;
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 ebdc3b
	allow $1_t $1_gpg_agent_t:process { signal sigkill };
Chris PeBenito ebdc3b
Chris PeBenito cc41a9
	allow $1_t $1_gpg_agent_tmp_t:dir create_dir_perms;
Chris PeBenito cc41a9
	allow $1_t $1_gpg_agent_tmp_t:file create_file_perms;
Chris PeBenito cc41a9
	allow $1_t $1_gpg_agent_tmp_t:sock_file create_file_perms;
Chris PeBenito c9428d
	files_create_tmp_files($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 d35c62
	domain_auto_trans($1_t, gpg_agent_exec_t, $1_gpg_agent_t)
Chris PeBenito d35c62
Chris PeBenito c9428d
	domain_use_wide_inherit_fd($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 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 $1_gpg_agent_t xdm_t:fd use;
Chris PeBenito 0c73cd
Chris PeBenito 0c73cd
	# Write to the user domain tty.
Chris PeBenito 0c73cd
	access_terminal($1_gpg_agent_t, $1)
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
		allow $1_gpg_pinentry_t xdm_t:fd use;
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