|
Chris PeBenito |
1bde83 |
|
|
Chris PeBenito |
1bde83 |
policy_module(lvm,1.0)
|
|
Chris PeBenito |
1bde83 |
|
|
Chris PeBenito |
1bde83 |
########################################
|
|
Chris PeBenito |
1bde83 |
#
|
|
Chris PeBenito |
1bde83 |
# Declarations
|
|
Chris PeBenito |
1bde83 |
#
|
|
Chris PeBenito |
1bde83 |
|
|
Chris PeBenito |
1bde83 |
type lvm_t;
|
|
Chris PeBenito |
1bde83 |
type lvm_exec_t;
|
|
Chris PeBenito |
c9428d |
init_system_domain(lvm_t,lvm_exec_t)
|
|
Chris PeBenito |
1bde83 |
# needs privowner because it assigns the identity system_u to device nodes
|
|
Chris PeBenito |
1bde83 |
# but runs as the identity of the sysadmin
|
|
Chris PeBenito |
8bd678 |
domain_obj_id_change_exempt(lvm_t)
|
|
Chris PeBenito |
1bde83 |
role system_r types lvm_t;
|
|
Chris PeBenito |
1bde83 |
|
|
Chris PeBenito |
1bde83 |
type lvm_etc_t;
|
|
Chris PeBenito |
c9428d |
files_file_type(lvm_etc_t)
|
|
Chris PeBenito |
1bde83 |
|
|
Chris PeBenito |
1bde83 |
type lvm_lock_t;
|
|
Chris PeBenito |
c9428d |
files_lock_file(lvm_lock_t)
|
|
Chris PeBenito |
1bde83 |
|
|
Chris PeBenito |
daa0e0 |
type lvm_metadata_t;
|
|
Chris PeBenito |
c9428d |
files_file_type(lvm_metadata_t)
|
|
Chris PeBenito |
daa0e0 |
|
|
Chris PeBenito |
daa0e0 |
type lvm_tmp_t;
|
|
Chris PeBenito |
c9428d |
files_tmp_file(lvm_tmp_t)
|
|
Chris PeBenito |
daa0e0 |
|
|
Chris PeBenito |
1bde83 |
########################################
|
|
Chris PeBenito |
1bde83 |
#
|
|
Chris PeBenito |
1bde83 |
# Local policy
|
|
Chris PeBenito |
1bde83 |
#
|
|
Chris PeBenito |
1bde83 |
|
|
Chris PeBenito |
1bde83 |
# DAC overrides and mknod for modifying /dev entries (vgmknodes)
|
|
Chris PeBenito |
1bde83 |
allow lvm_t self:capability { dac_override ipc_lock sys_admin sys_nice mknod };
|
|
Chris PeBenito |
1bde83 |
dontaudit lvm_t self:capability sys_tty_config;
|
|
Chris PeBenito |
1bde83 |
|
|
Chris PeBenito |
1bde83 |
allow lvm_t self:process { sigchld sigkill sigstop signull signal };
|
|
Chris PeBenito |
1bde83 |
# LVM will complain a lot if it cannot set its priority.
|
|
Chris PeBenito |
1bde83 |
allow lvm_t self:process setsched;
|
|
Chris PeBenito |
1bde83 |
|
|
Chris PeBenito |
80048c |
allow lvm_t self:file r_file_perms;
|
|
Chris PeBenito |
80048c |
allow lvm_t self:fifo_file rw_file_perms;
|
|
Chris PeBenito |
80048c |
allow lvm_t self:unix_dgram_socket create_socket_perms;
|
|
Chris PeBenito |
1bde83 |
|
|
Chris PeBenito |
80048c |
allow lvm_t lvm_tmp_t:dir create_dir_perms;
|
|
Chris PeBenito |
80048c |
allow lvm_t lvm_tmp_t:file create_file_perms;
|
|
Chris PeBenito |
c9428d |
files_create_tmp_files(lvm_t, lvm_tmp_t, { file dir })
|
|
Chris PeBenito |
1bde83 |
|
|
Chris PeBenito |
1bde83 |
# /lib/lvm-<version> holds the actual LVM binaries (and symlinks)
|
|
Chris PeBenito |
1bde83 |
allow lvm_t lvm_exec_t:dir search;
|
|
Chris PeBenito |
80048c |
allow lvm_t lvm_exec_t:{ file lnk_file } r_file_perms;
|
|
Chris PeBenito |
1bde83 |
|
|
Chris PeBenito |
1bde83 |
# LVM is split into many individual binaries
|
|
Chris PeBenito |
80048c |
can_exec(lvm_t, lvm_exec_t)
|
|
Chris PeBenito |
1bde83 |
|
|
Chris PeBenito |
1bde83 |
# Creating lock files
|
|
Chris PeBenito |
0fd9dc |
allow lvm_t lvm_lock_t:dir rw_dir_perms;
|
|
Chris PeBenito |
80048c |
allow lvm_t lvm_lock_t:file create_file_perms;
|
|
Chris PeBenito |
c9428d |
files_create_lock_file(lvm_t,lvm_lock_t)
|
|
Chris PeBenito |
1bde83 |
|
|
Chris PeBenito |
80048c |
allow lvm_t lvm_etc_t:file r_file_perms;
|
|
Chris PeBenito |
80048c |
allow lvm_t lvm_etc_t:lnk_file r_file_perms;
|
|
Chris PeBenito |
1bde83 |
# Write to /etc/lvm, /etc/lvmtab, /etc/lvmtab.d
|
|
Chris PeBenito |
80048c |
allow lvm_t lvm_etc_t:dir rw_dir_perms;
|
|
Chris PeBenito |
80048c |
allow lvm_t lvm_metadata_t:file create_file_perms;
|
|
Chris PeBenito |
80048c |
allow lvm_t lvm_metadata_t:dir rw_dir_perms;
|
|
Chris PeBenito |
1bde83 |
type_transition lvm_t lvm_etc_t:file lvm_metadata_t;
|
|
Chris PeBenito |
c9428d |
files_create_etc_config(lvm_t,lvm_metadata_t,file)
|
|
Chris PeBenito |
1bde83 |
|
|
Chris PeBenito |
1bde83 |
kernel_read_system_state(lvm_t)
|
|
Chris PeBenito |
d35c62 |
kernel_read_kernel_sysctl(lvm_t)
|
|
Chris PeBenito |
d35c62 |
# Read system variables in /proc/sys
|
|
Chris PeBenito |
d35c62 |
kernel_read_kernel_sysctl(lvm_t)
|
|
Chris PeBenito |
d35c62 |
# it has no reason to need this
|
|
Chris PeBenito |
d35c62 |
kernel_dontaudit_getattr_core(lvm_t)
|
|
Chris PeBenito |
d35c62 |
|
|
Chris PeBenito |
5e0da6 |
selinux_get_fs_mount(lvm_t)
|
|
Chris PeBenito |
5e0da6 |
selinux_validate_context(lvm_t)
|
|
Chris PeBenito |
5e0da6 |
selinux_compute_access_vector(lvm_t)
|
|
Chris PeBenito |
5e0da6 |
selinux_compute_create_context(lvm_t)
|
|
Chris PeBenito |
5e0da6 |
selinux_compute_relabel_context(lvm_t)
|
|
Chris PeBenito |
5e0da6 |
selinux_compute_user_contexts(lvm_t)
|
|
Chris PeBenito |
1bde83 |
|
|
Karl MacMillan |
f0c985 |
dev_create_generic_chr_file(lvm_t)
|
|
Karl MacMillan |
f0c985 |
dev_read_rand(lvm_t)
|
|
Karl MacMillan |
f0c985 |
dev_read_urand(lvm_t)
|
|
Karl MacMillan |
f0c985 |
dev_rw_lvm_control(lvm_t)
|
|
Karl MacMillan |
f0c985 |
dev_manage_generic_symlinks(lvm_t)
|
|
Chris PeBenito |
c9428d |
dev_relabel_dev_dirs(lvm_t)
|
|
Chris PeBenito |
c9428d |
dev_manage_generic_blk_file(lvm_t)
|
|
Chris PeBenito |
d35c62 |
dev_read_sysfs(lvm_t)
|
|
Chris PeBenito |
d35c62 |
# Read /sys/block. Device mapper metadata is kept there.
|
|
Chris PeBenito |
d35c62 |
dev_read_sysfs(sysfs_t)
|
|
Chris PeBenito |
783b38 |
# cjp: this has no effect since LVM does not
|
|
Chris PeBenito |
783b38 |
# have lnk_file relabelto for anything else.
|
|
Chris PeBenito |
783b38 |
# perhaps this should be blk_files?
|
|
Chris PeBenito |
783b38 |
dev_relabel_generic_symlinks(lvm_t)
|
|
Chris PeBenito |
1bde83 |
# LVM (vgscan) scans for devices by stating every file in /dev and applying a regex...
|
|
Karl MacMillan |
f0c985 |
dev_dontaudit_getattr_all_chr_files(lvm_t)
|
|
Karl MacMillan |
f0c985 |
dev_dontaudit_getattr_all_blk_files(lvm_t)
|
|
Karl MacMillan |
f0c985 |
dev_dontaudit_getattr_generic_chr_file(lvm_t)
|
|
Karl MacMillan |
f0c985 |
dev_dontaudit_getattr_generic_blk_file(lvm_t)
|
|
Karl MacMillan |
f0c985 |
dev_dontaudit_getattr_generic_pipe(lvm_t)
|
|
Chris PeBenito |
1bde83 |
|
|
Chris PeBenito |
0fd9dc |
fs_getattr_xattr_fs(lvm_t)
|
|
Chris PeBenito |
ab940a |
fs_search_auto_mountpoints(lvm_t)
|
|
Chris PeBenito |
1bde83 |
|
|
Chris PeBenito |
783b38 |
storage_relabel_fixed_disk(lvm_t)
|
|
Chris PeBenito |
f5c42b |
# LVM creates block devices in /dev/mapper or /dev/<vg>
|
|
Chris PeBenito |
f5c42b |
# depending on its version
|
|
Chris PeBenito |
f5c42b |
# LVM(2) needs to create directores (/dev/mapper, /dev/<vg>)
|
|
Chris PeBenito |
f5c42b |
# and links from /dev/<vg> to /dev/mapper/<vg>-<lv>
|
|
Chris PeBenito |
f5c42b |
storage_create_fixed_disk_dev_entry(lvm_t)
|
|
Chris PeBenito |
f5c42b |
# Access raw devices and old /dev/lvm (c 109,0). Is this needed?
|
|
Chris PeBenito |
f5c42b |
storage_manage_fixed_disk(lvm_t)
|
|
Chris PeBenito |
f5c42b |
|
|
Chris PeBenito |
783b38 |
term_dontaudit_getattr_all_user_ttys(lvm_t)
|
|
Chris PeBenito |
783b38 |
|
|
Chris PeBenito |
c9428d |
corecmd_search_sbin(lvm_t)
|
|
Chris PeBenito |
c9428d |
corecmd_dontaudit_getattr_sbin_file(lvm_t)
|
|
Chris PeBenito |
1bde83 |
|
|
Chris PeBenito |
c9428d |
domain_use_wide_inherit_fd(lvm_t)
|
|
Chris PeBenito |
1bde83 |
|
|
Chris PeBenito |
c9428d |
files_search_var(lvm_t)
|
|
Chris PeBenito |
c9428d |
files_read_generic_etc_files(lvm_t)
|
|
Chris PeBenito |
c9428d |
files_read_etc_runtime_files(lvm_t)
|
|
Chris PeBenito |
3b857e |
# for when /usr is not mounted:
|
|
Chris PeBenito |
c9428d |
files_dontaudit_search_isid_type_dir(lvm_t)
|
|
Chris PeBenito |
1bde83 |
|
|
Chris PeBenito |
c9428d |
init_use_fd(lvm_t)
|
|
Chris PeBenito |
c9428d |
init_dontaudit_getattr_initctl(lvm_t)
|
|
Chris PeBenito |
c9428d |
init_use_script_pty(lvm_t)
|
|
Chris PeBenito |
1bde83 |
|
|
Chris PeBenito |
c9428d |
libs_use_ld_so(lvm_t)
|
|
Chris PeBenito |
c9428d |
libs_use_shared_libs(lvm_t)
|
|
Chris PeBenito |
1bde83 |
|
|
Chris PeBenito |
c9428d |
logging_send_syslog_msg(lvm_t)
|
|
Chris PeBenito |
1bde83 |
|
|
Chris PeBenito |
1bde83 |
miscfiles_read_localization(lvm_t)
|
|
Chris PeBenito |
1bde83 |
|
|
Chris PeBenito |
5e0da6 |
seutil_read_config(lvm_t)
|
|
Chris PeBenito |
5e0da6 |
seutil_read_file_contexts(lvm_t)
|
|
Chris PeBenito |
5e0da6 |
seutil_newrole_sigchld(lvm_t)
|
|
Chris PeBenito |
1bde83 |
|
|
Chris PeBenito |
254bbc |
ifdef(`distro_redhat',`
|
|
Chris PeBenito |
129318 |
# this is from the initrd:
|
|
Chris PeBenito |
c9428d |
files_rw_isid_type_dir(lvm_t)
|
|
Chris PeBenito |
129318 |
')
|
|
Chris PeBenito |
129318 |
|
|
Chris PeBenito |
254bbc |
ifdef(`targeted_policy', `
|
|
Chris PeBenito |
0fd9dc |
term_dontaudit_use_unallocated_tty(lvm_t)
|
|
Chris PeBenito |
31908b |
term_dontaudit_use_generic_pty(lvm_t)
|
|
Chris PeBenito |
d115b2 |
|
|
Chris PeBenito |
c9428d |
files_dontaudit_read_root_file(lvm_t)
|
|
Chris PeBenito |
d115b2 |
')
|
|
Chris PeBenito |
1bde83 |
|
|
Chris PeBenito |
1bde83 |
optional_policy(`bootloader.te',`
|
|
Chris PeBenito |
0fd9dc |
bootloader_rw_tmp_file(lvm_t)
|
|
Chris PeBenito |
1bde83 |
')
|
|
Chris PeBenito |
1bde83 |
|
|
Chris PeBenito |
1bde83 |
optional_policy(`udev.te', `
|
|
Chris PeBenito |
c9428d |
udev_read_db(lvm_t)
|
|
Chris PeBenito |
1bde83 |
')
|
|
Chris PeBenito |
1bde83 |
|
|
Chris PeBenito |
1bde83 |
ifdef(`TODO',`
|
|
Chris PeBenito |
1bde83 |
allow lvm_t default_context_t:dir search;
|
|
Chris PeBenito |
1bde83 |
|
|
Chris PeBenito |
1bde83 |
dontaudit lvm_t var_run_t:dir getattr;
|
|
Chris PeBenito |
1bde83 |
|
|
Chris PeBenito |
1bde83 |
optional_policy(`gnome-pty-helper.te', `
|
|
Chris PeBenito |
0c73cd |
allow lvm_t sysadm_gph_t:fd use;
|
|
Chris PeBenito |
1bde83 |
')
|
|
Chris PeBenito |
1bde83 |
|
|
Chris PeBenito |
1bde83 |
optional_policy(`gpm.te', `
|
|
Chris PeBenito |
0c73cd |
dontaudit lvm_t gpmctl_t:sock_file getattr;
|
|
Chris PeBenito |
1bde83 |
')
|
|
Chris PeBenito |
1bde83 |
|
|
Chris PeBenito |
783b38 |
optional_policy(`rhgb.te',`
|
|
Chris PeBenito |
783b38 |
rhgb_domain(lvm_t)
|
|
Chris PeBenito |
1bde83 |
')
|
|
Chris PeBenito |
1bde83 |
|
|
Chris PeBenito |
1bde83 |
') dnl end TODO
|