|
Chris PeBenito |
3000a3 |
## <summary>
|
|
Chris PeBenito |
414e41 |
## Core policy for shells, and generic programs
|
|
Chris PeBenito |
414e41 |
## in /bin, /sbin, /usr/bin, and /usr/sbin.
|
|
Chris PeBenito |
3000a3 |
## </summary>
|
|
Chris PeBenito |
e181fe |
|
|
Chris PeBenito |
80436b |
## <summary>
|
|
Chris PeBenito |
80436b |
## Make the shell an entrypoint for the specified domain.
|
|
Chris PeBenito |
80436b |
## </summary>
|
|
Chris PeBenito |
80436b |
## <param name="domain">
|
|
Chris PeBenito |
80436b |
## The domain for which the shell is an entrypoint.
|
|
Chris PeBenito |
80436b |
## </param>
|
|
Chris PeBenito |
199895 |
interface(`corecmd_shell_entry_type',`
|
|
Chris PeBenito |
139520 |
gen_require(`
|
|
Chris PeBenito |
139520 |
type shell_exec_t;
|
|
Chris PeBenito |
139520 |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
c9428d |
domain_entry_file($1,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 |
199895 |
interface(`corecmd_search_bin',`
|
|
Chris PeBenito |
139520 |
gen_require(`
|
|
Chris PeBenito |
139520 |
type bin_t;
|
|
Chris PeBenito |
139520 |
class dir search;
|
|
Chris PeBenito |
139520 |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
allow $1 bin_t: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 |
199895 |
interface(`corecmd_list_bin',`
|
|
Chris PeBenito |
139520 |
gen_require(`
|
|
Chris PeBenito |
139520 |
type bin_t;
|
|
Chris PeBenito |
139520 |
class dir r_dir_perms;
|
|
Chris PeBenito |
139520 |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
dd8229 |
allow $1 bin_t:dir r_dir_perms;
|
|
Chris PeBenito |
075c4f |
')
|
|
Chris PeBenito |
075c4f |
|
|
Chris PeBenito |
58c3da |
########################################
|
|
Chris PeBenito |
80436b |
## <summary>
|
|
Chris PeBenito |
80436b |
## Get the attributes of files in bin directories.
|
|
Chris PeBenito |
80436b |
## </summary>
|
|
Chris PeBenito |
80436b |
## <param name="domain">
|
|
Chris PeBenito |
80436b |
## The type of the process performing this action.
|
|
Chris PeBenito |
80436b |
## </param>
|
|
Chris PeBenito |
80436b |
interface(`corecmd_getattr_bin_file',`
|
|
Chris PeBenito |
80436b |
gen_require(`
|
|
Chris PeBenito |
80436b |
type bin_t;
|
|
Chris PeBenito |
80436b |
class file getattr;
|
|
Chris PeBenito |
80436b |
')
|
|
Chris PeBenito |
80436b |
|
|
Chris PeBenito |
80436b |
allow $1 bin_t:file getattr;
|
|
Chris PeBenito |
80436b |
')
|
|
Chris PeBenito |
80436b |
|
|
Chris PeBenito |
58c3da |
########################################
|
|
Chris PeBenito |
80436b |
## <summary>
|
|
Chris PeBenito |
80436b |
## Read symbolic links in bin directories.
|
|
Chris PeBenito |
80436b |
## </summary>
|
|
Chris PeBenito |
80436b |
## <param name="domain">
|
|
Chris PeBenito |
80436b |
## The type of the process performing this action.
|
|
Chris PeBenito |
80436b |
## </param>
|
|
Chris PeBenito |
80436b |
interface(`corecmd_read_bin_symlink',`
|
|
Chris PeBenito |
80436b |
gen_require(`
|
|
Chris PeBenito |
80436b |
type bin_t;
|
|
Chris PeBenito |
80436b |
class dir search;
|
|
Chris PeBenito |
80436b |
class lnk_file read;
|
|
Chris PeBenito |
80436b |
')
|
|
Chris PeBenito |
80436b |
|
|
Chris PeBenito |
80436b |
allow $1 bin_t:dir search;
|
|
Chris PeBenito |
80436b |
allow $1 bin_t:lnk_file read;
|
|
Chris PeBenito |
80436b |
')
|
|
Chris PeBenito |
80436b |
|
|
Chris PeBenito |
075c4f |
########################################
|
|
Chris PeBenito |
075c4f |
#
|
|
Chris PeBenito |
c9428d |
# corecmd_exec_bin(domain)
|
|
Chris PeBenito |
b4cd15 |
#
|
|
Chris PeBenito |
199895 |
interface(`corecmd_exec_bin',`
|
|
Chris PeBenito |
139520 |
gen_require(`
|
|
Chris PeBenito |
139520 |
type bin_t;
|
|
Chris PeBenito |
139520 |
class dir r_dir_perms;
|
|
Chris PeBenito |
139520 |
class lnk_file r_file_perms;
|
|
Chris PeBenito |
139520 |
')
|
|
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 |
b4cd15 |
########################################
|
|
Chris PeBenito |
b4cd15 |
#
|
|
Chris PeBenito |
c9428d |
# corecmd_search_sbin(domain)
|
|
Chris PeBenito |
075c4f |
#
|
|
Chris PeBenito |
199895 |
interface(`corecmd_search_sbin',`
|
|
Chris PeBenito |
139520 |
gen_require(`
|
|
Chris PeBenito |
139520 |
type sbin_t;
|
|
Chris PeBenito |
139520 |
class dir search;
|
|
Chris PeBenito |
139520 |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
allow $1 sbin_t: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 |
199895 |
interface(`corecmd_list_sbin',`
|
|
Chris PeBenito |
139520 |
gen_require(`
|
|
Chris PeBenito |
139520 |
type sbin_t;
|
|
Chris PeBenito |
139520 |
class dir r_dir_perms;
|
|
Chris PeBenito |
139520 |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
0c73cd |
allow $1 sbin_t:dir r_dir_perms;
|
|
Chris PeBenito |
075c4f |
')
|
|
Chris PeBenito |
075c4f |
|
|
Chris PeBenito |
075c4f |
########################################
|
|
Chris PeBenito |
075c4f |
#
|
|
Chris PeBenito |
80436b |
# corecmd_getattr_sbin_file(domain)
|
|
Chris PeBenito |
80436b |
#
|
|
Chris PeBenito |
80436b |
interface(`corecmd_getattr_sbin_file',`
|
|
Chris PeBenito |
80436b |
gen_require(`
|
|
Chris PeBenito |
80436b |
type sbin_t;
|
|
Chris PeBenito |
80436b |
class file getattr;
|
|
Chris PeBenito |
80436b |
')
|
|
Chris PeBenito |
80436b |
|
|
Chris PeBenito |
80436b |
allow $1 sbin_t:file getattr;
|
|
Chris PeBenito |
80436b |
')
|
|
Chris PeBenito |
80436b |
|
|
Chris PeBenito |
80436b |
########################################
|
|
Chris PeBenito |
80436b |
#
|
|
Chris PeBenito |
c9428d |
# corecmd_dontaudit_getattr_sbin_file(domain)
|
|
Chris PeBenito |
f5c42b |
#
|
|
Chris PeBenito |
199895 |
interface(`corecmd_dontaudit_getattr_sbin_file',`
|
|
Chris PeBenito |
139520 |
gen_require(`
|
|
Chris PeBenito |
139520 |
type sbin_t;
|
|
Chris PeBenito |
139520 |
class file getattr;
|
|
Chris PeBenito |
139520 |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
80436b |
dontaudit $1 sbin_t:file getattr;
|
|
Chris PeBenito |
f5c42b |
')
|
|
Chris PeBenito |
f5c42b |
|
|
Chris PeBenito |
f5c42b |
########################################
|
|
Chris PeBenito |
58c3da |
## <summary>
|
|
Chris PeBenito |
58c3da |
## Read symbolic links in sbin directories.
|
|
Chris PeBenito |
58c3da |
## </summary>
|
|
Chris PeBenito |
58c3da |
## <param name="domain">
|
|
Chris PeBenito |
58c3da |
## The type of the process performing this action.
|
|
Chris PeBenito |
58c3da |
## </param>
|
|
Chris PeBenito |
58c3da |
interface(`corecmd_read_sbin_symlink',`
|
|
Chris PeBenito |
58c3da |
gen_require(`
|
|
Chris PeBenito |
58c3da |
type sbin_t;
|
|
Chris PeBenito |
58c3da |
class dir search;
|
|
Chris PeBenito |
58c3da |
class lnk_file read;
|
|
Chris PeBenito |
58c3da |
')
|
|
Chris PeBenito |
58c3da |
|
|
Chris PeBenito |
58c3da |
allow $1 sbin_t:dir search;
|
|
Chris PeBenito |
58c3da |
allow $1 sbin_t:lnk_file read;
|
|
Chris PeBenito |
58c3da |
')
|
|
Chris PeBenito |
58c3da |
|
|
Chris PeBenito |
58c3da |
########################################
|
|
Chris PeBenito |
f5c42b |
#
|
|
Chris PeBenito |
c9428d |
# corecmd_exec_sbin(domain)
|
|
Chris PeBenito |
b4cd15 |
#
|
|
Chris PeBenito |
199895 |
interface(`corecmd_exec_sbin',`
|
|
Chris PeBenito |
139520 |
gen_require(`
|
|
Chris PeBenito |
139520 |
type sbin_t;
|
|
Chris PeBenito |
139520 |
class dir r_dir_perms;
|
|
Chris PeBenito |
139520 |
class lnk_file r_file_perms;
|
|
Chris PeBenito |
139520 |
')
|
|
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 |
b4cd15 |
########################################
|
|
Chris PeBenito |
b4cd15 |
#
|
|
Chris PeBenito |
c9428d |
# corecmd_exec_shell(domain)
|
|
Chris PeBenito |
b4cd15 |
#
|
|
Chris PeBenito |
199895 |
interface(`corecmd_exec_shell',`
|
|
Chris PeBenito |
139520 |
gen_require(`
|
|
Chris PeBenito |
139520 |
type bin_t, shell_exec_t;
|
|
Chris PeBenito |
139520 |
class dir r_dir_perms;
|
|
Chris PeBenito |
139520 |
class lnk_file r_file_perms;
|
|
Chris PeBenito |
139520 |
')
|
|
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 |
b4cd15 |
########################################
|
|
Chris PeBenito |
f5c42b |
#
|
|
Chris PeBenito |
c9428d |
# corecmd_exec_ls(domain)
|
|
Chris PeBenito |
f5c42b |
#
|
|
Chris PeBenito |
199895 |
interface(`corecmd_exec_ls',`
|
|
Chris PeBenito |
139520 |
gen_require(`
|
|
Chris PeBenito |
139520 |
type bin_t, ls_exec_t;
|
|
Chris PeBenito |
139520 |
class dir r_dir_perms;
|
|
Chris PeBenito |
139520 |
class lnk_file r_file_perms;
|
|
Chris PeBenito |
139520 |
')
|
|
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 |
f5c42b |
########################################
|
|
Chris PeBenito |
414e41 |
## <desc>
|
|
Chris PeBenito |
414e41 |
## Execute a shell in the target domain. This
|
|
Chris PeBenito |
414e41 |
## is an explicit transition, requiring the
|
|
Chris PeBenito |
414e41 |
## caller to use setexeccon().
|
|
Chris PeBenito |
414e41 |
## </desc>
|
|
Chris PeBenito |
414e41 |
## <param name="domain">
|
|
Chris PeBenito |
414e41 |
## The type of the process performing this action.
|
|
Chris PeBenito |
414e41 |
## </param>
|
|
Chris PeBenito |
414e41 |
## <param name="target_domain">
|
|
Chris PeBenito |
414e41 |
## The type of the shell process.
|
|
Chris PeBenito |
414e41 |
## </param>
|
|
Chris PeBenito |
075c4f |
#
|
|
Chris PeBenito |
199895 |
interface(`corecmd_shell_spec_domtrans',`
|
|
Chris PeBenito |
139520 |
gen_require(`
|
|
Chris PeBenito |
139520 |
type bin_t, shell_exec_t;
|
|
Chris PeBenito |
139520 |
class dir r_dir_perms;
|
|
Chris PeBenito |
139520 |
class lnk_file r_file_perms;
|
|
Chris PeBenito |
139520 |
class fd use;
|
|
Chris PeBenito |
139520 |
class fifo_file rw_file_perms;
|
|
Chris PeBenito |
139520 |
class process sigchld;
|
|
Chris PeBenito |
139520 |
')
|
|
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 |
4bf4ed |
########################################
|
|
Chris PeBenito |
414e41 |
## <desc>
|
|
Chris PeBenito |
414e41 |
## Execute a shell in the target domain.
|
|
Chris PeBenito |
414e41 |
## </desc>
|
|
Chris PeBenito |
414e41 |
## <param name="domain">
|
|
Chris PeBenito |
414e41 |
## The type of the process performing this action.
|
|
Chris PeBenito |
414e41 |
## </param>
|
|
Chris PeBenito |
414e41 |
## <param name="target_domain">
|
|
Chris PeBenito |
414e41 |
## The type of the shell process.
|
|
Chris PeBenito |
414e41 |
## </param>
|
|
Chris PeBenito |
4bf4ed |
#
|
|
Chris PeBenito |
199895 |
interface(`corecmd_domtrans_shell',`
|
|
Chris PeBenito |
139520 |
gen_require(`
|
|
Chris PeBenito |
139520 |
type shell_exec_t;
|
|
Chris PeBenito |
139520 |
')
|
|
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 |
075c4f |
########################################
|
|
Chris PeBenito |
075c4f |
#
|
|
Chris PeBenito |
c9428d |
# corecmd_chroot_exec_chroot(domain)
|
|
Chris PeBenito |
b4cd15 |
#
|
|
Chris PeBenito |
199895 |
interface(`corecmd_chroot_exec_chroot',`
|
|
Chris PeBenito |
139520 |
gen_require(`
|
|
Chris PeBenito |
139520 |
type chroot_exec_t;
|
|
Chris PeBenito |
139520 |
class capability sys_chroot;
|
|
Chris PeBenito |
139520 |
')
|
|
Chris PeBenito |
0c73cd |
|
|
Chris PeBenito |
139520 |
can_exec($1,chroot_exec_t)
|
|
Chris PeBenito |
0c73cd |
allow $1 self:capability sys_chroot;
|
|
Chris PeBenito |
b4cd15 |
')
|
|
Chris PeBenito |
b4cd15 |
|