Add shutdown from Dan Walsh.

This commit is contained in:
Chris PeBenito 2010-07-07 11:10:56 -04:00
parent b841dffda1
commit 7e265a8abb
4 changed files with 132 additions and 0 deletions

View File

@ -4,6 +4,7 @@
- Added modules:
cgroup (Dominick Grift)
livecd (Dan Walsh)
shutdown (Dan Walsh)
* Mon May 24 2010 Chris PeBenito <selinux@tresys.com> - 2.20100524
- Merged a significant portion of Fedora policy.

View File

@ -0,0 +1,5 @@
/etc/nologin -- gen_context(system_u:object_r:shutdown_etc_t,s0)
/sbin/shutdown -- gen_context(system_u:object_r:shutdown_exec_t,s0)
/var/run/shutdown\.pid -- gen_context(system_u:object_r:shutdown_var_run_t,s0)

View File

@ -0,0 +1,67 @@
## <summary>System shutdown command</summary>
########################################
## <summary>
## Execute a domain transition to run shutdown.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed to transition.
## </summary>
## </param>
#
interface(`shutdown_domtrans',`
gen_require(`
type shutdown_t, shutdown_exec_t;
')
domtrans_pattern($1, shutdown_exec_t, shutdown_t)
ifdef(`hide_broken_symptoms', `
dontaudit shutdown_t $1:socket_class_set { read write };
dontaudit shutdown_t $1:fifo_file { read write };
')
')
########################################
## <summary>
## Execute shutdown in the shutdown domain, and
## allow the specified role the shutdown domain.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access
## </summary>
## </param>
## <param name="role">
## <summary>
## The role to be allowed the shutdown domain.
## </summary>
## </param>
#
interface(`shutdown_run',`
gen_require(`
type shutdown_t;
')
shutdown_domtrans($1)
role $2 types shutdown_t;
')
########################################
## <summary>
## Get attributes of shutdown executable.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`shutdown_getattr_exec_files',`
gen_require(`
type shutdown_exec_t;
')
allow $1 shutdown_exec_t:file getattr;
')

View File

@ -0,0 +1,59 @@
policy_module(shutdown, 1.0.0)
########################################
#
# Declarations
#
type shutdown_t;
type shutdown_exec_t;
application_domain(shutdown_t, shutdown_exec_t)
role system_r types shutdown_t;
type shutdown_etc_t;
files_config_file(shutdown_etc_t)
type shutdown_var_run_t;
files_pid_file(shutdown_var_run_t)
########################################
#
# shutdown local policy
#
allow shutdown_t self:capability { dac_override kill setuid sys_tty_config };
allow shutdown_t self:process { fork signal signull };
allow shutdown_t self:fifo_file manage_fifo_file_perms;
allow shutdown_t self:unix_stream_socket create_stream_socket_perms;
manage_files_pattern(shutdown_t, shutdown_etc_t, shutdown_etc_t)
files_etc_filetrans(shutdown_t, shutdown_etc_t, file)
manage_files_pattern(shutdown_t, shutdown_var_run_t, shutdown_var_run_t)
files_pid_filetrans(shutdown_t, shutdown_var_run_t, file)
files_read_etc_files(shutdown_t)
files_read_generic_pids(shutdown_t)
term_use_all_terms(shutdown_t)
auth_use_nsswitch(shutdown_t)
auth_write_login_records(shutdown_t)
init_dontaudit_write_utmp(shutdown_t)
init_read_utmp(shutdown_t)
init_telinit(shutdown_t)
logging_send_audit_msgs(shutdown_t)
miscfiles_read_localization(shutdown_t)
optional_policy(`
dbus_system_bus_client(shutdown_t)
dbus_connect_system_bus(shutdown_t)
')
optional_policy(`
xserver_dontaudit_write_log(shutdown_t)
')