policy_module(lvm,1.0) ######################################## # # Declarations # type lvm_t; type lvm_exec_t; init_system_domain(lvm_t,lvm_exec_t) # needs privowner because it assigns the identity system_u to device nodes # but runs as the identity of the sysadmin kernel_obj_id_change_exempt(lvm_t) role system_r types lvm_t; type lvm_etc_t; files_file_type(lvm_etc_t) type lvm_lock_t; files_lock_file(lvm_lock_t) type lvm_metadata_t; files_file_type(lvm_metadata_t) type lvm_tmp_t; files_tmp_file(lvm_tmp_t) ######################################## # # Local policy # # DAC overrides and mknod for modifying /dev entries (vgmknodes) allow lvm_t self:capability { dac_override ipc_lock sys_admin sys_nice mknod }; dontaudit lvm_t self:capability sys_tty_config; allow lvm_t self:process { sigchld sigkill sigstop signull signal }; # LVM will complain a lot if it cannot set its priority. allow lvm_t self:process setsched; allow lvm_t self:file r_file_perms; allow lvm_t self:fifo_file rw_file_perms; allow lvm_t self:unix_dgram_socket create_socket_perms; allow lvm_t lvm_tmp_t:dir create_dir_perms; allow lvm_t lvm_tmp_t:file create_file_perms; files_create_tmp_files(lvm_t, lvm_tmp_t, { file dir }) # /lib/lvm- holds the actual LVM binaries (and symlinks) allow lvm_t lvm_exec_t:dir search; allow lvm_t lvm_exec_t:{ file lnk_file } r_file_perms; # LVM is split into many individual binaries can_exec(lvm_t, lvm_exec_t) # Creating lock files allow lvm_t lvm_lock_t:dir rw_dir_perms; allow lvm_t lvm_lock_t:file create_file_perms; files_create_lock_file(lvm_t,lvm_lock_t) allow lvm_t lvm_etc_t:file r_file_perms; allow lvm_t lvm_etc_t:lnk_file r_file_perms; # Write to /etc/lvm, /etc/lvmtab, /etc/lvmtab.d allow lvm_t lvm_etc_t:dir rw_dir_perms; allow lvm_t lvm_metadata_t:file create_file_perms; allow lvm_t lvm_metadata_t:dir rw_dir_perms; type_transition lvm_t lvm_etc_t:file lvm_metadata_t; files_create_etc_config(lvm_t,lvm_metadata_t,file) kernel_read_system_state(lvm_t) kernel_get_selinuxfs_mount_point(lvm_t) kernel_validate_context(lvm_t) kernel_compute_access_vector(lvm_t) kernel_compute_create_context(lvm_t) kernel_compute_relabel_context(lvm_t) kernel_compute_reachable_user_contexts(lvm_t) kernel_read_kernel_sysctl(lvm_t) kernel_read_hardware_state(lvm_t) # Read /sys/block. Device mapper metadata is kept there. kernel_read_hardware_state(sysfs_t) # Read system variables in /proc/sys kernel_read_kernel_sysctl(lvm_t) # it has no reason to need this kernel_dontaudit_getattr_core(lvm_t) dev_create_generic_chr_file(lvm_t) dev_read_rand(lvm_t) dev_read_urand(lvm_t) dev_rw_lvm_control(lvm_t) dev_manage_generic_symlinks(lvm_t) dev_relabel_dev_dirs(lvm_t) dev_manage_generic_blk_file(lvm_t) # LVM (vgscan) scans for devices by stating every file in /dev and applying a regex... dev_dontaudit_getattr_all_chr_files(lvm_t) dev_dontaudit_getattr_all_blk_files(lvm_t) dev_dontaudit_getattr_generic_chr_file(lvm_t) dev_dontaudit_getattr_generic_blk_file(lvm_t) dev_dontaudit_getattr_generic_pipe(lvm_t) term_dontaudit_getattr_all_user_ttys(lvm_t) fs_getattr_xattr_fs(lvm_t) # LVM creates block devices in /dev/mapper or /dev/ # depending on its version # LVM(2) needs to create directores (/dev/mapper, /dev/) # and links from /dev/ to /dev/mapper/- storage_create_fixed_disk_dev_entry(lvm_t) # Access raw devices and old /dev/lvm (c 109,0). Is this needed? storage_manage_fixed_disk(lvm_t) corecmd_search_sbin(lvm_t) corecmd_dontaudit_getattr_sbin_file(lvm_t) domain_use_wide_inherit_fd(lvm_t) files_search_var(lvm_t) files_read_generic_etc_files(lvm_t) files_read_etc_runtime_files(lvm_t) # for when /usr is not mounted: files_dontaudit_search_isid_type_dir(lvm_t) init_use_fd(lvm_t) init_dontaudit_getattr_initctl(lvm_t) init_use_script_pty(lvm_t) libs_use_ld_so(lvm_t) libs_use_shared_libs(lvm_t) logging_send_syslog_msg(lvm_t) miscfiles_read_localization(lvm_t) selinux_read_config(lvm_t) selinux_read_file_contexts(lvm_t) selinux_newrole_sigchld(lvm_t) ifdef(`distro_redhat',` # this is from the initrd: files_rw_isid_type_dir(lvm_t) ') ifdef(`targeted_policy', ` term_dontaudit_use_unallocated_tty(lvm_t) terminal_ignore_use_general_pseudoterminal(lvm_t) files_dontaudit_read_root_file(lvm_t) ') optional_policy(`bootloader.te',` bootloader_rw_tmp_file(lvm_t) ') optional_policy(`udev.te', ` udev_read_db(lvm_t) ') ifdef(`TODO',` allow lvm_t autofs_t:dir { search getattr }; allow lvm_t default_context_t:dir search; allow lvm_t fixed_disk_device_t:blk_file { relabelfrom relabelto }; # cjp: ? this has no effect since LVM does not # have lnk_file relabelto for anything else. allow lvm_t device_t:lnk_file { relabelfrom relabelto }; dontaudit lvm_t var_run_t:dir getattr; optional_policy(`gnome-pty-helper.te', ` allow lvm_t sysadm_gph_t:fd use; ') optional_policy(`gpm.te', ` dontaudit lvm_t gpmctl_t:sock_file getattr; ') optional_policy(`rhgb.te', ` allow $1_t rhgb_t:process sigchld; allow $1_t rhgb_t:fd use; allow $1_t rhgb_t:fifo_file { read write }; ') ') dnl end TODO