Oreon-Lime-R2/selinux-policy/selinux-policy-d9f4a2b/selinux-policy-d9f4a2bbeb91fd95d0c35a90936efb9ea99d2455/policy/support/file_patterns.spt

630 lines
14 KiB
Cheetah
Raw Permalink Normal View History

#
# Directory patterns (dir)
#
# Parameters:
# 1. domain type
# 2. container (directory) type
# 3. directory type
#
define(`getattr_dirs_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:dir getattr_dir_perms;
')
define(`setattr_dirs_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:dir setattr_dir_perms;
')
define(`search_dirs_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:dir search_dir_perms;
')
define(`list_dirs_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:dir list_dir_perms;
')
define(`add_entry_dirs_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:dir add_entry_dir_perms;
')
define(`del_entry_dirs_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:dir del_entry_dir_perms;
')
define(`rw_dirs_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:dir { add_entry_dir_perms del_entry_dir_perms };
')
define(`create_dirs_pattern',`
allow $1 $2:dir add_entry_dir_perms;
allow $1 $3:dir create_dir_perms;
')
define(`delete_dirs_pattern',`
allow $1 $2:dir del_entry_dir_perms;
allow $1 $3:dir delete_dir_perms;
')
define(`rename_dirs_pattern',`
allow $1 $2:dir rw_dir_perms;
allow $1 $3:dir rename_dir_perms;
')
define(`manage_dirs_pattern',`
allow $1 $2:dir rw_dir_perms;
allow $1 $3:dir manage_dir_perms;
')
define(`relabelfrom_dirs_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:dir relabelfrom_dir_perms;
')
define(`relabelto_dirs_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:dir relabelto_dir_perms;
')
define(`relabel_dirs_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:dir relabel_dir_perms;
')
define(`watch_dirs_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:dir watch_dir_perms;
')
define(`watch_mount_dirs_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:dir watch_mount_dir_perms;
')
define(`watch_reads_dirs_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:dir watch_reads_dir_perms;
')
define(`watch_sb_dirs_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:dir watch_sb_dir_perms;
')
define(`watch_with_perm_dirs_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:dir watch_with_perm_dir_perms;
')
#
# Regular file patterns (file)
#
# Parameters:
# 1. domain type
# 2. container (directory) type
# 3. file type
#
define(`getattr_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:file getattr_file_perms;
')
define(`setattr_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:file setattr_file_perms;
')
define(`read_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:file read_file_perms;
')
define(`mmap_read_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:file mmap_read_file_perms;
')
define(`mmap_files_pattern',`
# deprecated 20171213
refpolicywarn(`mmap_files_pattern() is deprecated, please use mmap_exec_files_pattern() instead')
allow $1 $2:dir search_dir_perms;
allow $1 $3:file mmap_exec_file_perms;
')
define(`mmap_exec_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:file mmap_exec_file_perms;
')
define(`exec_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:file exec_file_perms;
')
define(`append_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:file append_file_perms;
')
define(`write_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:file write_file_perms;
')
define(`rw_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:file rw_file_perms;
')
define(`mmap_rw_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:file mmap_rw_file_perms;
')
define(`create_files_pattern',`
allow $1 $2:dir add_entry_dir_perms;
allow $1 $3:file create_file_perms;
')
define(`delete_files_pattern',`
allow $1 $2:dir del_entry_dir_perms;
allow $1 $3:file delete_file_perms;
')
define(`rename_files_pattern',`
allow $1 $2:dir rw_dir_perms;
allow $1 $3:file rename_file_perms;
')
define(`manage_files_pattern',`
allow $1 $2:dir rw_dir_perms;
allow $1 $3:file manage_file_perms;
')
define(`relabelfrom_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:file relabelfrom_file_perms;
')
define(`relabelto_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:file relabelto_file_perms;
')
define(`relabel_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:file relabel_file_perms;
')
define(`watch_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:file watch_file_perms;
')
#
# Symbolic link patterns (lnk_file)
#
# Parameters:
# 1. domain type
# 2. container (directory) type
# 3. file type
#
define(`getattr_lnk_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:lnk_file getattr_lnk_file_perms;
')
define(`setattr_lnk_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:lnk_file setattr_lnk_file_perms;
')
define(`read_lnk_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:lnk_file read_lnk_file_perms;
')
define(`append_lnk_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:lnk_file append_lnk_file_perms;
')
define(`write_lnk_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:lnk_file write_lnk_file_perms;
')
define(`rw_lnk_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:lnk_file rw_lnk_file_perms;
')
define(`create_lnk_files_pattern',`
allow $1 $2:dir add_entry_dir_perms;
allow $1 $3:lnk_file create_lnk_file_perms;
')
define(`delete_lnk_files_pattern',`
allow $1 $2:dir del_entry_dir_perms;
allow $1 $3:lnk_file delete_lnk_file_perms;
')
define(`rename_lnk_files_pattern',`
allow $1 $2:dir rw_dir_perms;
allow $1 $3:lnk_file rename_lnk_file_perms;
')
define(`manage_lnk_files_pattern',`
allow $1 $2:dir rw_dir_perms;
allow $1 $3:lnk_file manage_lnk_file_perms;
')
define(`relabelfrom_lnk_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:lnk_file relabelfrom_lnk_file_perms;
')
define(`relabelto_lnk_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:lnk_file relabelto_lnk_file_perms;
')
define(`relabel_lnk_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:lnk_file relabel_lnk_file_perms;
')
define(`watch_lnk_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:lnk_file watch_lnk_file_perms;
')
#
# (Un)named Pipes/FIFO patterns (fifo_file)
#
# Parameters:
# 1. domain type
# 2. container (directory) type
# 3. file type
#
define(`getattr_fifo_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:fifo_file getattr_fifo_file_perms;
')
define(`setattr_fifo_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:fifo_file setattr_fifo_file_perms;
')
define(`read_fifo_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:fifo_file read_fifo_file_perms;
')
define(`append_fifo_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:fifo_file append_fifo_file_perms;
')
define(`write_fifo_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:fifo_file write_fifo_file_perms;
')
define(`rw_fifo_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:fifo_file rw_fifo_file_perms;
')
define(`create_fifo_files_pattern',`
allow $1 $2:dir add_entry_dir_perms;
allow $1 $3:fifo_file create_fifo_file_perms;
')
define(`delete_fifo_files_pattern',`
allow $1 $2:dir del_entry_dir_perms;
allow $1 $3:fifo_file delete_fifo_file_perms;
')
define(`rename_fifo_files_pattern',`
allow $1 $2:dir rw_dir_perms;
allow $1 $3:fifo_file rename_fifo_file_perms;
')
define(`manage_fifo_files_pattern',`
allow $1 $2:dir rw_dir_perms;
allow $1 $3:fifo_file manage_fifo_file_perms;
')
define(`relabelfrom_fifo_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:fifo_file relabelfrom_fifo_file_perms;
')
define(`relabelto_fifo_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:fifo_file relabelto_fifo_file_perms;
')
define(`relabel_fifo_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:fifo_file relabel_fifo_file_perms;
')
define(`watch_fifo_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:fifo_file watch_fifo_file_perms;
')
#
# (Un)named sockets patterns (sock_file)
#
# Parameters:
# 1. domain type
# 2. container (directory) type
# 3. file type
#
define(`getattr_sock_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:sock_file getattr_sock_file_perms;
')
define(`setattr_sock_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:sock_file setattr_sock_file_perms;
')
define(`read_sock_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:sock_file read_sock_file_perms;
')
define(`write_sock_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:sock_file write_sock_file_perms;
')
define(`rw_sock_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:sock_file rw_sock_file_perms;
')
define(`create_sock_files_pattern',`
allow $1 $2:dir add_entry_dir_perms;
allow $1 $3:sock_file create_sock_file_perms;
')
define(`delete_sock_files_pattern',`
allow $1 $2:dir del_entry_dir_perms;
allow $1 $3:sock_file delete_sock_file_perms;
')
define(`rename_sock_files_pattern',`
allow $1 $2:dir rw_dir_perms;
allow $1 $3:sock_file rename_sock_file_perms;
')
define(`manage_sock_files_pattern',`
allow $1 $2:dir rw_dir_perms;
allow $1 $3:sock_file manage_sock_file_perms;
')
define(`relabelfrom_sock_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:sock_file relabelfrom_sock_file_perms;
')
define(`relabelto_sock_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:sock_file relabelto_sock_file_perms;
')
define(`relabel_sock_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:sock_file relabel_sock_file_perms;
')
define(`watch_sock_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:sock_file watch_sock_file_perms;
')
#
# Block device node patterns (blk_file)
#
# Parameters:
# 1. domain type
# 2. container (directory) type
# 3. file type
#
define(`getattr_blk_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:blk_file getattr_blk_file_perms;
')
define(`setattr_blk_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:blk_file setattr_blk_file_perms;
')
define(`lock_blk_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:blk_file lock_blk_file_perms;
')
define(`read_blk_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:blk_file read_blk_file_perms;
')
define(`append_blk_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:blk_file append_blk_file_perms;
')
define(`write_blk_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:blk_file write_blk_file_perms;
')
define(`rw_blk_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:blk_file rw_blk_file_perms;
')
define(`create_blk_files_pattern',`
allow $1 self:capability mknod;
allow $1 $2:dir add_entry_dir_perms;
allow $1 $3:blk_file create_blk_file_perms;
')
define(`delete_blk_files_pattern',`
allow $1 $2:dir del_entry_dir_perms;
allow $1 $3:blk_file delete_blk_file_perms;
')
define(`rename_blk_files_pattern',`
allow $1 $2:dir rw_dir_perms;
allow $1 $3:blk_file rename_blk_file_perms;
')
define(`manage_blk_files_pattern',`
allow $1 self:capability mknod;
allow $1 $2:dir rw_dir_perms;
allow $1 $3:blk_file manage_blk_file_perms;
')
define(`relabelfrom_blk_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:blk_file relabelfrom_blk_file_perms;
')
define(`relabelto_blk_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:blk_file relabelto_blk_file_perms;
')
define(`relabel_blk_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:blk_file relabel_blk_file_perms;
')
define(`watch_blk_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:blk_file watch_blk_file_perms;
')
#
# Character device node patterns (chr_file)
#
# Parameters:
# 1. domain type
# 2. container (directory) type
# 3. file type
#
define(`getattr_chr_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:chr_file getattr_chr_file_perms;
')
define(`setattr_chr_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:chr_file setattr_chr_file_perms;
')
define(`read_chr_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:chr_file read_chr_file_perms;
')
define(`append_chr_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:chr_file append_chr_file_perms;
')
define(`write_chr_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:chr_file write_chr_file_perms;
')
define(`rw_chr_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:chr_file rw_chr_file_perms;
')
define(`create_chr_files_pattern',`
allow $1 self:capability mknod;
allow $1 $2:dir add_entry_dir_perms;
allow $1 $3:chr_file create_chr_file_perms;
')
define(`delete_chr_files_pattern',`
allow $1 $2:dir del_entry_dir_perms;
allow $1 $3:chr_file delete_chr_file_perms;
')
define(`rename_chr_files_pattern',`
allow $1 $2:dir rw_dir_perms;
allow $1 $3:chr_file rename_chr_file_perms;
')
define(`manage_chr_files_pattern',`
allow $1 self:capability mknod;
allow $1 $2:dir rw_dir_perms;
allow $1 $3:chr_file manage_chr_file_perms;
')
define(`relabelfrom_chr_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:chr_file relabelfrom_chr_file_perms;
')
define(`relabelto_chr_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:chr_file relabelto_chr_file_perms;
')
define(`relabel_chr_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:chr_file relabel_chr_file_perms;
')
define(`watch_chr_files_pattern',`
allow $1 $2:dir search_dir_perms;
allow $1 $3:chr_file watch_chr_file_perms;
')
#
# File type_transition patterns
#
# filetrans_add_pattern(domain,dirtype,newtype,class(es),[filename])
#
define(`filetrans_add_pattern',`
allow $1 $2:dir { list_dir_perms add_entry_dir_perms };
type_transition $1 $2:$4 $3 $5;
')
#
# filetrans_pattern(domain,dirtype,newtype,class(es),[filename])
#
define(`filetrans_pattern',`
allow $1 $2:dir rw_dir_perms;
type_transition $1 $2:$4 $3 $5;
')
define(`admin_pattern',`
manage_dirs_pattern($1,$2,$2)
manage_files_pattern($1,$2,$2)
manage_lnk_files_pattern($1,$2,$2)
manage_fifo_files_pattern($1,$2,$2)
manage_sock_files_pattern($1,$2,$2)
relabel_dirs_pattern($1,$2,$2)
relabel_files_pattern($1,$2,$2)
relabel_lnk_files_pattern($1,$2,$2)
relabel_fifo_files_pattern($1,$2,$2)
relabel_sock_files_pattern($1,$2,$2)
')