|
Chris PeBenito |
3000a3 |
## <module name="corecommands" layer="system">
|
|
Chris PeBenito |
3000a3 |
## <summary>
|
|
Chris PeBenito |
3000a3 |
## Core policy for shells, and generic programs
|
|
Chris PeBenito |
3000a3 |
## in /bin, /sbin, /usr/bin, and /usr/sbin.
|
|
Chris PeBenito |
3000a3 |
## </summary>
|
|
Chris PeBenito |
e181fe |
|
|
Chris PeBenito |
07efe9 |
#######################################
|
|
Chris PeBenito |
07efe9 |
#
|
|
Chris PeBenito |
c9428d |
# corecmd_shell_entry_type(domain)
|
|
Chris PeBenito |
07efe9 |
#
|
|
Chris PeBenito |
c9428d |
define(`corecmd_shell_entry_type',`
|
|
Chris PeBenito |
0c73cd |
requires_block_template(`$0'_depend)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
c9428d |
domain_entry_file($1,shell_exec_t)
|
|
Chris PeBenito |
07efe9 |
')
|
|
Chris PeBenito |
07efe9 |
|
|
Chris PeBenito |
c9428d |
define(`corecmd_shell_entry_type_depend',`
|
|
Chris PeBenito |
0c73cd |
type shell_exec_t;
|
|
Chris PeBenito |
07efe9 |
')
|
|
Chris PeBenito |
07efe9 |
|
|
Chris PeBenito |
b4cd15 |
########################################
|
|
Chris PeBenito |
b4cd15 |
#
|
|
Chris PeBenito |
c9428d |
# corecmd_search_bin(domain)
|
|
Chris PeBenito |
075c4f |
#
|
|
Chris PeBenito |
c9428d |
define(`corecmd_search_bin',`
|
|
Chris PeBenito |
0c73cd |
requires_block_template(`$0'_depend)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
allow $1 bin_t:dir search;
|
|
Chris PeBenito |
075c4f |
')
|
|
Chris PeBenito |
075c4f |
|
|
Chris PeBenito |
c9428d |
define(`corecmd_search_bin_depend',`
|
|
Chris PeBenito |
0c73cd |
type bin_t;
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
class dir search;
|
|
Chris PeBenito |
075c4f |
')
|
|
Chris PeBenito |
075c4f |
|
|
Chris PeBenito |
075c4f |
########################################
|
|
Chris PeBenito |
075c4f |
#
|
|
Chris PeBenito |
c9428d |
# corecmd_list_bin(domain)
|
|
Chris PeBenito |
075c4f |
#
|
|
Chris PeBenito |
c9428d |
define(`corecmd_list_bin',`
|
|
Chris PeBenito |
0c73cd |
requires_block_template(`$0'_depend)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
dd8229 |
allow $1 bin_t:dir r_dir_perms;
|
|
Chris PeBenito |
075c4f |
')
|
|
Chris PeBenito |
075c4f |
|
|
Chris PeBenito |
c9428d |
define(`corecmd_list_bin_depend',`
|
|
Chris PeBenito |
0c73cd |
type bin_t;
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
dd8229 |
class dir r_dir_perms;
|
|
Chris PeBenito |
075c4f |
')
|
|
Chris PeBenito |
075c4f |
|
|
Chris PeBenito |
075c4f |
########################################
|
|
Chris PeBenito |
075c4f |
#
|
|
Chris PeBenito |
c9428d |
# corecmd_exec_bin(domain)
|
|
Chris PeBenito |
b4cd15 |
#
|
|
Chris PeBenito |
c9428d |
define(`corecmd_exec_bin',`
|
|
Chris PeBenito |
0c73cd |
requires_block_template(`$0'_depend)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
dd8229 |
allow $1 bin_t:dir r_dir_perms;
|
|
Chris PeBenito |
dd8229 |
allow $1 bin_t:lnk_file r_file_perms;
|
|
Chris PeBenito |
dd8229 |
can_exec($1,bin_t)
|
|
Chris PeBenito |
dd8229 |
|
|
Chris PeBenito |
b4cd15 |
')
|
|
Chris PeBenito |
b4cd15 |
|
|
Chris PeBenito |
c9428d |
define(`corecmd_exec_bin_depend',`
|
|
Chris PeBenito |
0c73cd |
type bin_t;
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
dd8229 |
class dir r_dir_perms;
|
|
Chris PeBenito |
dd8229 |
class lnk_file r_file_perms;
|
|
Chris PeBenito |
0c73cd |
class file { getattr read ioctl lock execute execute_no_trans };
|
|
Chris PeBenito |
b4cd15 |
')
|
|
Chris PeBenito |
b4cd15 |
|
|
Chris PeBenito |
b4cd15 |
########################################
|
|
Chris PeBenito |
b4cd15 |
#
|
|
Chris PeBenito |
c9428d |
# corecmd_search_sbin(domain)
|
|
Chris PeBenito |
075c4f |
#
|
|
Chris PeBenito |
c9428d |
define(`corecmd_search_sbin',`
|
|
Chris PeBenito |
0c73cd |
requires_block_template(`$0'_depend)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
allow $1 sbin_t:dir search;
|
|
Chris PeBenito |
075c4f |
')
|
|
Chris PeBenito |
075c4f |
|
|
Chris PeBenito |
c9428d |
define(`corecmd_search_sbin_depend',`
|
|
Chris PeBenito |
0c73cd |
type sbin_t;
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
class dir search;
|
|
Chris PeBenito |
075c4f |
')
|
|
Chris PeBenito |
075c4f |
|
|
Chris PeBenito |
075c4f |
########################################
|
|
Chris PeBenito |
075c4f |
#
|
|
Chris PeBenito |
c9428d |
# corecmd_list_sbin(domain)
|
|
Chris PeBenito |
075c4f |
#
|
|
Chris PeBenito |
c9428d |
define(`corecmd_list_sbin',`
|
|
Chris PeBenito |
0c73cd |
requires_block_template(`$0'_depend)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
allow $1 sbin_t:dir r_dir_perms;
|
|
Chris PeBenito |
075c4f |
')
|
|
Chris PeBenito |
075c4f |
|
|
Chris PeBenito |
c9428d |
define(`corecmd_list_sbin_depend',`
|
|
Chris PeBenito |
0c73cd |
type sbin_t;
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
class dir r_dir_perms;
|
|
Chris PeBenito |
075c4f |
')
|
|
Chris PeBenito |
075c4f |
|
|
Chris PeBenito |
075c4f |
########################################
|
|
Chris PeBenito |
075c4f |
#
|
|
Chris PeBenito |
c9428d |
# corecmd_dontaudit_getattr_sbin_file(domain)
|
|
Chris PeBenito |
f5c42b |
#
|
|
Chris PeBenito |
c9428d |
define(`corecmd_dontaudit_getattr_sbin_file',`
|
|
Chris PeBenito |
0c73cd |
requires_block_template(`$0'_depend)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
allow $1 sbin_t:file getattr;
|
|
Chris PeBenito |
f5c42b |
')
|
|
Chris PeBenito |
f5c42b |
|
|
Chris PeBenito |
c9428d |
define(`corecmd_dontaudit_getattr_sbin_file_depend',`
|
|
Chris PeBenito |
0c73cd |
type sbin_t;
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
class file getattr;
|
|
Chris PeBenito |
f5c42b |
')
|
|
Chris PeBenito |
f5c42b |
|
|
Chris PeBenito |
f5c42b |
########################################
|
|
Chris PeBenito |
f5c42b |
#
|
|
Chris PeBenito |
c9428d |
# corecmd_exec_sbin(domain)
|
|
Chris PeBenito |
b4cd15 |
#
|
|
Chris PeBenito |
c9428d |
define(`corecmd_exec_sbin',`
|
|
Chris PeBenito |
0c73cd |
requires_block_template(`$0'_depend)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
dd8229 |
allow $1 sbin_t:dir r_dir_perms;
|
|
Chris PeBenito |
dd8229 |
allow $1 sbin_t:lnk_file r_file_perms;
|
|
Chris PeBenito |
dd8229 |
can_exec($1,sbin_t)
|
|
Chris PeBenito |
dd8229 |
|
|
Chris PeBenito |
b4cd15 |
')
|
|
Chris PeBenito |
b4cd15 |
|
|
Chris PeBenito |
c9428d |
define(`corecmd_exec_sbin_depend',`
|
|
Chris PeBenito |
0c73cd |
type sbin_t;
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
dd8229 |
class dir r_dir_perms;
|
|
Chris PeBenito |
dd8229 |
class lnk_file r_file_perms;
|
|
Chris PeBenito |
0c73cd |
class file { getattr read ioctl lock execute execute_no_trans };
|
|
Chris PeBenito |
b4cd15 |
')
|
|
Chris PeBenito |
b4cd15 |
|
|
Chris PeBenito |
b4cd15 |
########################################
|
|
Chris PeBenito |
b4cd15 |
#
|
|
Chris PeBenito |
c9428d |
# corecmd_exec_shell(domain)
|
|
Chris PeBenito |
b4cd15 |
#
|
|
Chris PeBenito |
c9428d |
define(`corecmd_exec_shell',`
|
|
Chris PeBenito |
0c73cd |
requires_block_template(`$0'_depend)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
allow $1 bin_t:dir r_dir_perms;
|
|
Chris PeBenito |
dd8229 |
allow $1 bin_t:lnk_file r_file_perms;
|
|
Chris PeBenito |
dd8229 |
can_exec($1,shell_exec_t)
|
|
Chris PeBenito |
b4cd15 |
')
|
|
Chris PeBenito |
b4cd15 |
|
|
Chris PeBenito |
c9428d |
define(`corecmd_exec_shell_depend',`
|
|
Chris PeBenito |
0c73cd |
type bin_t, shell_exec_t;
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
class dir r_dir_perms;
|
|
Chris PeBenito |
dd8229 |
class lnk_file r_file_perms;
|
|
Chris PeBenito |
0c73cd |
class file { getattr read lock ioctl execute execute_no_trans };
|
|
Chris PeBenito |
b4cd15 |
')
|
|
Chris PeBenito |
b4cd15 |
|
|
Chris PeBenito |
b4cd15 |
########################################
|
|
Chris PeBenito |
f5c42b |
#
|
|
Chris PeBenito |
c9428d |
# corecmd_exec_ls(domain)
|
|
Chris PeBenito |
f5c42b |
#
|
|
Chris PeBenito |
c9428d |
define(`corecmd_exec_ls',`
|
|
Chris PeBenito |
0c73cd |
requires_block_template(`$0'_depend)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
allow $1 bin_t:dir r_dir_perms;
|
|
Chris PeBenito |
dd8229 |
allow $1 bin_t:lnk_file r_file_perms;
|
|
Chris PeBenito |
dd8229 |
can_exec($1,ls_exec_t)
|
|
Chris PeBenito |
f5c42b |
')
|
|
Chris PeBenito |
f5c42b |
|
|
Chris PeBenito |
c9428d |
define(`corecmd_exec_shell_depend',`
|
|
Chris PeBenito |
0c73cd |
type bin_t, ls_exec_t;
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
class dir r_dir_perms;
|
|
Chris PeBenito |
dd8229 |
class lnk_file r_file_perms;
|
|
Chris PeBenito |
0c73cd |
class file { getattr read lock ioctl execute execute_no_trans };
|
|
Chris PeBenito |
f5c42b |
')
|
|
Chris PeBenito |
f5c42b |
|
|
Chris PeBenito |
f5c42b |
########################################
|
|
Chris PeBenito |
c9428d |
## <interface name="corecmd_shell_spec_domtrans">
|
|
Chris PeBenito |
3000a3 |
## <description>
|
|
Chris PeBenito |
4bf4ed |
## Execute a shell in the target domain. This
|
|
Chris PeBenito |
4bf4ed |
## is an explicit transition, requiring the
|
|
Chris PeBenito |
4bf4ed |
## caller to use setexeccon().
|
|
Chris PeBenito |
3000a3 |
## </description>
|
|
Chris PeBenito |
3000a3 |
## <parameter name="domain">
|
|
Chris PeBenito |
3000a3 |
## The type of the process performing this action.
|
|
Chris PeBenito |
3000a3 |
## </parameter>
|
|
Chris PeBenito |
3000a3 |
## <parameter name="target_domain">
|
|
Chris PeBenito |
3000a3 |
## The type of the shell process.
|
|
Chris PeBenito |
3000a3 |
## </parameter>
|
|
Chris PeBenito |
3000a3 |
## </interface>
|
|
Chris PeBenito |
075c4f |
#
|
|
Chris PeBenito |
c9428d |
define(`corecmd_shell_spec_domtrans',`
|
|
Chris PeBenito |
0c73cd |
requires_block_template(`$0'_depend)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
dd8229 |
allow $1 bin_t:dir r_dir_perms;
|
|
Chris PeBenito |
dd8229 |
allow $1 bin_t:lnk_file r_file_perms;
|
|
Chris PeBenito |
0fd9dc |
|
|
Chris PeBenito |
0fd9dc |
domain_trans($1,shell_exec_t,$2)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
allow $1 $2:fd use;
|
|
Chris PeBenito |
0c73cd |
allow $2 $1:fd use;
|
|
Chris PeBenito |
0c73cd |
allow $2 $1:fifo_file rw_file_perms;
|
|
Chris PeBenito |
0c73cd |
allow $2 $1:process sigchld;
|
|
Chris PeBenito |
075c4f |
')
|
|
Chris PeBenito |
075c4f |
|
|
Chris PeBenito |
c9428d |
define(`corecmd_shell_spec_domtrans_depend',`
|
|
Chris PeBenito |
0c73cd |
type bin_t, shell_exec_t;
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
dd8229 |
class dir r_dir_perms;
|
|
Chris PeBenito |
dd8229 |
class lnk_file r_file_perms;
|
|
Chris PeBenito |
dd8229 |
class file rx_file_perms
|
|
Chris PeBenito |
0c73cd |
class process { transition noatsecure siginh rlimitinh sigchld };
|
|
Chris PeBenito |
0c73cd |
class fd use;
|
|
Chris PeBenito |
0c73cd |
class fifo_file rw_file_perms;
|
|
Chris PeBenito |
4bf4ed |
')
|
|
Chris PeBenito |
4bf4ed |
|
|
Chris PeBenito |
4bf4ed |
########################################
|
|
Chris PeBenito |
c9428d |
## <interface name="corecmd_domtrans_shell">
|
|
Chris PeBenito |
4bf4ed |
## <description>
|
|
Chris PeBenito |
4bf4ed |
## Execute a shell in the target domain.
|
|
Chris PeBenito |
4bf4ed |
## </description>
|
|
Chris PeBenito |
4bf4ed |
## <parameter name="domain">
|
|
Chris PeBenito |
4bf4ed |
## The type of the process performing this action.
|
|
Chris PeBenito |
4bf4ed |
## </parameter>
|
|
Chris PeBenito |
4bf4ed |
## <parameter name="target_domain">
|
|
Chris PeBenito |
4bf4ed |
## The type of the shell process.
|
|
Chris PeBenito |
4bf4ed |
## </parameter>
|
|
Chris PeBenito |
4bf4ed |
## </interface>
|
|
Chris PeBenito |
4bf4ed |
#
|
|
Chris PeBenito |
c9428d |
define(`corecmd_domtrans_shell',`
|
|
Chris PeBenito |
0c73cd |
requires_block_template(`$0'_depend)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
c9428d |
corecmd_shell_spec_domtrans($1,$2)
|
|
Chris PeBenito |
0c73cd |
type_transition $1 shell_exec_t:process $2;
|
|
Chris PeBenito |
4bf4ed |
')
|
|
Chris PeBenito |
4bf4ed |
|
|
Chris PeBenito |
c9428d |
define(`corecmd_domtrans_shell_depend',`
|
|
Chris PeBenito |
0c73cd |
type shell_exec_t;
|
|
Chris PeBenito |
075c4f |
')
|
|
Chris PeBenito |
075c4f |
|
|
Chris PeBenito |
075c4f |
########################################
|
|
Chris PeBenito |
075c4f |
#
|
|
Chris PeBenito |
c9428d |
# corecmd_chroot_exec_chroot(domain)
|
|
Chris PeBenito |
b4cd15 |
#
|
|
Chris PeBenito |
c9428d |
define(`corecmd_chroot_exec_chroot',`
|
|
Chris PeBenito |
0c73cd |
requires_block_template(`$0'_depend)
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
allow $1 chroot_exec_t:file { getattr read execute execute_no_trans };
|
|
Chris PeBenito |
0c73cd |
allow $1 self:capability sys_chroot;
|
|
Chris PeBenito |
b4cd15 |
')
|
|
Chris PeBenito |
b4cd15 |
|
|
Chris PeBenito |
c9428d |
define(`corecmd_chroot_exec_chroot_depend',`
|
|
Chris PeBenito |
0c73cd |
type chroot_exec_t;
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
class file { getattr read execute execute_no_trans };
|
|
Chris PeBenito |
0c73cd |
class capability sys_chroot;
|
|
Chris PeBenito |
b4cd15 |
')
|
|
Chris PeBenito |
3000a3 |
|
|
Chris PeBenito |
3000a3 |
## </module>
|