## <summary>Policy for local logins.</summary>

########################################
## <summary>
##	Execute local logins in the local login domain.
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed to transition.
##	</summary>
## </param>
#
interface(`locallogin_domtrans',`
	gen_require(`
		type local_login_t;
	')

	auth_domtrans_login_program($1, local_login_t)
')

########################################
## <summary>
##	Allow calling domain to read locallogin state.
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed permission.
##	</summary>
## </param>
#
interface(`locallogin_read_state',`
	gen_require(`
		type local_login_t;
	')

	kernel_search_proc($1)
	allow $1 local_login_t:file read_file_perms;
	allow $1 local_login_t:lnk_file read_lnk_file_perms;
	allow $1 local_login_t:dir list_dir_perms;
')

########################################
## <summary>
##	Allow processes to inherit local login file descriptors.
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed access.
##	</summary>
## </param>
#
interface(`locallogin_use_fds',`
	gen_require(`
		type local_login_t;
	')

	allow $1 local_login_t:fd use;
')

########################################
## <summary>
##	Use PIDFDs from local login.
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed access.
##	</summary>
## </param>
#
interface(`locallogin_use_pidfds',`
	gen_require(`
		type local_login_t;
	')

	allow $1 local_login_t:fd use;
')

########################################
## <summary>
##	Do not audit attempts to inherit local login file descriptors.
## </summary>
## <param name="domain">
##	<summary>
##	Domain to not audit.
##	</summary>
## </param>
#
interface(`locallogin_dontaudit_use_fds',`
	gen_require(`
		type local_login_t;
	')

	dontaudit $1 local_login_t:fd use;
')

########################################
## <summary>
##	Send a null signal to local login processes.
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed access.
##	</summary>
## </param>
#
interface(`locallogin_signull',`
	gen_require(`
		type local_login_t;
	')

	allow $1 local_login_t:process signull;
')

########################################
## <summary>
##	Search for key.
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed access.
##	</summary>
## </param>
#
interface(`locallogin_search_keys',`
	gen_require(`
		type local_login_t;
	')

	allow $1 local_login_t:key search;
')

########################################
## <summary>
##	Allow link to the local_login key ring.
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed access.
##	</summary>
## </param>
#
interface(`locallogin_link_keys',`
	gen_require(`
		type local_login_t;
	')

	allow $1 local_login_t:key link;
')

########################################
## <summary>
##	Execute single-user logins in the single-user login domain.
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed to transition.
##	</summary>
## </param>
#
interface(`locallogin_domtrans_sulogin',`
	gen_require(`
		type sulogin_exec_t, sulogin_t;
	')

	domtrans_pattern($1, sulogin_exec_t, sulogin_t)
')
