selinux-refpolicy/policy/modules/system/lvm.te

270 lines
7.4 KiB
Plaintext
Raw Normal View History

policy_module(lvm, 1.26.2)
2005-05-13 14:36:35 +00:00
########################################
#
# Declarations
#
type lvm_t;
type lvm_exec_t;
2009-05-06 14:44:57 +00:00
init_system_domain(lvm_t, lvm_exec_t)
init_named_socket_activation(lvm_t, lvm_runtime_t)
2005-05-13 14:36:35 +00:00
# needs privowner because it assigns the identity system_u to device nodes
# but runs as the identity of the sysadmin
2006-02-02 21:08:12 +00:00
domain_obj_id_change_exemption(lvm_t)
2005-05-13 14:36:35 +00:00
role system_r types lvm_t;
type lvm_etc_t;
files_type(lvm_etc_t)
2005-05-13 14:36:35 +00:00
type lvm_lock_t;
2005-06-13 17:35:46 +00:00
files_lock_file(lvm_lock_t)
optional_policy(`
systemd_tmpfilesd_managed(lvm_lock_t, dir)
')
2005-05-13 14:36:35 +00:00
type lvm_metadata_t;
files_type(lvm_metadata_t)
type lvm_runtime_t alias lvm_var_run_t;
files_runtime_file(lvm_runtime_t)
2005-09-19 21:17:45 +00:00
type lvm_unit_t;
init_unit_file(lvm_unit_t)
type lvm_tmp_t;
2005-06-13 17:35:46 +00:00
files_tmp_file(lvm_tmp_t)
type lvm_tmpfs_t;
files_tmpfs_file(lvm_tmpfs_t)
type lvm_var_lib_t;
files_type(lvm_var_lib_t)
2005-09-16 19:36:10 +00:00
########################################
#
# LVM Local policy
2005-05-13 14:36:35 +00:00
#
# DAC overrides and mknod for modifying /dev entries (vgmknodes)
# rawio needed for dmraid
2009-05-06 14:26:20 +00:00
# net_admin for multipath
allow lvm_t self:capability { chown dac_override fowner ipc_lock mknod net_admin sys_admin sys_nice sys_rawio sys_resource };
2005-05-13 14:36:35 +00:00
dontaudit lvm_t self:capability sys_tty_config;
allow lvm_t self:process { sigchld sigkill sigstop signull signal setfscreate };
2005-05-13 14:36:35 +00:00
# LVM will complain a lot if it cannot set its priority.
allow lvm_t self:process setsched;
2005-09-13 13:06:07 +00:00
allow lvm_t self:file rw_file_perms;
2009-11-24 14:19:45 +00:00
allow lvm_t self:fifo_file manage_fifo_file_perms;
2005-06-09 14:26:05 +00:00
allow lvm_t self:unix_dgram_socket create_socket_perms;
allow lvm_t self:netlink_kobject_uevent_socket create_socket_perms;
allow lvm_t self:sem create_sem_perms;
# gt: the following is for sockets in the AF_ALG namespace (userspace interface to the kernel Crypto API)
allow lvm_t self:socket create_stream_socket_perms;
# gt: the following allows opening cryptsetup devices
allow lvm_t self:key { search write };
2005-05-13 14:36:35 +00:00
2009-05-06 14:26:20 +00:00
allow lvm_t self:unix_stream_socket { connectto create_stream_socket_perms };
2009-05-06 14:44:57 +00:00
manage_dirs_pattern(lvm_t, lvm_tmp_t, lvm_tmp_t)
manage_files_pattern(lvm_t, lvm_tmp_t, lvm_tmp_t)
2006-02-21 18:40:44 +00:00
files_tmp_filetrans(lvm_t, lvm_tmp_t, { file dir })
2005-05-13 14:36:35 +00:00
manage_dirs_pattern(lvm_t, lvm_tmpfs_t, lvm_tmpfs_t)
manage_files_pattern(lvm_t, lvm_tmpfs_t, lvm_tmpfs_t)
fs_tmpfs_filetrans(lvm_t, lvm_tmpfs_t, { dir file })
2005-05-13 14:36:35 +00:00
# /lib/lvm-<version> holds the actual LVM binaries (and symlinks)
2009-05-06 14:44:57 +00:00
read_files_pattern(lvm_t, lvm_exec_t, lvm_exec_t)
read_lnk_files_pattern(lvm_t, lvm_exec_t, lvm_exec_t)
2005-05-13 14:36:35 +00:00
# LVM is split into many individual binaries
2005-06-09 14:26:05 +00:00
can_exec(lvm_t, lvm_exec_t)
2005-05-13 14:36:35 +00:00
# Creating lock files
2009-05-06 14:44:57 +00:00
manage_files_pattern(lvm_t, lvm_lock_t, lvm_lock_t)
create_dirs_pattern(lvm_t, lvm_lock_t, lvm_lock_t)
2009-05-06 14:44:57 +00:00
files_lock_filetrans(lvm_t, lvm_lock_t, file)
files_lock_filetrans(lvm_t, lvm_lock_t, dir, "lvm")
2005-05-13 14:36:35 +00:00
2009-05-06 14:44:57 +00:00
manage_dirs_pattern(lvm_t, lvm_var_lib_t, lvm_var_lib_t)
manage_files_pattern(lvm_t, lvm_var_lib_t, lvm_var_lib_t)
2009-11-24 16:11:38 +00:00
files_var_lib_filetrans(lvm_t, lvm_var_lib_t, { dir file })
manage_dirs_pattern(lvm_t, lvm_runtime_t, lvm_runtime_t)
manage_files_pattern(lvm_t, lvm_runtime_t, lvm_runtime_t)
manage_sock_files_pattern(lvm_t, lvm_runtime_t, lvm_runtime_t)
files_runtime_filetrans(lvm_t, lvm_runtime_t, { file sock_file })
2005-09-19 21:17:45 +00:00
2009-05-06 14:44:57 +00:00
read_files_pattern(lvm_t, lvm_etc_t, lvm_etc_t)
2018-02-15 22:10:34 +00:00
allow lvm_t lvm_etc_t:file map;
2009-05-06 14:44:57 +00:00
read_lnk_files_pattern(lvm_t, lvm_etc_t, lvm_etc_t)
# create /etc/lvm/archive
allow lvm_t lvm_etc_t:dir create_dir_perms;
2019-01-03 07:15:07 +00:00
# Map for vgchange on /etc/lvm/backup/ files
allow lvm_t lvm_metadata_t:file map;
2019-01-03 07:15:07 +00:00
# Write to /etc/lvm, /etc/lvmtab, /etc/lvmtab.d
2009-05-06 14:44:57 +00:00
manage_files_pattern(lvm_t, lvm_metadata_t, lvm_metadata_t)
filetrans_pattern(lvm_t, lvm_etc_t, lvm_metadata_t, file)
files_etc_filetrans(lvm_t, lvm_metadata_t, file)
2009-05-06 14:26:20 +00:00
files_search_mnt(lvm_t)
2005-05-13 14:36:35 +00:00
kernel_request_load_module(lvm_t)
kernel_get_sysvipc_info(lvm_t)
2005-05-13 14:36:35 +00:00
kernel_read_system_state(lvm_t)
# Read system variables in /proc/sys
kernel_read_kernel_sysctls(lvm_t)
# for when /usr is not mounted:
kernel_dontaudit_search_unlabeled(lvm_t)
# it has no reason to need this
kernel_dontaudit_getattr_core_if(lvm_t)
2009-05-06 14:26:20 +00:00
kernel_use_fds(lvm_t)
# for systemd-cryptsetup
kernel_read_crypto_sysctls(lvm_t)
2009-11-24 14:19:45 +00:00
kernel_search_debugfs(lvm_t)
corecmd_exec_bin(lvm_t)
corecmd_exec_shell(lvm_t)
2005-05-13 14:36:35 +00:00
dev_create_generic_chr_files(lvm_t)
dev_delete_generic_dirs(lvm_t)
2005-06-13 16:22:32 +00:00
dev_read_rand(lvm_t)
dev_read_urand(lvm_t)
dev_rw_lvm_control(lvm_t)
dev_manage_generic_symlinks(lvm_t)
dev_relabel_generic_dev_dirs(lvm_t)
dev_manage_generic_blk_files(lvm_t)
# Read /sys/block. Device mapper metadata is kept there.
# Write read_ahead_kb
dev_rw_sysfs(lvm_t)
2005-06-28 17:32:57 +00:00
# cjp: this has no effect since LVM does not
# have lnk_file relabelto for anything else.
# perhaps this should be blk_files?
dev_relabel_generic_symlinks(lvm_t)
2005-05-13 14:36:35 +00:00
# LVM (vgscan) scans for devices by stating every file in /dev and applying a regex...
2005-09-16 21:20:37 +00:00
dev_dontaudit_read_all_chr_files(lvm_t)
dev_dontaudit_read_all_blk_files(lvm_t)
dev_dontaudit_getattr_generic_chr_files(lvm_t)
dev_dontaudit_getattr_generic_blk_files(lvm_t)
dev_dontaudit_getattr_generic_pipes(lvm_t)
dev_create_generic_dirs(lvm_t)
# the following one is needed by cryptsetup
dev_getattr_fs(lvm_t)
# for systemd-cryptsetup
dev_write_kmsg(lvm_t)
2005-05-13 14:36:35 +00:00
domain_use_interactive_fds(lvm_t)
domain_read_all_domains_state(lvm_t)
files_read_usr_files(lvm_t)
files_read_etc_files(lvm_t)
files_read_etc_runtime_files(lvm_t)
2005-06-10 01:01:13 +00:00
fs_getattr_xattr_fs(lvm_t)
2005-06-27 16:30:55 +00:00
fs_search_auto_mountpoints(lvm_t)
fs_list_tmpfs(lvm_t)
2006-01-25 15:53:35 +00:00
fs_read_tmpfs_symlinks(lvm_t)
fs_dontaudit_read_removable_files(lvm_t)
fs_dontaudit_getattr_tmpfs_files(lvm_t)
2009-11-24 14:19:45 +00:00
fs_rw_anon_inodefs_files(lvm_t)
fs_mmap_rw_all_image_files(lvm_t)
2009-11-24 14:19:45 +00:00
mls_file_read_all_levels(lvm_t)
mls_file_write_to_clearance(lvm_t)
2005-05-13 14:36:35 +00:00
selinux_get_fs_mount(lvm_t)
selinux_validate_context(lvm_t)
selinux_compute_access_vector(lvm_t)
selinux_compute_create_context(lvm_t)
selinux_compute_relabel_context(lvm_t)
selinux_compute_user_contexts(lvm_t)
2005-06-28 17:32:57 +00:00
storage_relabel_fixed_disk(lvm_t)
storage_dontaudit_read_removable_device(lvm_t)
2005-05-30 21:17:20 +00:00
# LVM creates block devices in /dev/mapper or /dev/<vg>
# depending on its version
# LVM(2) needs to create directories (/dev/mapper, /dev/<vg>)
2005-05-30 21:17:20 +00:00
# and links from /dev/<vg> to /dev/mapper/<vg>-<lv>
# cjp: needs to create an interface here for fixed disk create
storage_dev_filetrans_fixed_disk(lvm_t)
2005-05-30 21:17:20 +00:00
# Access raw devices and old /dev/lvm (c 109,0). Is this needed?
storage_manage_fixed_disk(lvm_t)
2009-11-24 14:19:45 +00:00
term_use_all_terms(lvm_t)
init_use_fds(lvm_t)
2005-06-13 17:35:46 +00:00
init_dontaudit_getattr_initctl(lvm_t)
2006-02-02 21:08:12 +00:00
init_use_script_ptys(lvm_t)
2009-11-24 14:19:45 +00:00
init_read_script_state(lvm_t)
init_read_script_tmp_files(lvm_t)
# for systemd-cryptsetup to talk to /run/systemd/journal/socket
init_stream_connect(lvm_t)
2005-05-13 14:36:35 +00:00
2005-06-13 17:35:46 +00:00
logging_send_syslog_msg(lvm_t)
2005-05-13 14:36:35 +00:00
miscfiles_read_localization(lvm_t)
seutil_read_config(lvm_t)
seutil_read_file_contexts(lvm_t)
2005-06-29 20:53:53 +00:00
seutil_search_default_contexts(lvm_t)
seutil_sigchld_newrole(lvm_t)
2005-05-13 14:36:35 +00:00
userdom_use_inherited_user_terminals(lvm_t)
2008-11-05 16:10:46 +00:00
ifdef(`init_systemd',`
init_rw_stream_sockets(lvm_t)
fs_manage_hugetlbfs_dirs(lvm_t)
')
ifdef(`distro_redhat',`
2005-06-01 13:51:54 +00:00
# this is from the initrd:
kernel_rw_unlabeled_dirs(lvm_t)
2009-05-06 14:26:20 +00:00
optional_policy(`
unconfined_domain(lvm_t)
')
2005-06-01 13:51:54 +00:00
')
optional_policy(`
2006-02-02 21:08:12 +00:00
bootloader_rw_tmp_files(lvm_t)
2005-05-13 14:36:35 +00:00
')
optional_policy(`
dpkg_script_rw_pipes(lvm_t)
')
optional_policy(`
2005-08-17 21:28:31 +00:00
gpm_dontaudit_getattr_gpmctl(lvm_t)
')
2009-05-06 14:26:20 +00:00
optional_policy(`
dbus_system_bus_client(lvm_t)
')
optional_policy(`
modutils_domtrans(lvm_t)
2009-05-06 14:26:20 +00:00
')
optional_policy(`
rpm_manage_script_tmp_files(lvm_t)
')
optional_policy(`
udev_read_runtime_files(lvm_t)
2005-05-13 14:36:35 +00:00
')
2009-05-06 14:26:20 +00:00
optional_policy(`
usermanage_read_crack_db(lvm_t)
')
2009-11-24 14:19:45 +00:00
optional_policy(`
virt_manage_images(lvm_t)
')
2009-05-06 14:26:20 +00:00
optional_policy(`
xen_append_log(lvm_t)
xen_dontaudit_rw_unix_stream_sockets(lvm_t)
')