1341 lines
27 KiB
Plaintext
1341 lines
27 KiB
Plaintext
## <summary>
|
|
## Basic filesystem types and interfaces.
|
|
## </summary>
|
|
## <desc>
|
|
## <p>
|
|
## This module contains basic filesystem types and interfaces. This
|
|
## includes:
|
|
## <ul>
|
|
## <li>The concept of different file types including basic
|
|
## files, mount points, tmp files, etc.</li>
|
|
## <li>Access to groups of files and all files.</li>
|
|
## <li>Types and interfaces for the basic filesystem layout
|
|
## (/, /etc, /tmp, /usr, etc.).</li>
|
|
## </ul>
|
|
## </p>
|
|
## </desc>
|
|
|
|
########################################
|
|
#
|
|
# files_type(type)
|
|
#
|
|
interface(`files_type',`
|
|
gen_require(`
|
|
attribute file_type;
|
|
')
|
|
|
|
fs_associate($1)
|
|
fs_associate_noxattr($1)
|
|
typeattribute $1 file_type;
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_lock_file(type)
|
|
#
|
|
interface(`files_lock_file',`
|
|
gen_require(`
|
|
attribute lockfile;
|
|
')
|
|
|
|
files_type($1)
|
|
typeattribute $1 lockfile;
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_mountpoint(type)
|
|
#
|
|
interface(`files_mountpoint',`
|
|
gen_require(`
|
|
attribute mountpoint;
|
|
')
|
|
|
|
files_type($1)
|
|
typeattribute $1 mountpoint;
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_pid_file(type)
|
|
#
|
|
interface(`files_pid_file',`
|
|
gen_require(`
|
|
attribute pidfile;
|
|
')
|
|
|
|
files_type($1)
|
|
typeattribute $1 pidfile;
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_tmp_file(type)
|
|
#
|
|
interface(`files_tmp_file',`
|
|
gen_require(`
|
|
attribute tmpfile;
|
|
')
|
|
|
|
files_type($1)
|
|
typeattribute $1 tmpfile;
|
|
')
|
|
|
|
########################################
|
|
## <desc>
|
|
## Transform the type into a file, for use on a
|
|
## virtual memory filesystem (tmpfs).
|
|
## </desc>
|
|
## <param name="type">
|
|
## The type to be transformed.
|
|
## </param>
|
|
#
|
|
interface(`files_tmpfs_file',`
|
|
gen_require(`
|
|
attribute tmpfsfile;
|
|
')
|
|
|
|
files_type($1)
|
|
fs_associate_tmpfs($1)
|
|
typeattribute $1 tmpfsfile;
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_getattr_all_files(domain)
|
|
|
|
interface(`files_getattr_all_files',`
|
|
gen_require(`
|
|
attribute file_type;
|
|
class dir { search getattr };
|
|
class file getattr;
|
|
class lnk_file getattr;
|
|
class fifo_file getattr;
|
|
class sock_file getattr;
|
|
')
|
|
|
|
allow $1 file_type:dir { search getattr };
|
|
allow $1 file_type:file getattr;
|
|
allow $1 file_type:lnk_file getattr;
|
|
allow $1 file_type:fifo_file getattr;
|
|
allow $1 file_type:sock_file getattr;
|
|
')
|
|
|
|
########################################
|
|
## <desc>
|
|
## Relabel all files on the filesystem, except
|
|
## the listed exceptions.
|
|
## </desc>
|
|
## <param name="domain">
|
|
## The type of the domain perfoming this action.
|
|
## </param>
|
|
## <param name="exception_types" optional="true">
|
|
## The types to be excluded. Each type or attribute
|
|
## must be negated by the caller.
|
|
## </param>
|
|
#
|
|
interface(`files_relabel_all_files',`
|
|
gen_require(`
|
|
attribute file_type;
|
|
class dir { r_dir_perms relabelfrom relabelto };
|
|
class file { relabelfrom relabelto };
|
|
class lnk_file { relabelfrom relabelto };
|
|
class fifo_file { relabelfrom relabelto };
|
|
class sock_file { relabelfrom relabelto };
|
|
class blk_file relabelfrom;
|
|
class chr_file relabelfrom;
|
|
')
|
|
|
|
allow $1 { file_type $2 }:dir { r_dir_perms relabelfrom relabelto };
|
|
allow $1 { file_type $2 }:file { getattr relabelfrom relabelto };
|
|
allow $1 { file_type $2 }:lnk_file { getattr relabelfrom relabelto };
|
|
allow $1 { file_type $2 }:fifo_file { getattr relabelfrom relabelto };
|
|
allow $1 { file_type $2 }:sock_file { getattr relabelfrom relabelto };
|
|
allow $1 { file_type $2 }:blk_file { getattr relabelfrom };
|
|
allow $1 { file_type $2 }:chr_file { getattr relabelfrom };
|
|
|
|
# satisfy the assertions:
|
|
seutil_relabelto_binary_pol($1)
|
|
')
|
|
|
|
########################################
|
|
## <desc>
|
|
## Manage all files on the filesystem, except
|
|
## the listed exceptions.
|
|
## </desc>
|
|
## <param name="domain">
|
|
## The type of the domain perfoming this action.
|
|
## </param>
|
|
## <param name="exception_types" optional="true">
|
|
## The types to be excluded. Each type or attribute
|
|
## must be negated by the caller.
|
|
## </param>
|
|
#
|
|
interface(`files_manage_all_files',`
|
|
gen_require(`
|
|
attribute file_type;
|
|
class dir create_dir_perms;
|
|
class file create_file_perms;
|
|
class lnk_file create_lnk_perms;
|
|
class fifo_file create_file_perms;
|
|
class sock_file create_file_perms;
|
|
')
|
|
|
|
allow $1 { file_type $2 }:dir create_dir_perms;
|
|
allow $1 { file_type $2 }:file create_file_perms;
|
|
allow $1 { file_type $2 }:lnk_file create_lnk_perms;
|
|
allow $1 { file_type $2 }:fifo_file create_file_perms;
|
|
allow $1 { file_type $2 }:sock_file create_file_perms;
|
|
|
|
# satisfy the assertions:
|
|
seutil_create_binary_pol($1)
|
|
bootloader_manage_kernel_modules($1)
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_search_all_dirs(domain)
|
|
#
|
|
interface(`files_search_all_dirs',`
|
|
gen_require(`
|
|
attribute file_type;
|
|
class dir search;
|
|
')
|
|
|
|
allow $1 file_type:dir search;
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_list_all_dirs(domain)
|
|
#
|
|
interface(`files_list_all_dirs',`
|
|
gen_require(`
|
|
attribute file_type;
|
|
class dir r_dir_perms;
|
|
')
|
|
|
|
allow $1 file_type:dir r_dir_perms;
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_dontaudit_search_all_dirs(domain)
|
|
#
|
|
interface(`files_dontaudit_search_all_dirs',`
|
|
gen_require(`
|
|
attribute file_type;
|
|
class dir search;
|
|
')
|
|
|
|
dontaudit $1 file_type:dir search;
|
|
')
|
|
|
|
#######################################
|
|
#
|
|
# files_relabelto_all_file_type_fs(domain)
|
|
#
|
|
interface(`files_relabelto_all_file_type_fs',`
|
|
gen_require(`
|
|
attribute file_type;
|
|
filesystem relabelto;
|
|
')
|
|
|
|
allow $1 file_type:filesystem relabelto;
|
|
')
|
|
|
|
#######################################
|
|
#
|
|
# files_mount_all_file_type_fs(domain)
|
|
#
|
|
interface(`files_mount_all_file_type_fs',`
|
|
gen_require(`
|
|
attribute file_type;
|
|
filesystem mount;
|
|
')
|
|
|
|
allow $1 file_type:filesystem mount;
|
|
')
|
|
|
|
#######################################
|
|
#
|
|
# files_unmount_all_file_type_fs(domain)
|
|
#
|
|
interface(`files_unmount_all_file_type_fs',`
|
|
gen_require(`
|
|
attribute file_type;
|
|
filesystem mount;
|
|
')
|
|
|
|
allow $1 file_type:filesystem mount;
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_mounton_all_mountpoints(domain)
|
|
#
|
|
interface(`files_mounton_all_mountpoints',`
|
|
gen_require(`
|
|
attribute mountpoint;
|
|
class dir { getattr search mounton };
|
|
')
|
|
|
|
allow $1 mountpoint:dir { getattr search mounton };
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_list_root(domain)
|
|
#
|
|
interface(`files_list_root',`
|
|
gen_require(`
|
|
type root_t;
|
|
class dir r_dir_perms;
|
|
class lnk_file r_file_perms;
|
|
')
|
|
|
|
allow $1 root_t:dir r_dir_perms;
|
|
allow $1 root_t:lnk_file r_file_perms;
|
|
')
|
|
|
|
########################################
|
|
## <desc>
|
|
## Create an object in the root directory, with a private
|
|
## type. If no object class is specified, the
|
|
## default is file.
|
|
## </desc>
|
|
## <param name="domain">
|
|
## The type of the process performing this action.
|
|
## </param>
|
|
## <param name="private type" optional="true">
|
|
## The type of the object to be created. If no type
|
|
## is specified, the type of the root directory will
|
|
## be used.
|
|
## </param>
|
|
## <param name="object" optional="true">
|
|
## The object class of the object being created. If
|
|
## no class is specified, file will be used.
|
|
## </param>
|
|
#
|
|
interface(`files_create_root',`
|
|
gen_require(`
|
|
type root_t;
|
|
class dir create_dir_perms;
|
|
class file create_file_perms;
|
|
class lnk_file create_lnk_perms;
|
|
class fifo_file create_file_perms;
|
|
class sock_file create_file_perms;
|
|
class blk_file create_file_perms;
|
|
class chr_file create_file_perms;
|
|
')
|
|
|
|
allow $1 root_t:dir rw_dir_perms;
|
|
|
|
ifelse(`$3',`',`
|
|
ifelse(`$2',`',`
|
|
allow $1 root_t:file create_file_perms;
|
|
',`
|
|
type_transition $1 root_t:file $2;
|
|
')
|
|
',`
|
|
ifelse(`$2',`',`
|
|
allow $1 root_t:$3 create_file_perms;
|
|
',`
|
|
type_transition $1 root_t:$3 $2;
|
|
')
|
|
')
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_dontaudit_read_root_file(domain)
|
|
#
|
|
interface(`files_dontaudit_read_root_file',`
|
|
gen_require(`
|
|
type root_t;
|
|
class file read;
|
|
')
|
|
|
|
dontaudit $1 root_t:file read;
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_dontaudit_rw_root_file(domain)
|
|
#
|
|
interface(`files_dontaudit_rw_root_file',`
|
|
gen_require(`
|
|
type root_t;
|
|
class file { read write };
|
|
')
|
|
|
|
dontaudit $1 root_t:file { read write };
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_dontaudit_rw_root_chr_dev(domain)
|
|
#
|
|
interface(`files_dontaudit_rw_root_chr_dev',`
|
|
gen_require(`
|
|
type root_t;
|
|
class chr_file { read write };
|
|
')
|
|
|
|
dontaudit $1 root_t:chr_file { read write };
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_delete_root_dir_entry(domain)
|
|
#
|
|
interface(`files_delete_root_dir_entry',`
|
|
gen_require(`
|
|
type root_t;
|
|
class dir rw_dir_perms;
|
|
')
|
|
|
|
allow $1 root_t:dir rw_dir_perms;
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_unmount_rootfs(domain)
|
|
#
|
|
interface(`files_unmount_rootfs',`
|
|
gen_require(`
|
|
type root_t;
|
|
class filesystem unmount;
|
|
')
|
|
|
|
allow $1 root_t:filesystem unmount;
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_search_etc(domain)
|
|
#
|
|
interface(`files_search_etc',`
|
|
gen_require(`
|
|
type etc_t;
|
|
class dir search;
|
|
')
|
|
|
|
allow $1 etc_t:dir search;
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_list_etc(domain)
|
|
#
|
|
interface(`files_list_etc',`
|
|
gen_require(`
|
|
type etc_t;
|
|
class dir r_dir_perms;
|
|
')
|
|
|
|
allow $1 etc_t:dir r_dir_perms;
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_read_etc_files(domain)
|
|
#
|
|
interface(`files_read_etc_files',`
|
|
gen_require(`
|
|
type etc_t;
|
|
class dir r_dir_perms;
|
|
class file r_file_perms;
|
|
class lnk_file r_file_perms;
|
|
')
|
|
|
|
allow $1 etc_t:dir r_dir_perms;
|
|
allow $1 etc_t:file r_file_perms;
|
|
allow $1 etc_t:lnk_file r_file_perms;
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_rw_etc_files(domain)
|
|
#
|
|
interface(`files_rw_etc_files',`
|
|
gen_require(`
|
|
type etc_t;
|
|
class dir r_dir_perms;
|
|
class file rw_file_perms;
|
|
class lnk_file r_file_perms;
|
|
')
|
|
|
|
allow $1 etc_t:dir r_dir_perms;
|
|
allow $1 etc_t:file rw_file_perms;
|
|
allow $1 etc_t:lnk_file r_file_perms;
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_manage_etc_files(domain)
|
|
#
|
|
interface(`files_manage_etc_files',`
|
|
gen_require(`
|
|
type etc_t;
|
|
class dir rw_dir_perms;
|
|
class file create_file_perms;
|
|
class lnk_file r_file_perms;
|
|
')
|
|
|
|
allow $1 etc_t:dir rw_dir_perms;
|
|
allow $1 etc_t:file create_file_perms;
|
|
allow $1 etc_t:lnk_file r_file_perms;
|
|
')
|
|
|
|
########################################
|
|
## <desc>
|
|
## Delete system configuration files in /etc.
|
|
## </desc>
|
|
## <param name="domain">
|
|
## The type of the process performing this action.
|
|
## </param>
|
|
#
|
|
interface(`files_delete_etc_files',`
|
|
gen_require(`
|
|
type etc_t;
|
|
class dir rw_dir_perms;
|
|
class file unlink;
|
|
')
|
|
|
|
allow $1 etc_t:dir rw_dir_perms;
|
|
allow $1 etc_t:file unlink;
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_exec_etc_files(domain)
|
|
#
|
|
interface(`files_exec_etc_files',`
|
|
gen_require(`
|
|
type etc_t;
|
|
class dir r_dir_perms;
|
|
class lnk_file r_file_perms;
|
|
')
|
|
|
|
allow $1 etc_t:dir r_dir_perms;
|
|
allow $1 etc_t:lnk_file r_file_perms;
|
|
can_exec($1,etc_t)
|
|
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_create_boot_flag(domain)
|
|
#
|
|
# /halt, /.autofsck, etc
|
|
#
|
|
interface(`files_create_boot_flag',`
|
|
gen_require(`
|
|
type root_t, etc_runtime_t;
|
|
class dir rw_dir_perms;
|
|
class file { create read write setattr unlink};
|
|
')
|
|
|
|
allow $1 root_t:dir rw_dir_perms;
|
|
allow $1 etc_runtime_t:file { create read write setattr unlink };
|
|
type_transition $1 root_t:file etc_runtime_t;
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_manage_etc_runtime_files(type)
|
|
#
|
|
interface(`files_manage_etc_runtime_files',`
|
|
gen_require(`
|
|
type etc_t, etc_runtime_t;
|
|
class dir rw_dir_perms;
|
|
class file create_file_perms;
|
|
')
|
|
|
|
allow $1 etc_t:dir rw_dir_perms;
|
|
allow $1 etc_runtime_t:file create_file_perms;
|
|
type_transition $1 etc_t:file etc_runtime_t;
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_read_etc_runtime_files(domain)
|
|
#
|
|
interface(`files_read_etc_runtime_files',`
|
|
gen_require(`
|
|
type etc_t, etc_runtime_t;
|
|
class dir r_dir_perms;
|
|
class file r_file_perms;
|
|
')
|
|
|
|
allow $1 etc_t:dir r_dir_perms;
|
|
allow $1 etc_runtime_t:file r_file_perms;
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_create_etc_config(domain,privatetype,[class(es)])
|
|
#
|
|
interface(`files_create_etc_config',`
|
|
gen_require(`
|
|
type etc_t;
|
|
class dir rw_dir_perms;
|
|
')
|
|
|
|
allow $1 etc_t:dir rw_dir_perms;
|
|
ifelse(`$3',`',`
|
|
type_transition $1 etc_t:file $2;
|
|
',`
|
|
type_transition $1 etc_t:$3 $2;
|
|
')
|
|
')
|
|
|
|
########################################
|
|
## <summary>
|
|
## Do not audit attempts to search directories on new filesystems
|
|
## that have not yet been labeled.
|
|
## </summary>
|
|
## <param name="domain">
|
|
## The type of the process performing this action.
|
|
## </param>
|
|
#
|
|
interface(`files_dontaudit_search_isid_type_dir',`
|
|
gen_require(`
|
|
type file_t;
|
|
class dir search;
|
|
')
|
|
|
|
dontaudit $1 file_t:dir search;
|
|
')
|
|
|
|
########################################
|
|
## <summary>
|
|
## Read and write directories on new filesystems
|
|
## that have not yet been labeled.
|
|
## </summary>
|
|
## <param name="domain">
|
|
## The type of the process performing this action.
|
|
## </param>
|
|
#
|
|
interface(`files_rw_isid_type_dir',`
|
|
gen_require(`
|
|
type file_t;
|
|
class dir rw_dir_perms;
|
|
')
|
|
|
|
allow $1 file_t:dir rw_dir_perms;
|
|
')
|
|
|
|
########################################
|
|
## <summary>
|
|
## Create, read, write, and delete directories
|
|
## on new filesystems that have not yet been labeled.
|
|
## </summary>
|
|
## <param name="domain">
|
|
## The type of the process performing this action.
|
|
## </param>
|
|
#
|
|
interface(`files_manage_isid_type_dir',`
|
|
gen_require(`
|
|
type file_t;
|
|
class dir create_dir_perms;
|
|
')
|
|
|
|
allow $1 file_t:dir create_dir_perms;
|
|
')
|
|
|
|
########################################
|
|
## <summary>
|
|
## Create, read, write, and delete files
|
|
## on new filesystems that have not yet been labeled.
|
|
## </summary>
|
|
## <param name="domain">
|
|
## The type of the process performing this action.
|
|
## </param>
|
|
#
|
|
interface(`files_manage_isid_type_file',`
|
|
gen_require(`
|
|
type file_t;
|
|
class dir rw_dir_perms;
|
|
class file create_file_perms;
|
|
')
|
|
|
|
allow $1 file_t:dir rw_dir_perms;
|
|
allow $1 file_t:file create_file_perms;
|
|
')
|
|
|
|
########################################
|
|
## <summary>
|
|
## Create, read, write, and delete symbolic links
|
|
## on new filesystems that have not yet been labeled.
|
|
## </summary>
|
|
## <param name="domain">
|
|
## The type of the process performing this action.
|
|
## </param>
|
|
#
|
|
interface(`files_manage_isid_type_symlink',`
|
|
gen_require(`
|
|
type file_t;
|
|
class dir rw_dir_perms;
|
|
class lnk_file create_lnk_perms;
|
|
')
|
|
|
|
allow $1 file_t:dir rw_dir_perms;
|
|
allow $1 file_t:lnk_file create_lnk_perms;
|
|
')
|
|
|
|
########################################
|
|
## <summary>
|
|
## Read and write block device nodes on new filesystems
|
|
## that have not yet been labeled.
|
|
## </summary>
|
|
## <param name="domain">
|
|
## The type of the process performing this action.
|
|
## </param>
|
|
#
|
|
interface(`files_rw_isid_type_blk_node',`
|
|
gen_require(`
|
|
type file_t;
|
|
class dir search;
|
|
class blk_file rw_file_perms;
|
|
')
|
|
|
|
allow $1 file_t:dir search;
|
|
allow $1 file_t:blk_file rw_file_perms;
|
|
')
|
|
|
|
########################################
|
|
## <summary>
|
|
## Create, read, write, and delete block device nodes
|
|
## on new filesystems that have not yet been labeled.
|
|
## </summary>
|
|
## <param name="domain">
|
|
## The type of the process performing this action.
|
|
## </param>
|
|
#
|
|
interface(`files_manage_isid_type_blk_node',`
|
|
gen_require(`
|
|
type file_t;
|
|
class dir rw_dir_perms;
|
|
class blk_file create_file_perms;
|
|
')
|
|
|
|
allow $1 file_t:dir rw_dir_perms;
|
|
allow $1 file_t:blk_file create_file_perms;
|
|
')
|
|
|
|
########################################
|
|
## <summary>
|
|
## Create, read, write, and delete character device nodes
|
|
## on new filesystems that have not yet been labeled.
|
|
## </summary>
|
|
## <param name="domain">
|
|
## The type of the process performing this action.
|
|
## </param>
|
|
#
|
|
interface(`files_manage_isid_type_chr_node',`
|
|
gen_require(`
|
|
type file_t;
|
|
class dir rw_dir_perms;
|
|
class chr_file create_file_perms;
|
|
')
|
|
|
|
allow $1 file_t:dir rw_dir_perms;
|
|
allow $1 file_t:chr_file create_file_perms;
|
|
')
|
|
|
|
########################################
|
|
## <summary>
|
|
## Search home directories.
|
|
## </summary>
|
|
## <param name="domain">
|
|
## The type of the process performing this action.
|
|
## </param>
|
|
#
|
|
interface(`files_search_home',`
|
|
gen_require(`
|
|
type home_root_t;
|
|
class dir search;
|
|
')
|
|
|
|
allow $1 home_root_t:dir search;
|
|
')
|
|
|
|
########################################
|
|
## <summary>
|
|
## Get listing of home directories.
|
|
## </summary>
|
|
## <param name="domain">
|
|
## The type of the process performing this action.
|
|
## </param>
|
|
#
|
|
interface(`files_list_home',`
|
|
gen_require(`
|
|
type home_root_t;
|
|
class dir r_dir_perms;
|
|
')
|
|
|
|
allow $1 home_root_t:dir r_dir_perms;
|
|
')
|
|
|
|
########################################
|
|
## <summary>
|
|
## Create, read, write, and delete objects in
|
|
## lost+found directories.
|
|
## </summary>
|
|
## <param name="domain">
|
|
## The type of the process performing this action.
|
|
## </param>
|
|
#
|
|
interface(`files_manage_lost_found',`
|
|
gen_require(`
|
|
type lost_found_t;
|
|
class dir create_dir_perms;
|
|
class file create_file_perms;
|
|
class sock_file create_file_perms;
|
|
class fifo_file create_file_perms;
|
|
class lnk_file create_lnk_perms;
|
|
')
|
|
|
|
allow $1 lost_found_t:dir create_dir_perms;
|
|
allow $1 lost_found_t:file create_file_perms;
|
|
allow $1 lost_found_t:sock_file create_file_perms;
|
|
allow $1 lost_found_t:fifo_file create_file_perms;
|
|
allow $1 lost_found_t:lnk_file create_lnk_perms;
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_search_mnt(domain)
|
|
#
|
|
interface(`files_search_mnt',`
|
|
gen_require(`
|
|
type mnt_t;
|
|
class dir search;
|
|
')
|
|
|
|
allow $1 mnt_t:dir search;
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_list_mnt(domain)
|
|
#
|
|
interface(`files_list_mnt',`
|
|
gen_require(`
|
|
type mnt_t;
|
|
class dir r_dir_perms;
|
|
')
|
|
|
|
allow $1 mnt_t:dir r_dir_perms;
|
|
')
|
|
|
|
########################################
|
|
## <summary>
|
|
## Search the tmp directory (/tmp)
|
|
## </summary>
|
|
## <param name="domain">
|
|
## The type of the process performing this action.
|
|
## </param>
|
|
#
|
|
interface(`files_search_tmp',`
|
|
gen_require(`
|
|
type tmp_t;
|
|
class dir search;
|
|
')
|
|
|
|
allow $1 tmp_t:dir search;
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_create_tmp_files(domain,private_type,[object class(es)])
|
|
#
|
|
interface(`files_create_tmp_files',`
|
|
gen_require(`
|
|
type tmp_t;
|
|
class dir rw_dir_perms;
|
|
')
|
|
|
|
allow $1 tmp_t:dir rw_dir_perms;
|
|
|
|
ifelse(`$3',`',`
|
|
type_transition $1 tmp_t:file $2;
|
|
',`
|
|
type_transition $1 tmp_t:$3 $2;
|
|
')
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_delete_all_tmp_files(domain)
|
|
#
|
|
interface(`files_delete_all_tmp_files',`
|
|
gen_require(`
|
|
attribute tmpfile;
|
|
class dir { getattr search read write add_name remove_name rmdir };
|
|
class file { getattr unlink };
|
|
class lnk_file { getattr unlink };
|
|
class fifo_file { getattr unlink };
|
|
class sock_file { getattr unlink };
|
|
')
|
|
|
|
allow $1 tmpfile:dir { getattr search read write add_name remove_name rmdir };
|
|
allow $1 tmpfile:file { getattr unlink };
|
|
allow $1 tmpfile:lnk_file { getattr unlink };
|
|
allow $1 tmpfile:fifo_file { getattr unlink };
|
|
allow $1 tmpfile:sock_file { getattr unlink };
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_search_usr(domain)
|
|
#
|
|
interface(`files_search_usr',`
|
|
gen_require(`
|
|
type usr_t;
|
|
class dir search;
|
|
')
|
|
|
|
allow $1 usr_t:dir search;
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_read_usr_files(domain)
|
|
#
|
|
interface(`files_read_usr_files',`
|
|
gen_require(`
|
|
type usr_t;
|
|
class dir r_dir_perms;
|
|
class file r_file_perms;
|
|
class lnk_file r_file_perms;
|
|
')
|
|
|
|
allow $1 usr_t:dir r_dir_perms;
|
|
allow $1 usr_t:{ file lnk_file } r_file_perms;
|
|
')
|
|
|
|
########################################
|
|
## <desc>
|
|
## Execute programs in /usr/src in the caller domain.
|
|
## </desc>
|
|
## <param name="domain">
|
|
## The type of the process performing this action.
|
|
## </param>
|
|
#
|
|
interface(`files_exec_usr_files',`
|
|
gen_require(`
|
|
type usr_t, src_t;
|
|
class dir r_dir_perms;
|
|
class lnk_file r_file_perms;
|
|
')
|
|
|
|
allow $1 usr_t:dir search;
|
|
allow $1 src_t:dir r_dir_perms;
|
|
allow $1 src_t:lnk_file r_file_perms;
|
|
can_exec($1,src_t)
|
|
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_read_usr_src_files(domain)
|
|
#
|
|
interface(`files_read_usr_src_files',`
|
|
gen_require(`
|
|
type usr_t, src_t;
|
|
class dir r_dir_perms;
|
|
class file r_file_perms;
|
|
class lnk_file r_file_perms;
|
|
')
|
|
|
|
allow $1 usr_t:dir search;
|
|
allow $1 src_t:dir r_dir_perms;
|
|
allow $1 src_t:{ file lnk_file } r_file_perms;
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_search_var(domain)
|
|
#
|
|
interface(`files_search_var',`
|
|
gen_require(`
|
|
type var_t;
|
|
class dir search;
|
|
')
|
|
|
|
allow $1 var_t:dir search;
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_dontaudit_search_var(domain)
|
|
#
|
|
interface(`files_dontaudit_search_var',`
|
|
gen_require(`
|
|
type var_t;
|
|
class dir search;
|
|
')
|
|
|
|
dontaudit $1 var_t:dir search;
|
|
')
|
|
|
|
########################################
|
|
## <summary>
|
|
## Read files in the /var directory.
|
|
## </summary>
|
|
## <param name="domain">
|
|
## The type of the process performing this action.
|
|
## </param>
|
|
#
|
|
interface(`files_read_var_files',`
|
|
gen_require(`
|
|
type var_t;
|
|
class dir search;
|
|
class file r_file_perms;
|
|
')
|
|
|
|
allow $1 var_t:dir search;
|
|
allow $1 var_t:file r_file_perms;
|
|
')
|
|
|
|
########################################
|
|
## <desc>
|
|
## Search the /var/lib directory.
|
|
## </desc>
|
|
## <param name="domain">
|
|
## The type of the process performing this action.
|
|
## </param>
|
|
#
|
|
interface(`files_search_var_lib',`
|
|
gen_require(`
|
|
type var_t, var_lib_t;
|
|
class dir search;
|
|
')
|
|
|
|
allow $1 { var_t var_lib_t }:dir search;
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_manage_urandom_seed(domain)
|
|
#
|
|
interface(`files_manage_urandom_seed',`
|
|
gen_require(`
|
|
type var_t, var_lib_t;
|
|
class dir rw_file_perms;
|
|
class file { getattr create read write setattr unlink };
|
|
')
|
|
|
|
allow $1 var_t:dir search;
|
|
allow $1 var_lib_t:dir rw_dir_perms;
|
|
allow $1 var_lib_t:file { getattr create read write setattr unlink };
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_search_generic_locks(domain)
|
|
#
|
|
interface(`files_search_generic_locks',`
|
|
gen_require(`
|
|
type var_t;
|
|
type var_lock_t;
|
|
class dir search;
|
|
')
|
|
|
|
allow $1 { var_t var_lock_t }:dir search;
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_getattr_generic_locks(domain)
|
|
#
|
|
interface(`files_getattr_generic_locks',`
|
|
gen_require(`
|
|
type var_t;
|
|
type var_lock_t;
|
|
class dir r_dir_perms;
|
|
class file getattr;
|
|
')
|
|
|
|
allow $1 var_t:dir search;
|
|
allow $1 var_lock_t:dir r_dir_perms;
|
|
allow $1 var_lock_t:file getattr;
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_manage_generic_locks(domain)
|
|
#
|
|
interface(`files_manage_generic_locks',`
|
|
gen_require(`
|
|
type var_lock_t;
|
|
class dir { getattr search create read write setattr add_name remove_name rmdir };
|
|
class file { getattr create read write setattr unlink };
|
|
')
|
|
|
|
allow $1 var_lock_t:dir { getattr search create read write setattr add_name remove_name rmdir };
|
|
allow $1 var_lock_t:file { getattr create read write setattr unlink };
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_delete_all_locks(domain)
|
|
#
|
|
interface(`files_delete_all_locks',`
|
|
gen_require(`
|
|
attribute lockfile;
|
|
class dir rw_dir_perms;
|
|
class file { getattr unlink };
|
|
')
|
|
|
|
allow $1 lockfile:dir rw_dir_perms;
|
|
allow $1 lockfile:file { getattr unlink };
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_create_lock(domain,private_type,[object class(es)])
|
|
#
|
|
interface(`files_create_lock',`
|
|
gen_require(`
|
|
type var_t, var_lock_t;
|
|
class dir rw_dir_perms;
|
|
')
|
|
|
|
allow $1 var_t:dir search;
|
|
allow $1 var_lock_t:dir rw_dir_perms;
|
|
|
|
ifelse(`$3',`',`
|
|
type_transition $1 var_lock_t:file $2;
|
|
',`
|
|
type_transition $1 var_lock_t:$3 $2;
|
|
')
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_search_pids(domain)
|
|
#
|
|
interface(`files_search_pids',`
|
|
gen_require(`
|
|
type var_t, var_run_t;
|
|
class dir search;
|
|
')
|
|
|
|
allow $1 var_t:dir search;
|
|
allow $1 var_run_t:dir search;
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_dontaudit_search_pids(domain)
|
|
#
|
|
interface(`files_dontaudit_search_pids',`
|
|
gen_require(`
|
|
type var_run_t;
|
|
class dir search;
|
|
')
|
|
|
|
allow $1 var_run_t:dir search;
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_list_pids(domain)
|
|
#
|
|
interface(`files_list_pids',`
|
|
gen_require(`
|
|
type var_t, var_run_t;
|
|
class dir r_dir_perms;
|
|
')
|
|
|
|
allow $1 var_t:dir search;
|
|
allow $1 var_run_t:dir r_dir_perms;
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_create_pid(domain,pidfile,[object class(es)])
|
|
#
|
|
interface(`files_create_pid',`
|
|
gen_require(`
|
|
type var_t, var_run_t;
|
|
class dir rw_dir_perms;
|
|
')
|
|
|
|
allow $1 var_t:dir search;
|
|
allow $1 var_run_t:dir rw_dir_perms;
|
|
|
|
ifelse(`$3',`',`
|
|
type_transition $1 var_run_t:file $2;
|
|
',`
|
|
type_transition $1 var_run_t:$3 $2;
|
|
')
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_rw_generic_pids(domain)
|
|
#
|
|
interface(`files_rw_generic_pids',`
|
|
gen_require(`
|
|
type var_t, var_run_t;
|
|
class dir r_dir_perms;
|
|
class file rw_file_perms;
|
|
')
|
|
|
|
allow $1 var_t:dir search;
|
|
allow $1 var_run_t:dir r_dir_perms;
|
|
allow $1 var_run_t:file rw_file_perms;
|
|
')
|
|
|
|
########################################
|
|
## <desc>
|
|
## Do not audit attempts to write to daemon runtime data files.
|
|
## </desc>
|
|
## <param name="domain">
|
|
## The type of the process performing this action.
|
|
## </param>
|
|
#
|
|
interface(`files_dontaudit_write_all_pids',`
|
|
gen_require(`
|
|
attribute pidfile;
|
|
class file write;
|
|
')
|
|
|
|
dontaudit $1 pidfile:file write;
|
|
')
|
|
|
|
########################################
|
|
## <desc>
|
|
## Do not audit attempts to ioctl daemon runtime data files.
|
|
## </desc>
|
|
## <param name="domain">
|
|
## The type of the process performing this action.
|
|
## </param>
|
|
#
|
|
interface(`files_dontaudit_ioctl_all_pids',`
|
|
gen_require(`
|
|
attribute pidfile;
|
|
class file ioctl;
|
|
')
|
|
|
|
dontaudit $1 pidfile:file ioctl;
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_read_all_pids(domain)
|
|
#
|
|
interface(`files_read_all_pids',`
|
|
gen_require(`
|
|
attribute pidfile;
|
|
type var_t;
|
|
class dir r_dir_perms;
|
|
class file r_file_perms;
|
|
')
|
|
|
|
allow $1 var_t:dir search;
|
|
allow $1 pidfile:dir r_dir_perms;
|
|
allow $1 pidfile:file r_file_perms;
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_delete_all_pids(domain)
|
|
#
|
|
interface(`files_delete_all_pids',`
|
|
gen_require(`
|
|
attribute pidfile;
|
|
type var_t, var_run_t;
|
|
class dir rw_dir_perms;
|
|
class file { getattr unlink };
|
|
class lnk_file { getattr unlink };
|
|
class sock_file { getattr unlink };
|
|
')
|
|
|
|
allow $1 var_t:dir search;
|
|
allow $1 var_run_t:{ sock_file lnk_file } { getattr unlink };
|
|
allow $1 var_run_t:dir rmdir;
|
|
allow $1 pidfile:dir rw_dir_perms;
|
|
allow $1 pidfile:file { getattr unlink };
|
|
allow $1 pidfile:sock_file { getattr unlink };
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_search_spool(domain)
|
|
#
|
|
interface(`files_search_spool',`
|
|
gen_require(`
|
|
type var_t, var_spool_t;
|
|
class dir search;
|
|
')
|
|
|
|
allow $1 var_t:dir search;
|
|
allow $1 var_spool_t:dir search;
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_list_spool(domain)
|
|
#
|
|
interface(`files_list_spool',`
|
|
gen_require(`
|
|
type var_t, var_spool_t;
|
|
class dir r_dir_perms;
|
|
')
|
|
|
|
allow $1 var_t:dir search;
|
|
allow $1 var_spool_t:dir r_dir_perms;
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_manage_generic_spool_dirs(domain)
|
|
#
|
|
interface(`files_manage_generic_spool_dirs',`
|
|
gen_require(`
|
|
type var_t, var_spool_t;
|
|
class dir create_dir_perms;
|
|
')
|
|
|
|
allow $1 var_t:dir search;
|
|
allow $1 var_spool_t:dir create_dir_perms;
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_read_generic_spools(domain)
|
|
#
|
|
interface(`files_read_generic_spools',`
|
|
gen_require(`
|
|
type var_t, var_spool_t;
|
|
class dir r_dir_perms;
|
|
class file r_file_perms;
|
|
')
|
|
|
|
allow $1 var_t:dir search;
|
|
allow $1 var_spool_t:dir r_dir_perms;
|
|
allow $1 var_spool_t:file r_file_perms;
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# files_manage_generic_spools(domain)
|
|
#
|
|
interface(`files_manage_generic_spools',`
|
|
gen_require(`
|
|
type var_t, var_spool_t;
|
|
class dir rw_dir_perms;
|
|
class file create_file_perms;
|
|
')
|
|
|
|
allow $1 var_t:dir search;
|
|
allow $1 var_spool_t:dir rw_dir_perms;
|
|
allow $1 var_spool_t:file create_file_perms;
|
|
')
|