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

269 lines
6.1 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-05-09 15:40:56 +00:00
# corecommands_make_shell_entrypoint(domain)
2005-04-28 19:50:58 +00:00
#
define(`corecommands_make_shell_entrypoint',`
requires_block_template(`$0'_depend)
domain_make_entrypoint_file($1,shell_exec_t)
2005-04-28 19:50:58 +00:00
')
define(`corecommands_make_shell_entrypoint_depend',`
type shell_exec_t;
2005-04-28 19:50:58 +00:00
')
2005-05-12 20:50:09 +00:00
########################################
#
# corecommands_search_general_programs_directory(domain)
#
define(`corecommands_search_general_programs_directory',`
requires_block_template(`$0'_depend)
allow $1 bin_t:dir search;
2005-05-12 20:50:09 +00:00
')
define(`corecommands_search_general_programs_directory_depend',`
type bin_t;
class dir search;
2005-05-12 20:50:09 +00:00
')
########################################
#
# corecommands_read_general_programs_directory(domain)
#
define(`corecommands_read_general_programs_directory',`
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
')
define(`corecommands_read_general_programs_directory_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-05-09 15:40:56 +00:00
# corecommands_execute_general_programs(domain)
2005-04-14 20:18:17 +00:00
#
define(`corecommands_execute_general_programs',`
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
')
define(`corecommands_execute_general_programs_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
########################################
#
# corecommands_search_system_programs_directory(domain)
#
define(`corecommands_search_system_programs_directory',`
requires_block_template(`$0'_depend)
allow $1 sbin_t:dir search;
2005-05-12 20:50:09 +00:00
')
define(`corecommands_search_system_programs_directory_depend',`
type sbin_t;
class dir search;
2005-05-12 20:50:09 +00:00
')
########################################
#
# corecommands_read_system_programs_directory(domain)
#
define(`corecommands_read_system_programs_directory',`
requires_block_template(`$0'_depend)
allow $1 sbin_t:dir r_dir_perms;
2005-05-12 20:50:09 +00:00
')
define(`corecommands_read_system_programs_directory_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
########################################
#
# corecommands_ignore_get_system_programs_attributes(domain)
#
define(`corecommands_ignore_get_system_programs_attributes',`
requires_block_template(`$0'_depend)
allow $1 sbin_t:file getattr;
2005-05-30 21:17:20 +00:00
')
define(`corecommands_ignore_get_system_programs_attributes_depend',`
type sbin_t;
class file getattr;
2005-05-30 21:17:20 +00:00
')
2005-04-14 20:18:17 +00:00
########################################
#
2005-05-09 15:40:56 +00:00
# corecommands_execute_system_programs(domain)
2005-04-14 20:18:17 +00:00
#
define(`corecommands_execute_system_programs',`
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
')
define(`corecommands_execute_system_programs_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-05-09 15:40:56 +00:00
# corecommands_execute_shell(domain)
2005-04-14 20:18:17 +00:00
#
define(`corecommands_execute_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
')
define(`corecommands_execute_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
########################################
#
# corecommands_execute_ls(domain)
#
define(`corecommands_execute_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
')
define(`corecommands_execute_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
########################################
## <interface name="corecommands_shell_explicit_transition">
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>
## <infoflow type="write" weight="10"/>
## </interface>
2005-05-12 20:50:09 +00:00
#
define(`corecommands_shell_explicit_transition',`
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;
allow $1 shell_exec_t:file rx_file_perms
allow $1 $2:process transition;
dontaudit $1 $2:process { noatsecure siginh rlimitinh };
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
')
define(`corecommands_shell_explicit_transition_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;
')
########################################
## <interface name="corecommands_shell_transition">
## <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>
## <infoflow type="write" weight="10"/>
## </interface>
#
define(`corecommands_shell_transition',`
requires_block_template(`$0'_depend)
corecommands_shell_explicit_transition($1,$2)
type_transition $1 shell_exec_t:process $2;
')
define(`corecommands_shell_transition_depend',`
type shell_exec_t;
2005-05-12 20:50:09 +00:00
')
2005-04-14 20:18:17 +00:00
########################################
#
2005-05-09 15:40:56 +00:00
# corecommands_chroot(domain)
2005-04-14 20:18:17 +00:00
#
define(`corecommands_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
')
define(`corecommands_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>