Chris PeBenito 1bde83
# Copyright (C) 2005 Tresys Technology, LLC
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 ff3138
init_make_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 1bde83
kernel_make_object_identity_change_constraint_exception(lvm_t)
Chris PeBenito 1bde83
role system_r types lvm_t;
Chris PeBenito 1bde83
Chris PeBenito 1bde83
type lvm_etc_t;
Chris PeBenito 1bde83
files_make_file(lvm_etc_t)
Chris PeBenito 1bde83
Chris PeBenito 1bde83
type lvm_lock_t;
Chris PeBenito 1bde83
files_make_lock_file(lvm_lock_t)
Chris PeBenito 1bde83
Chris PeBenito daa0e0
type lvm_metadata_t;
Chris PeBenito daa0e0
files_make_file(lvm_metadata_t)
Chris PeBenito daa0e0
Chris PeBenito daa0e0
type lvm_tmp_t;
Chris PeBenito daa0e0
files_make_temporary_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 1bde83
allow lvm_t self:file { read getattr lock ioctl };
Chris PeBenito 1bde83
allow lvm_t self:fifo_file { ioctl read getattr lock write append };
Chris PeBenito 1bde83
allow lvm_t self:unix_dgram_socket { create ioctl read getattr write setattr append bind connect getopt setopt shutdown };
Chris PeBenito 1bde83
Chris PeBenito 1bde83
allow lvm_t lvm_tmp_t:dir { create read getattr lock setattr ioctl link unlink rename search add_name remove_name reparent write rmdir };
Chris PeBenito 1bde83
allow lvm_t lvm_tmp_t:file { create ioctl read getattr lock write setattr append link unlink rename };
Chris PeBenito 1bde83
files_create_private_tmp_data(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 1bde83
allow lvm_t lvm_exec_t:{ file lnk_file } { read getattr lock ioctl };
Chris PeBenito 1bde83
Chris PeBenito 1bde83
# LVM is split into many individual binaries
Chris PeBenito 1bde83
allow lvm_t lvm_exec_t:file { getattr read execute execute_no_trans };
Chris PeBenito 1bde83
Chris PeBenito 1bde83
# Creating lock files
Chris PeBenito 1bde83
allow lvm_t lvm_lock_t:dir { read getattr lock search ioctl add_name remove_name write };
Chris PeBenito 1bde83
allow lvm_t lvm_lock_t:file { create ioctl read getattr lock write setattr append link unlink rename };
Chris PeBenito 1bde83
files_create_private_lock_file(lvm_t,lvm_lock_t)
Chris PeBenito 1bde83
Chris PeBenito 1bde83
allow lvm_t lvm_etc_t:file { read getattr lock ioctl };
Chris PeBenito 1bde83
allow lvm_t lvm_etc_t:lnk_file { getattr read };
Chris PeBenito 1bde83
# Write to /etc/lvm, /etc/lvmtab, /etc/lvmtab.d
Chris PeBenito 1bde83
allow lvm_t lvm_etc_t:dir { read getattr lock search ioctl add_name remove_name write };
Chris PeBenito 1bde83
allow lvm_t lvm_metadata_t:file { create ioctl read getattr lock write setattr append link unlink rename };
Chris PeBenito 1bde83
allow lvm_t lvm_metadata_t:dir { read getattr lock search ioctl add_name remove_name write };
Chris PeBenito 1bde83
type_transition lvm_t lvm_etc_t:file lvm_metadata_t;
Chris PeBenito 1bde83
files_create_private_config(lvm_t,lvm_metadata_t,file)
Chris PeBenito 1bde83
Chris PeBenito 1bde83
kernel_read_system_state(lvm_t)
Chris PeBenito 1bde83
kernel_get_selinuxfs_mount_point(lvm_t)
Chris PeBenito 1bde83
kernel_validate_selinux_context(lvm_t)
Chris PeBenito 178607
kernel_compute_selinux_access_vector(lvm_t)
Chris PeBenito 178607
kernel_compute_selinux_create_context(lvm_t)
Chris PeBenito 178607
kernel_compute_selinux_relabel_context(lvm_t)
Chris PeBenito 178607
kernel_compute_selinux_reachable_user_contexts(lvm_t)
Chris PeBenito 1bde83
kernel_read_kernel_sysctl(lvm_t)
Chris PeBenito 1bde83
kernel_read_hardware_state(lvm_t)
Chris PeBenito 1bde83
# Read /sys/block. Device mapper metadata is kept there.
Chris PeBenito 1bde83
kernel_read_hardware_state(sysfs_t)
Chris PeBenito 1bde83
# Read system variables in /proc/sys
Chris PeBenito 1bde83
kernel_read_kernel_sysctl(lvm_t)
Chris PeBenito 1bde83
# it has no reason to need this
Chris PeBenito 1bde83
kernel_ignore_get_core_interface_attributes(lvm_t)
Chris PeBenito 1bde83
Chris PeBenito f5c42b
devices_add_generic_character_device(lvm_t)
Chris PeBenito 1bde83
devices_get_random_data(lvm_t)
Chris PeBenito 1bde83
devices_get_pseudorandom_data(lvm_t)
Chris PeBenito 1bde83
devices_use_lvm_control_channel(lvm_t)
Chris PeBenito 1bde83
devices_manage_dev_symbolic_links(lvm_t)
Chris PeBenito 1bde83
Chris PeBenito 1bde83
# LVM (vgscan) scans for devices by stating every file in /dev and applying a regex...
Chris PeBenito 1bde83
devices_ignore_get_all_character_device_attributes(lvm_t)
Chris PeBenito 1bde83
devices_ignore_get_all_block_device_attributes(lvm_t)
Chris PeBenito 1bde83
devices_ignore_get_generic_character_device_attributes(lvm_t)
Chris PeBenito 1bde83
devices_ignore_get_generic_block_device_attributes(lvm_t)
Chris PeBenito f5c42b
devices_ignore_get_generic_pipe_attributes(lvm_t)
Chris PeBenito b16c6b
terminal_ignore_get_all_private_physical_terminal_attributes(lvm_t)
Chris PeBenito 1bde83
Chris PeBenito 1bde83
filesystem_get_persistent_filesystem_attributes(lvm_t)
Chris PeBenito 1bde83
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 1bde83
corecommands_search_system_programs_directory(lvm_t)
Chris PeBenito f5c42b
corecommands_ignore_get_system_programs_attributes(lvm_t)
Chris PeBenito 1bde83
Chris PeBenito 1bde83
domain_use_widely_inheritable_file_descriptors(lvm_t)
Chris PeBenito 1bde83
Chris PeBenito 1bde83
files_search_system_state_data_directory(lvm_t)
Chris PeBenito 1bde83
files_read_general_system_config(lvm_t)
Chris PeBenito 1bde83
files_read_runtime_system_config(lvm_t)
Chris PeBenito 1bde83
Chris PeBenito 1bde83
init_use_file_descriptors(lvm_t)
Chris PeBenito d490eb
init_ignore_get_control_channel_attributes(lvm_t)
Chris PeBenito d490eb
init_script_use_pseudoterminal(lvm_t)
Chris PeBenito 1bde83
Chris PeBenito 1bde83
libraries_use_dynamic_loader(lvm_t)
Chris PeBenito dd14d0
libraries_use_shared_libraries(lvm_t)
Chris PeBenito 1bde83
Chris PeBenito 1bde83
logging_send_system_log_message(lvm_t)
Chris PeBenito 1bde83
Chris PeBenito 1bde83
miscfiles_read_localization(lvm_t)
Chris PeBenito 1bde83
Chris PeBenito 1bde83
selinux_read_config(lvm_t)
Chris PeBenito 1bde83
selinux_read_file_contexts(lvm_t)
Chris PeBenito 1bde83
selinux_newrole_sigchld(lvm_t)
Chris PeBenito 1bde83
Chris PeBenito 1bde83
tunable_policy(`targeted_policy', `
Chris PeBenito 1bde83
terminal_ignore_use_general_physical_terminal(lvm_t)
Chris PeBenito 1bde83
terminal_ignore_use_general_pseudoterminal(lvm_t)
Chris PeBenito 1bde83
files_ignore_read_rootfs_file(lvm_t)
Chris PeBenito 1bde83
')dnl end targeted_policy tunable
Chris PeBenito 1bde83
Chris PeBenito 1bde83
optional_policy(`bootloader.te',`
Chris PeBenito 1bde83
bootloader_modify_temporary_data(lvm_t)
Chris PeBenito 1bde83
')
Chris PeBenito 1bde83
Chris PeBenito 1bde83
optional_policy(`udev.te', `
Chris PeBenito 1bde83
udev_read_database(lvm_t)
Chris PeBenito 1bde83
')
Chris PeBenito 1bde83
Chris PeBenito 1bde83
ifdef(`TODO',`
Chris PeBenito 1bde83
Chris PeBenito 1bde83
allow lvm_t autofs_t:dir { search getattr };
Chris PeBenito 1bde83
Chris PeBenito 1bde83
allow lvm_t device_t:blk_file { create ioctl read getattr lock write setattr append link unlink rename };
Chris PeBenito 1bde83
Chris PeBenito 1bde83
allow lvm_t default_context_t:dir search;
Chris PeBenito 1bde83
allow lvm_t fixed_disk_device_t:blk_file { relabelfrom relabelto };
Chris PeBenito 1bde83
allow lvm_t device_t:lnk_file { relabelfrom relabelto };
Chris PeBenito 1bde83
Chris PeBenito 1bde83
dontaudit lvm_t var_run_t:dir getattr;
Chris PeBenito 1bde83
Chris PeBenito 1bde83
# for when /usr is not mounted
Chris PeBenito 1bde83
dontaudit lvm_t file_t:dir search;
Chris PeBenito 1bde83
Chris PeBenito 1bde83
optional_policy(`gnome-pty-helper.te', `
Chris PeBenito 1bde83
allow lvm_t sysadm_gph_t:fd use;
Chris PeBenito 1bde83
')
Chris PeBenito 1bde83
Chris PeBenito 1bde83
optional_policy(`gpm.te', `
Chris PeBenito 1bde83
dontaudit lvm_t gpmctl_t:sock_file getattr;
Chris PeBenito 1bde83
')
Chris PeBenito 1bde83
Chris PeBenito 1bde83
optional_policy(`rhgb.te', `
Chris PeBenito 1bde83
allow $1_t rhgb_t:process sigchld;
Chris PeBenito 1bde83
allow $1_t rhgb_t:fd use;
Chris PeBenito 1bde83
allow $1_t rhgb_t:fifo_file { read write };
Chris PeBenito 1bde83
')
Chris PeBenito 1bde83
Chris PeBenito 1bde83
') dnl end TODO