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

818 lines
16 KiB
Plaintext
Raw Normal View History

2005-05-23 15:48:45 +00:00
## <summary>
2005-06-23 21:30:57 +00:00
## Core policy for shells, and generic programs
## in /bin, /sbin, /usr/bin, and /usr/sbin.
2005-05-23 15:48:45 +00:00
## </summary>
2005-08-30 14:41:52 +00:00
## <required val="true">
## Contains the base bin and sbin directory types
## which need to be searched for the kernel to
## run init.
## </required>
2005-04-20 19:07:16 +00:00
########################################
## <summary>
2005-11-15 18:47:20 +00:00
## Create a aliased type to generic bin files.
## </summary>
2005-11-15 18:47:20 +00:00
## <desc>
## <p>
## Create a aliased type to generic bin files.
## </p>
## <p>
## This is added to support targeted policy. Its
## use should be limited. It has no effect
## on the strict policy.
## </p>
## </desc>
## <param name="domain">
## <summary>
## Alias type for bin_t.
## </summary>
## </param>
interface(`corecmd_bin_alias',`
2005-11-15 18:47:20 +00:00
ifdef(`targeted_policy',`
gen_require(`
type bin_t;
')
2005-11-15 18:47:20 +00:00
typealias bin_t alias $1;
',`
errprint(`Warning: $0($1) has no effect in strict policy.'__endline__)
')
')
########################################
## <summary>
## Make general progams in bin an entrypoint for
## the specified domain.
## </summary>
## <param name="domain">
## <summary>
## The domain for which bin_t is an entrypoint.
## </summary>
## </param>
interface(`corecmd_bin_entry_type',`
gen_require(`
type bin_t;
')
domain_entry_file($1,bin_t)
')
########################################
## <summary>
## Make general progams in sbin an entrypoint for
## the specified domain.
## </summary>
## <param name="domain">
## <summary>
## The domain for which sbin programs are an entrypoint.
## </summary>
## </param>
interface(`corecmd_sbin_entry_type',`
gen_require(`
type sbin_t;
')
domain_entry_file($1,sbin_t)
')
2005-08-11 17:46:39 +00:00
########################################
2005-06-27 18:37:33 +00:00
## <summary>
## Make the shell an entrypoint for the specified domain.
## </summary>
## <param name="domain">
## <summary>
2005-06-27 18:37:33 +00:00
## The domain for which the shell is an entrypoint.
## </summary>
2005-06-27 18:37:33 +00:00
## </param>
interface(`corecmd_shell_entry_type',`
2005-06-17 17:59:26 +00:00
gen_require(`
type shell_exec_t;
')
2005-06-13 17:35:46 +00:00
domain_entry_file($1,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
#
interface(`corecmd_search_bin',`
2005-06-17 17:59:26 +00:00
gen_require(`
type bin_t;
')
allow $1 bin_t: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
#
interface(`corecmd_list_bin',`
2005-06-17 17:59:26 +00:00
gen_require(`
type bin_t;
')
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-27 20:59:28 +00:00
########################################
2005-06-27 18:37:33 +00:00
## <summary>
## Get the attributes of files in bin directories.
## </summary>
## <param name="domain">
## <summary>
2005-11-08 22:00:30 +00:00
## Domain allowed access.
## </summary>
2005-06-27 18:37:33 +00:00
## </param>
#
2006-02-02 21:08:12 +00:00
interface(`corecmd_getattr_bin_files',`
2005-06-27 18:37:33 +00:00
gen_require(`
type bin_t;
')
allow $1 bin_t:file getattr;
')
########################################
## <summary>
## Read files in bin directories.
## </summary>
## <param name="domain">
## <summary>
2005-11-08 22:00:30 +00:00
## Domain allowed access.
## </summary>
## </param>
#
2006-02-02 21:08:12 +00:00
interface(`corecmd_read_bin_files',`
gen_require(`
type bin_t;
')
allow $1 bin_t:dir search;
allow $1 bin_t:file r_file_perms;
')
2005-06-27 20:59:28 +00:00
########################################
2005-06-27 18:37:33 +00:00
## <summary>
## Read symbolic links in bin directories.
## </summary>
## <param name="domain">
## <summary>
2005-11-08 22:00:30 +00:00
## Domain allowed access.
## </summary>
2005-06-27 18:37:33 +00:00
## </param>
#
2006-02-02 21:08:12 +00:00
interface(`corecmd_read_bin_symlinks',`
2005-06-27 18:37:33 +00:00
gen_require(`
type bin_t;
')
allow $1 bin_t:dir search;
allow $1 bin_t:lnk_file r_file_perms;
')
########################################
## <summary>
## Read pipes in bin directories.
## </summary>
## <param name="domain">
## <summary>
2005-11-08 22:00:30 +00:00
## Domain allowed access.
## </summary>
## </param>
#
2006-02-02 21:08:12 +00:00
interface(`corecmd_read_bin_pipes',`
gen_require(`
type bin_t;
')
allow $1 bin_t:dir search;
allow $1 bin_t:fifo_file r_file_perms;
')
########################################
## <summary>
## Read named sockets in bin directories.
## </summary>
## <param name="domain">
## <summary>
2005-11-08 22:00:30 +00:00
## Domain allowed access.
## </summary>
## </param>
#
2006-02-02 21:08:12 +00:00
interface(`corecmd_read_bin_sockets',`
gen_require(`
type bin_t;
2005-06-27 18:37:33 +00:00
')
allow $1 bin_t:dir search;
allow $1 bin_t:sock_file r_file_perms;
2005-06-27 18:37:33 +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
#
interface(`corecmd_exec_bin',`
2005-06-17 17:59:26 +00:00
gen_require(`
type bin_t;
')
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
')
2006-01-11 23:20:28 +00:00
########################################
## <summary>
## Create, read, write, and delete bin files.
## </summary>
## <param name="domain">
## <summary>
2006-01-11 23:20:28 +00:00
## Domain allowed access.
## </summary>
2006-01-11 23:20:28 +00:00
## </param>
#
interface(`corecmd_manage_bin_files',`
gen_require(`
type bin_t;
')
allow $1 bin_t:dir rw_dir_perms;
allow $1 bin_t:file manage_file_perms;
')
########################################
## <summary>
## Relabel to and from the bin type.
## </summary>
## <param name="domain">
## <summary>
2006-01-11 23:20:28 +00:00
## Domain allowed access.
## </summary>
2006-01-11 23:20:28 +00:00
## </param>
#
interface(`corecmd_relabel_bin_files',`
gen_require(`
type bin_t;
')
allow $1 bin_t:dir search_dir_perms;
allow $1 bin_t:file { relabelfrom relabelto };
')
########################################
## <summary>
## Mmap a bin file as executable.
## </summary>
## <param name="domain">
## <summary>
2006-01-11 23:20:28 +00:00
## Domain allowed access.
## </summary>
2006-01-11 23:20:28 +00:00
## </param>
#
interface(`corecmd_mmap_bin_files',`
gen_require(`
type bin_t;
')
allow $1 bin_t:dir search_dir_perms;
allow $1 bin_t:file { getattr read execute };
')
########################################
## <summary>
## Execute a file in a bin directory
2006-01-18 16:40:04 +00:00
## in the specified domain but do not
## do it automatically. This is an explicit
## transition, requiring the caller to use setexeccon().
## </summary>
## <desc>
## <p>
## Execute a file in a bin directory
## in the specified domain. This allows
## the specified domain to execute any file
## on these filesystems in the specified
## domain. This is not suggested.
## </p>
## <p>
## No interprocess communication (signals, pipes,
## etc.) is provided by this interface since
## the domains are not owned by this module.
## </p>
## <p>
## This interface was added to handle
2006-01-18 16:40:04 +00:00
## the userhelper policy.
## </p>
## </desc>
## <param name="domain">
## <summary>
2005-11-08 22:00:30 +00:00
## Domain allowed access.
## </summary>
## </param>
## <param name="target_domain">
## <summary>
## The type of the new process.
## </summary>
## </param>
#
2006-01-18 16:40:04 +00:00
interface(`corecmd_bin_spec_domtrans',`
gen_require(`
type bin_t;
')
allow $1 bin_t:dir search;
allow $1 bin_t:lnk_file { getattr read };
2006-01-18 16:40:04 +00:00
domain_trans($1,bin_t,$2)
')
########################################
## <summary>
## Execute a file in a bin directory
## in the specified domain.
## </summary>
## <desc>
## <p>
## Execute a file in a bin directory
## in the specified domain. This allows
## the specified domain to execute any file
## on these filesystems in the specified
## domain. This is not suggested.
## </p>
## <p>
## No interprocess communication (signals, pipes,
## etc.) is provided by this interface since
## the domains are not owned by this module.
## </p>
## <p>
## This interface was added to handle
## the ssh-agent policy.
## </p>
## </desc>
## <param name="domain">
## <summary>
2006-01-18 16:40:04 +00:00
## Domain allowed access.
## </summary>
2006-01-18 16:40:04 +00:00
## </param>
## <param name="target_domain">
## <summary>
2006-01-18 16:40:04 +00:00
## The type of the new process.
## </summary>
2006-01-18 16:40:04 +00:00
## </param>
#
interface(`corecmd_bin_domtrans',`
gen_require(`
type bin_t;
')
corecmd_bin_spec_domtrans($1,$2)
type_transition $1 bin_t:process $2;
')
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
#
interface(`corecmd_search_sbin',`
2005-06-17 17:59:26 +00:00
gen_require(`
type sbin_t;
')
2005-11-21 22:15:11 +00:00
allow $1 sbin_t:dir search_dir_perms;
2005-05-12 20:50:09 +00:00
')
2005-11-15 20:17:18 +00:00
########################################
## <summary>
## Do not audit attempts to search
## sbin directories.
## </summary>
## <param name="domain">
## <summary>
2005-11-15 20:17:18 +00:00
## Domain to not audit.
## </summary>
2005-11-15 20:17:18 +00:00
## </param>
#
interface(`corecmd_dontaudit_search_sbin',`
gen_require(`
type sbin_t;
')
dontaudit $1 sbin_t:dir search_dir_perms;
')
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
#
interface(`corecmd_list_sbin',`
2005-06-17 17:59:26 +00:00
gen_require(`
type sbin_t;
')
allow $1 sbin_t:dir r_dir_perms;
2005-05-12 20:50:09 +00:00
')
2005-06-27 18:37:33 +00:00
########################################
#
2006-02-02 21:08:12 +00:00
# corecmd_getattr_sbin_files(domain)
2005-06-27 18:37:33 +00:00
#
2006-02-02 21:08:12 +00:00
interface(`corecmd_getattr_sbin_files',`
2005-06-27 18:37:33 +00:00
gen_require(`
type sbin_t;
')
allow $1 sbin_t:file getattr;
')
2005-05-30 21:17:20 +00:00
########################################
#
2006-02-02 21:08:12 +00:00
# corecmd_dontaudit_getattr_sbin_files(domain)
2005-05-30 21:17:20 +00:00
#
2006-02-02 21:08:12 +00:00
interface(`corecmd_dontaudit_getattr_sbin_files',`
2005-06-17 17:59:26 +00:00
gen_require(`
type sbin_t;
')
2005-06-27 18:37:33 +00:00
dontaudit $1 sbin_t:file getattr;
2005-05-30 21:17:20 +00:00
')
########################################
## <summary>
## Read files in sbin directories.
## </summary>
## <param name="domain">
## <summary>
2005-11-08 22:00:30 +00:00
## Domain allowed access.
## </summary>
## </param>
#
2006-02-02 21:08:12 +00:00
interface(`corecmd_read_sbin_files',`
gen_require(`
type sbin_t;
')
allow $1 sbin_t:dir search;
allow $1 sbin_t:file r_file_perms;
')
2005-06-27 20:59:28 +00:00
########################################
## <summary>
## Read symbolic links in sbin directories.
## </summary>
## <param name="domain">
## <summary>
2005-11-08 22:00:30 +00:00
## Domain allowed access.
## </summary>
2005-06-27 20:59:28 +00:00
## </param>
#
2006-02-02 21:08:12 +00:00
interface(`corecmd_read_sbin_symlinks',`
2005-06-27 20:59:28 +00:00
gen_require(`
type sbin_t;
')
allow $1 sbin_t:dir search;
allow $1 sbin_t:lnk_file r_file_perms;
')
########################################
## <summary>
## Read named pipes in sbin directories.
## </summary>
## <param name="domain">
## <summary>
2005-11-08 22:00:30 +00:00
## Domain allowed access.
## </summary>
## </param>
#
2006-02-02 21:08:12 +00:00
interface(`corecmd_read_sbin_pipes',`
gen_require(`
type sbin_t;
')
allow $1 sbin_t:dir search;
allow $1 sbin_t:fifo_file r_file_perms;
')
########################################
## <summary>
## Read named sockets in sbin directories.
## </summary>
## <param name="domain">
## <summary>
2005-11-08 22:00:30 +00:00
## Domain allowed access.
## </summary>
## </param>
#
2006-02-02 21:08:12 +00:00
interface(`corecmd_read_sbin_sockets',`
gen_require(`
type sbin_t;
2005-06-27 20:59:28 +00:00
')
allow $1 sbin_t:dir search;
allow $1 sbin_t:sock_file r_file_perms;
2005-06-27 20:59:28 +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
#
interface(`corecmd_exec_sbin',`
2005-06-17 17:59:26 +00:00
gen_require(`
type sbin_t;
')
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)
2006-01-11 23:20:28 +00:00
')
2005-06-09 14:50:48 +00:00
2006-01-11 23:20:28 +00:00
########################################
## <summary>
## Create, read, write, and delete sbin files.
## </summary>
## <param name="domain">
## <summary>
2006-01-11 23:20:28 +00:00
## Domain allowed access.
## </summary>
2006-01-11 23:20:28 +00:00
## </param>
#
# cjp: added for prelink
interface(`corecmd_manage_sbin_files',`
gen_require(`
type sbin_t;
')
allow $1 sbin_t:dir rw_dir_perms;
allow $1 sbin_t:file manage_file_perms;
')
########################################
## <summary>
## Relabel to and from the sbin type.
## </summary>
## <param name="domain">
## <summary>
2006-01-11 23:20:28 +00:00
## Domain allowed access.
## </summary>
2006-01-11 23:20:28 +00:00
## </param>
#
# cjp: added for prelink
interface(`corecmd_relabel_sbin_files',`
gen_require(`
type sbin_t;
')
allow $1 sbin_t:dir search_dir_perms;
allow $1 sbin_t:file { relabelfrom relabelto };
')
########################################
## <summary>
## Mmap a sbin file as executable.
## </summary>
## <param name="domain">
## <summary>
2006-01-11 23:20:28 +00:00
## Domain allowed access.
## </summary>
2006-01-11 23:20:28 +00:00
## </param>
#
# cjp: added for prelink
interface(`corecmd_mmap_sbin_files',`
gen_require(`
type sbin_t;
')
allow $1 sbin_t:dir search_dir_perms;
allow $1 sbin_t:file { getattr read execute };
2005-04-14 20:18:17 +00:00
')
########################################
## <summary>
## Execute a file in a sbin directory
## in the specified domain.
## </summary>
## <desc>
## <p>
## Execute a file in a sbin directory
## in the specified domain. This allows
## the specified domain to execute any file
## on these filesystems in the specified
## domain. This is not suggested.
## </p>
## <p>
## No interprocess communication (signals, pipes,
## etc.) is provided by this interface since
## the domains are not owned by this module.
## </p>
## <p>
## This interface was added to handle
## the ssh-agent policy.
## </p>
## </desc>
## <param name="domain">
## <summary>
2005-11-08 22:00:30 +00:00
## Domain allowed access.
## </summary>
## </param>
## <param name="target_domain">
## <summary>
## The type of the new process.
## </summary>
## </param>
#
interface(`corecmd_sbin_domtrans',`
gen_require(`
type sbin_t;
')
allow $1 sbin_t:dir search;
allow $1 sbin_t:lnk_file { getattr read };
domain_auto_trans($1,sbin_t,$2)
')
2006-01-18 16:40:04 +00:00
########################################
## <summary>
## Execute a file in a sbin directory
## in the specified domain but do not
## do it automatically. This is an explicit
## transition, requiring the caller to use setexeccon().
## </summary>
## <desc>
## <p>
## Execute a file in a sbin directory
## in the specified domain. This allows
## the specified domain to execute any file
## on these filesystems in the specified
## domain. This is not suggested.
## </p>
## <p>
## No interprocess communication (signals, pipes,
## etc.) is provided by this interface since
## the domains are not owned by this module.
## </p>
## <p>
## This interface was added to handle
## the userhelper policy.
## </p>
## </desc>
## <param name="domain">
## <summary>
2006-01-18 16:40:04 +00:00
## Domain allowed access.
## </summary>
2006-01-18 16:40:04 +00:00
## </param>
## <param name="target_domain">
## <summary>
2006-01-18 16:40:04 +00:00
## The type of the new process.
## </summary>
2006-01-18 16:40:04 +00:00
## </param>
#
interface(`corecmd_sbin_spec_domtrans',`
gen_require(`
type sbin_t;
')
allow $1 sbin_t:dir search;
allow $1 sbin_t:lnk_file { getattr read };
domain_trans($1,sbin_t,$2)
')
2005-11-08 22:00:30 +00:00
########################################
## <summary>
## Check if a shell is executable (DAC-wise).
## </summary>
## <param name="domain">
## <summary>
2005-11-08 22:00:30 +00:00
## Domain allowed access.
## </summary>
2005-11-08 22:00:30 +00:00
## </param>
#
interface(`corecmd_check_exec_shell',`
gen_require(`
type bin_t, shell_exec_t;
')
allow $1 bin_t:dir r_dir_perms;
allow $1 bin_t:lnk_file r_file_perms;
allow $1 shell_exec_t:file execute;
')
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
#
interface(`corecmd_exec_shell',`
2005-06-17 17:59:26 +00:00
gen_require(`
type bin_t, shell_exec_t;
')
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-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
#
interface(`corecmd_exec_ls',`
2005-06-17 17:59:26 +00:00
gen_require(`
type bin_t, ls_exec_t;
')
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-05-12 20:50:09 +00:00
########################################
2005-08-11 17:46:39 +00:00
## <summary>
## Execute a shell in the target domain. This
## is an explicit transition, requiring the
## caller to use setexeccon().
## </summary>
2005-06-23 21:30:57 +00:00
## <desc>
## <p>
2005-06-23 21:30:57 +00:00
## Execute a shell in the target domain. This
## is an explicit transition, requiring the
## caller to use setexeccon().
## </p>
## <p>
## No interprocess communication (signals, pipes,
## etc.) is provided by this interface since
## the domains are not owned by this module.
## </p>
2005-06-23 21:30:57 +00:00
## </desc>
## <param name="domain">
## <summary>
2005-11-08 22:00:30 +00:00
## Domain allowed access.
## </summary>
2005-06-23 21:30:57 +00:00
## </param>
## <param name="target_domain">
## <summary>
2005-06-23 21:30:57 +00:00
## The type of the shell process.
## </summary>
2005-06-23 21:30:57 +00:00
## </param>
2005-05-12 20:50:09 +00:00
#
interface(`corecmd_shell_spec_domtrans',`
2005-06-17 17:59:26 +00:00
gen_require(`
type bin_t, shell_exec_t;
')
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)
2005-05-12 20:50:09 +00:00
')
########################################
## <summary>
## Execute a shell in the specified domain.
## </summary>
2005-06-23 21:30:57 +00:00
## <desc>
## <p>
## Execute a shell in the specified domain.
## </p>
## <p>
## No interprocess communication (signals, pipes,
## etc.) is provided by this interface since
## the domains are not owned by this module.
## </p>
2005-06-23 21:30:57 +00:00
## </desc>
## <param name="domain">
## <summary>
2005-11-08 22:00:30 +00:00
## Domain allowed access.
## </summary>
2005-06-23 21:30:57 +00:00
## </param>
## <param name="target_domain">
## <summary>
2005-06-23 21:30:57 +00:00
## The type of the shell process.
## </summary>
2005-06-23 21:30:57 +00:00
## </param>
#
interface(`corecmd_shell_domtrans',`
2005-06-17 17:59:26 +00:00
gen_require(`
type shell_exec_t;
')
2005-06-13 17:35:46 +00:00
corecmd_shell_spec_domtrans($1,$2)
type_transition $1 shell_exec_t:process $2;
')
2005-04-14 20:18:17 +00:00
########################################
#
# corecmd_exec_chroot(domain)
2005-04-14 20:18:17 +00:00
#
interface(`corecmd_exec_chroot',`
2005-06-17 17:59:26 +00:00
gen_require(`
type chroot_exec_t;
')
2005-06-17 17:59:26 +00:00
can_exec($1,chroot_exec_t)
allow $1 self:capability sys_chroot;
2005-04-14 20:18:17 +00:00
')