selinux-policy/refpolicy/policy/modules/system/corecommands.if

266 lines
5.4 KiB
Plaintext
Raw Normal View History

2005-05-23 15:48:45 +00:00
## <module name="corecommands" layer="system">
## <summary>
## Core policy for shells, and generic programs
## in /bin, /sbin, /usr/bin, and /usr/sbin.
## </summary>
2005-04-20 19:07:16 +00:00
2005-04-28 19:50:58 +00:00
#######################################
#
2005-06-13 17:35:46 +00:00
# corecmd_shell_entry_type(domain)
2005-04-28 19:50:58 +00:00
#
2005-06-13 17:35:46 +00:00
define(`corecmd_shell_entry_type',`
requires_block_template(`$0'_depend)
2005-06-13 17:35:46 +00:00
domain_entry_file($1,shell_exec_t)
2005-04-28 19:50:58 +00:00
')
2005-06-13 17:35:46 +00:00
define(`corecmd_shell_entry_type_depend',`
type shell_exec_t;
2005-04-28 19:50:58 +00:00
')
2005-05-12 20:50:09 +00:00
########################################
#
2005-06-13 17:35:46 +00:00
# corecmd_search_bin(domain)
2005-05-12 20:50:09 +00:00
#
2005-06-13 17:35:46 +00:00
define(`corecmd_search_bin',`
requires_block_template(`$0'_depend)
allow $1 bin_t:dir search;
2005-05-12 20:50:09 +00:00
')
2005-06-13 17:35:46 +00:00
define(`corecmd_search_bin_depend',`
type bin_t;
class dir search;
2005-05-12 20:50:09 +00:00
')
########################################
#
2005-06-13 17:35:46 +00:00
# corecmd_list_bin(domain)
2005-05-12 20:50:09 +00:00
#
2005-06-13 17:35:46 +00:00
define(`corecmd_list_bin',`
requires_block_template(`$0'_depend)
2005-06-09 14:50:48 +00:00
allow $1 bin_t:dir r_dir_perms;
2005-05-12 20:50:09 +00:00
')
2005-06-13 17:35:46 +00:00
define(`corecmd_list_bin_depend',`
type bin_t;
2005-06-09 14:50:48 +00:00
class dir r_dir_perms;
2005-05-12 20:50:09 +00:00
')
2005-04-14 20:18:17 +00:00
########################################
#
2005-06-13 17:35:46 +00:00
# corecmd_exec_bin(domain)
2005-04-14 20:18:17 +00:00
#
2005-06-13 17:35:46 +00:00
define(`corecmd_exec_bin',`
requires_block_template(`$0'_depend)
2005-06-09 14:50:48 +00:00
allow $1 bin_t:dir r_dir_perms;
allow $1 bin_t:lnk_file r_file_perms;
can_exec($1,bin_t)
2005-04-14 20:18:17 +00:00
')
2005-06-13 17:35:46 +00:00
define(`corecmd_exec_bin_depend',`
type bin_t;
2005-06-09 14:50:48 +00:00
class dir r_dir_perms;
class lnk_file r_file_perms;
class file { getattr read ioctl lock execute execute_no_trans };
2005-04-14 20:18:17 +00:00
')
2005-05-12 20:50:09 +00:00
########################################
#
2005-06-13 17:35:46 +00:00
# corecmd_search_sbin(domain)
2005-05-12 20:50:09 +00:00
#
2005-06-13 17:35:46 +00:00
define(`corecmd_search_sbin',`
requires_block_template(`$0'_depend)
allow $1 sbin_t:dir search;
2005-05-12 20:50:09 +00:00
')
2005-06-13 17:35:46 +00:00
define(`corecmd_search_sbin_depend',`
type sbin_t;
class dir search;
2005-05-12 20:50:09 +00:00
')
########################################
#
2005-06-13 17:35:46 +00:00
# corecmd_list_sbin(domain)
2005-05-12 20:50:09 +00:00
#
2005-06-13 17:35:46 +00:00
define(`corecmd_list_sbin',`
requires_block_template(`$0'_depend)
allow $1 sbin_t:dir r_dir_perms;
2005-05-12 20:50:09 +00:00
')
2005-06-13 17:35:46 +00:00
define(`corecmd_list_sbin_depend',`
type sbin_t;
class dir r_dir_perms;
2005-05-12 20:50:09 +00:00
')
2005-05-30 21:17:20 +00:00
########################################
#
2005-06-13 17:35:46 +00:00
# corecmd_dontaudit_getattr_sbin_file(domain)
2005-05-30 21:17:20 +00:00
#
2005-06-13 17:35:46 +00:00
define(`corecmd_dontaudit_getattr_sbin_file',`
requires_block_template(`$0'_depend)
allow $1 sbin_t:file getattr;
2005-05-30 21:17:20 +00:00
')
2005-06-13 17:35:46 +00:00
define(`corecmd_dontaudit_getattr_sbin_file_depend',`
type sbin_t;
class file getattr;
2005-05-30 21:17:20 +00:00
')
2005-04-14 20:18:17 +00:00
########################################
#
2005-06-13 17:35:46 +00:00
# corecmd_exec_sbin(domain)
2005-04-14 20:18:17 +00:00
#
2005-06-13 17:35:46 +00:00
define(`corecmd_exec_sbin',`
requires_block_template(`$0'_depend)
2005-06-09 14:50:48 +00:00
allow $1 sbin_t:dir r_dir_perms;
allow $1 sbin_t:lnk_file r_file_perms;
can_exec($1,sbin_t)
2005-04-14 20:18:17 +00:00
')
2005-06-13 17:35:46 +00:00
define(`corecmd_exec_sbin_depend',`
type sbin_t;
2005-06-09 14:50:48 +00:00
class dir r_dir_perms;
class lnk_file r_file_perms;
class file { getattr read ioctl lock execute execute_no_trans };
2005-04-14 20:18:17 +00:00
')
########################################
#
2005-06-13 17:35:46 +00:00
# corecmd_exec_shell(domain)
2005-04-14 20:18:17 +00:00
#
2005-06-13 17:35:46 +00:00
define(`corecmd_exec_shell',`
requires_block_template(`$0'_depend)
allow $1 bin_t:dir r_dir_perms;
2005-06-09 14:50:48 +00:00
allow $1 bin_t:lnk_file r_file_perms;
can_exec($1,shell_exec_t)
2005-04-14 20:18:17 +00:00
')
2005-06-13 17:35:46 +00:00
define(`corecmd_exec_shell_depend',`
type bin_t, shell_exec_t;
class dir r_dir_perms;
2005-06-09 14:50:48 +00:00
class lnk_file r_file_perms;
class file { getattr read lock ioctl execute execute_no_trans };
2005-04-14 20:18:17 +00:00
')
2005-05-30 21:17:20 +00:00
########################################
#
2005-06-13 17:35:46 +00:00
# corecmd_exec_ls(domain)
2005-05-30 21:17:20 +00:00
#
2005-06-13 17:35:46 +00:00
define(`corecmd_exec_ls',`
requires_block_template(`$0'_depend)
allow $1 bin_t:dir r_dir_perms;
2005-06-09 14:50:48 +00:00
allow $1 bin_t:lnk_file r_file_perms;
can_exec($1,ls_exec_t)
2005-05-30 21:17:20 +00:00
')
2005-06-13 17:35:46 +00:00
define(`corecmd_exec_shell_depend',`
type bin_t, ls_exec_t;
class dir r_dir_perms;
2005-06-09 14:50:48 +00:00
class lnk_file r_file_perms;
class file { getattr read lock ioctl execute execute_no_trans };
2005-05-30 21:17:20 +00:00
')
2005-05-12 20:50:09 +00:00
########################################
2005-06-13 17:35:46 +00:00
## <interface name="corecmd_shell_spec_domtrans">
2005-05-23 15:48:45 +00:00
## <description>
## Execute a shell in the target domain. This
## is an explicit transition, requiring the
## caller to use setexeccon().
2005-05-23 15:48:45 +00:00
## </description>
## <parameter name="domain">
## The type of the process performing this action.
## </parameter>
## <parameter name="target_domain">
## The type of the shell process.
## </parameter>
## </interface>
2005-05-12 20:50:09 +00:00
#
2005-06-13 17:35:46 +00:00
define(`corecmd_shell_spec_domtrans',`
requires_block_template(`$0'_depend)
2005-06-09 14:50:48 +00:00
allow $1 bin_t:dir r_dir_perms;
allow $1 bin_t:lnk_file r_file_perms;
2005-06-10 01:01:13 +00:00
domain_trans($1,shell_exec_t,$2)
allow $1 $2:fd use;
allow $2 $1:fd use;
allow $2 $1:fifo_file rw_file_perms;
allow $2 $1:process sigchld;
2005-05-12 20:50:09 +00:00
')
2005-06-13 17:35:46 +00:00
define(`corecmd_shell_spec_domtrans_depend',`
type bin_t, shell_exec_t;
2005-06-09 14:50:48 +00:00
class dir r_dir_perms;
class lnk_file r_file_perms;
class file rx_file_perms
class process { transition noatsecure siginh rlimitinh sigchld };
class fd use;
class fifo_file rw_file_perms;
')
########################################
2005-06-13 17:35:46 +00:00
## <interface name="corecmd_domtrans_shell">
## <description>
## Execute a shell in the target domain.
## </description>
## <parameter name="domain">
## The type of the process performing this action.
## </parameter>
## <parameter name="target_domain">
## The type of the shell process.
## </parameter>
## </interface>
#
2005-06-13 17:35:46 +00:00
define(`corecmd_domtrans_shell',`
requires_block_template(`$0'_depend)
2005-06-13 17:35:46 +00:00
corecmd_shell_spec_domtrans($1,$2)
type_transition $1 shell_exec_t:process $2;
')
2005-06-13 17:35:46 +00:00
define(`corecmd_domtrans_shell_depend',`
type shell_exec_t;
2005-05-12 20:50:09 +00:00
')
2005-04-14 20:18:17 +00:00
########################################
#
2005-06-13 17:35:46 +00:00
# corecmd_chroot_exec_chroot(domain)
2005-04-14 20:18:17 +00:00
#
2005-06-13 17:35:46 +00:00
define(`corecmd_chroot_exec_chroot',`
requires_block_template(`$0'_depend)
allow $1 chroot_exec_t:file { getattr read execute execute_no_trans };
allow $1 self:capability sys_chroot;
2005-04-14 20:18:17 +00:00
')
2005-06-13 17:35:46 +00:00
define(`corecmd_chroot_exec_chroot_depend',`
type chroot_exec_t;
class file { getattr read execute execute_no_trans };
class capability sys_chroot;
2005-04-14 20:18:17 +00:00
')
2005-05-23 15:48:45 +00:00
## </module>