06d521d
## <summary>System shutdown command</summary>
1ec3d1a
1ec3d1a
########################################
1ec3d1a
## <summary>
1ec3d1a
##	Execute a domain transition to run shutdown.
1ec3d1a
## </summary>
1ec3d1a
## <param name="domain">
1ec3d1a
## <summary>
1ec3d1a
##	Domain allowed to transition.
1ec3d1a
## </summary>
1ec3d1a
## </param>
1ec3d1a
#
1ec3d1a
interface(`shutdown_domtrans',`
1ec3d1a
	gen_require(`
1ec3d1a
		type shutdown_t, shutdown_exec_t;
1ec3d1a
	')
1ec3d1a
1ec3d1a
	corecmd_search_bin($1)
1ec3d1a
	domtrans_pattern($1, shutdown_exec_t, shutdown_t)
1ec3d1a
1ec3d1a
	init_reboot($1)
1ec3d1a
	init_halt($1)
1ec3d1a
1ec3d1a
	optional_policy(`
1ec3d1a
		systemd_exec_systemctl($1)
1ec3d1a
		init_stream_connect($1)
1ec3d1a
		systemd_login_reboot($1)
1ec3d1a
		systemd_login_halt($1)
1ec3d1a
	')
1ec3d1a
1ec3d1a
	ifdef(`hide_broken_symptoms', `
1ec3d1a
		dontaudit shutdown_t $1:fifo_file rw_inherited_fifo_file_perms;
1ec3d1a
	')
1ec3d1a
')
1ec3d1a
1ec3d1a
########################################
1ec3d1a
## <summary>
06d521d
##	Execute shutdown in the shutdown domain, and
06d521d
##	allow the specified role the shutdown 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
##	Role allowed access.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
#
1ec3d1a
interface(`shutdown_run',`
1ec3d1a
	gen_require(`
Dominick Grift 9641916
		type shutdown_t;
1f86dac
		attribute_role shutdown_roles;
Dominick Grift 9641916
	')
Dominick Grift 9641916
06d521d
    shutdown_domtrans($1)
06d521d
    roleattribute $2 shutdown_roles;
1ec3d1a
')
1ec3d1a
1ec3d1a
########################################
1ec3d1a
## <summary>
1ec3d1a
##	Role access for shutdown
1ec3d1a
## </summary>
1ec3d1a
## <param name="role">
1ec3d1a
##	<summary>
1ec3d1a
##	Role allowed access
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
## <param name="domain">
1ec3d1a
##	<summary>
1ec3d1a
##	User domain for the role
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
#
1ec3d1a
interface(`shutdown_role',`
1ec3d1a
	gen_require(`
1ec3d1a
              type shutdown_t;
1ec3d1a
	')
1ec3d1a
06d521d
    shutdown_run($2, $1)
1ec3d1a
06d521d
    allow $2 shutdown_t:process { ptrace signal_perms };
006e831
    ps_process_pattern($2, shutdown_t)
1ec3d1a
')
1ec3d1a
1ec3d1a
########################################
1ec3d1a
## <summary>
1ec3d1a
##	Recieve sigchld from shutdown
1ec3d1a
## </summary>
1ec3d1a
## <param name="domain">
1ec3d1a
##	<summary>
1ec3d1a
##	Domain allowed access
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
#
1ec3d1a
interface(`shutdown_send_sigchld',`
1ec3d1a
	gen_require(`
1ec3d1a
              type shutdown_t;
1ec3d1a
	')
1ec3d1a
1ec3d1a
	allow shutdown_t $1:process signal;
1ec3d1a
')
1ec3d1a
1ec3d1a
########################################
1ec3d1a
## <summary>
1ec3d1a
##	Send and receive messages from
1ec3d1a
##	shutdown over dbus.
1ec3d1a
## </summary>
1ec3d1a
## <param name="domain">
1ec3d1a
##	<summary>
1ec3d1a
##	Domain allowed access.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
#
1ec3d1a
interface(`shutdown_dbus_chat',`
1ec3d1a
	gen_require(`
1ec3d1a
		type shutdown_t;
1ec3d1a
		class dbus send_msg;
1ec3d1a
	')
1ec3d1a
1ec3d1a
	allow $1 shutdown_t:dbus send_msg;
1ec3d1a
	allow shutdown_t $1:dbus send_msg;
1ec3d1a
')
1ec3d1a
1ec3d1a
########################################
1ec3d1a
## <summary>
1ec3d1a
##	Get attributes of shutdown executable.
1ec3d1a
## </summary>
1ec3d1a
## <param name="domain">
1ec3d1a
##	<summary>
1ec3d1a
##	Domain allowed access.
1ec3d1a
##	</summary>
1ec3d1a
## </param>
1ec3d1a
#
1ec3d1a
interface(`shutdown_getattr_exec_files',`
1ec3d1a
	gen_require(`
1ec3d1a
		type shutdown_exec_t;
1ec3d1a
	')
1ec3d1a
1ec3d1a
	corecmd_search_bin($1)
1ec3d1a
	allow $1 shutdown_exec_t:file getattr_file_perms;
1ec3d1a
')