2005-04-20 19:07:16 +00:00
|
|
|
|
2005-04-26 17:00:25 +00:00
|
|
|
policy_module(bootloader,1.0)
|
|
|
|
|
2005-04-28 21:41:09 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Declarations
|
|
|
|
#
|
|
|
|
|
2005-06-13 17:35:46 +00:00
|
|
|
attribute rw_kern_modules;
|
2005-04-14 20:18:17 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# boot_t is the type for files in /boot
|
|
|
|
#
|
|
|
|
type boot_t;
|
2005-06-29 14:26:41 +00:00
|
|
|
files_type(boot_t)
|
2005-06-13 17:35:46 +00:00
|
|
|
files_mountpoint(boot_t)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-04-25 21:32:09 +00:00
|
|
|
#
|
|
|
|
# boot_runtime_t is the type for /boot/kernel.h,
|
|
|
|
# which is automatically generated at boot time.
|
|
|
|
# only for Red Hat
|
|
|
|
#
|
2005-04-16 17:18:34 +00:00
|
|
|
type boot_runtime_t;
|
2005-06-29 14:26:41 +00:00
|
|
|
files_type(boot_runtime_t)
|
2005-04-16 17:18:34 +00:00
|
|
|
|
2005-04-25 21:32:09 +00:00
|
|
|
type bootloader_t;
|
2005-06-13 17:35:46 +00:00
|
|
|
domain_type(bootloader_t)
|
2005-05-03 20:23:33 +00:00
|
|
|
role system_r types bootloader_t;
|
2005-04-25 21:32:09 +00:00
|
|
|
|
|
|
|
type bootloader_exec_t;
|
2005-06-13 17:35:46 +00:00
|
|
|
domain_entry_file(bootloader_t,bootloader_exec_t)
|
2005-04-25 21:32:09 +00:00
|
|
|
|
2005-04-14 20:18:17 +00:00
|
|
|
#
|
|
|
|
# bootloader_etc_t is the configuration file,
|
|
|
|
# grub.conf, lilo.conf, etc.
|
|
|
|
#
|
|
|
|
type bootloader_etc_t alias etc_bootloader_t;
|
2005-06-29 14:26:41 +00:00
|
|
|
files_type(bootloader_etc_t)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# The temp file is used for initrd creation;
|
|
|
|
# it consists of files and device nodes
|
|
|
|
#
|
|
|
|
type bootloader_tmp_t;
|
2005-06-13 17:35:46 +00:00
|
|
|
files_tmp_file(bootloader_tmp_t)
|
2005-06-13 16:22:32 +00:00
|
|
|
dev_node(bootloader_tmp_t)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-04-25 21:32:09 +00:00
|
|
|
# kernel modules
|
|
|
|
type modules_object_t;
|
2005-06-29 14:26:41 +00:00
|
|
|
files_type(modules_object_t)
|
2005-04-25 21:32:09 +00:00
|
|
|
|
2005-06-13 17:35:46 +00:00
|
|
|
neverallow ~rw_kern_modules modules_object_t:file { create append write };
|
2005-04-25 21:32:09 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# system_map_t is for the system.map files in /boot
|
|
|
|
#
|
|
|
|
type system_map_t;
|
2005-06-29 14:26:41 +00:00
|
|
|
files_type(system_map_t)
|
2005-04-25 21:32:09 +00:00
|
|
|
|
2005-04-22 19:31:32 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# bootloader local policy
|
|
|
|
#
|
|
|
|
|
2005-04-14 20:18:17 +00:00
|
|
|
allow bootloader_t self:capability { dac_read_search fsetid sys_rawio sys_admin mknod chown };
|
|
|
|
allow bootloader_t self:process { sigkill sigstop signull signal };
|
|
|
|
allow bootloader_t self:fifo_file { getattr read write };
|
|
|
|
|
2005-06-08 20:28:45 +00:00
|
|
|
allow bootloader_t boot_t:dir ra_dir_perms;
|
|
|
|
allow bootloader_t boot_t:file { rw_file_perms create };
|
|
|
|
allow bootloader_t boot_t:lnk_file { r_file_perms create unlink };
|
2005-05-13 14:37:13 +00:00
|
|
|
|
2005-06-08 20:28:45 +00:00
|
|
|
allow bootloader_t bootloader_etc_t:file r_file_perms;
|
2005-05-13 14:37:13 +00:00
|
|
|
# uncomment the following lines if you use "lilo -p"
|
|
|
|
#allow bootloader_t bootloader_etc_t:file { create ioctl read getattr lock write setattr append link unlink rename };
|
2005-06-13 17:35:46 +00:00
|
|
|
#files_create_etc_config(bootloader_t,bootloader_etc_t)
|
2005-05-13 14:37:13 +00:00
|
|
|
|
2005-06-08 20:28:45 +00:00
|
|
|
allow bootloader_t bootloader_tmp_t:dir create_dir_perms;
|
|
|
|
allow bootloader_t bootloader_tmp_t:file create_file_perms;
|
|
|
|
allow bootloader_t bootloader_tmp_t:chr_file create_file_perms;
|
|
|
|
allow bootloader_t bootloader_tmp_t:blk_file create_file_perms;
|
|
|
|
allow bootloader_t bootloader_tmp_t:lnk_file create_lnk_perms;
|
2005-06-13 17:35:46 +00:00
|
|
|
files_create_tmp_files(bootloader_t,bootloader_tmp_t,{ dir file lnk_file chr_file blk_file })
|
2005-05-13 14:37:13 +00:00
|
|
|
# for tune2fs (cjp: ?)
|
2005-06-13 17:35:46 +00:00
|
|
|
files_create_root(bootloader_t,bootloader_tmp_t)
|
2005-05-13 14:37:13 +00:00
|
|
|
|
2005-06-08 20:28:45 +00:00
|
|
|
allow bootloader_t modules_object_t:dir r_dir_perms;
|
|
|
|
allow bootloader_t modules_object_t:file r_file_perms;
|
|
|
|
allow bootloader_t modules_object_t:lnk_file r_file_perms;
|
2005-05-13 14:37:13 +00:00
|
|
|
|
2005-06-10 01:01:13 +00:00
|
|
|
kernel_getattr_core(bootloader_t)
|
2005-04-14 20:18:17 +00:00
|
|
|
kernel_read_system_state(bootloader_t)
|
|
|
|
kernel_read_software_raid_state(bootloader_t)
|
|
|
|
kernel_read_kernel_sysctl(bootloader_t)
|
|
|
|
|
|
|
|
storage_raw_read_fixed_disk(bootloader_t)
|
|
|
|
storage_raw_write_fixed_disk(bootloader_t)
|
|
|
|
storage_raw_read_removable_device(bootloader_t)
|
|
|
|
storage_raw_write_removable_device(bootloader_t)
|
|
|
|
|
2005-06-13 16:22:32 +00:00
|
|
|
dev_getattr_all_chr_files(bootloader_t)
|
|
|
|
dev_setattr_all_blk_files(bootloader_t)
|
|
|
|
dev_dontaudit_rw_generic_dev_nodes(bootloader_t)
|
|
|
|
dev_read_rand(bootloader_t)
|
|
|
|
dev_read_urand(bootloader_t)
|
2005-06-20 17:41:29 +00:00
|
|
|
dev_getattr_sysfs_dir(bootloader_t)
|
2005-05-03 20:23:33 +00:00
|
|
|
# for reading BIOS data
|
2005-06-13 16:22:32 +00:00
|
|
|
dev_read_raw_memory(bootloader_t)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-06-10 01:01:13 +00:00
|
|
|
fs_getattr_xattr_fs(bootloader_t)
|
2005-05-13 14:37:13 +00:00
|
|
|
|
2005-06-10 01:01:13 +00:00
|
|
|
term_getattr_all_user_ttys(bootloader_t)
|
2005-05-13 14:37:13 +00:00
|
|
|
|
2005-06-13 17:35:46 +00:00
|
|
|
init_getattr_initctl(bootloader_t)
|
|
|
|
init_use_script_pty(bootloader_t)
|
|
|
|
init_use_script_fd(bootloader_t)
|
2005-06-20 17:41:29 +00:00
|
|
|
init_rw_script_pipe(bootloader_t)
|
2005-04-28 21:41:09 +00:00
|
|
|
|
2005-06-13 17:35:46 +00:00
|
|
|
domain_use_wide_inherit_fd(bootloader_t)
|
2005-04-28 21:41:09 +00:00
|
|
|
|
2005-06-13 17:35:46 +00:00
|
|
|
libs_use_ld_so(bootloader_t)
|
|
|
|
libs_use_shared_libs(bootloader_t)
|
|
|
|
libs_read_lib(bootloader_t)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-06-29 14:26:41 +00:00
|
|
|
files_read_etc_files(bootloader_t)
|
2005-06-13 17:35:46 +00:00
|
|
|
files_read_etc_runtime_files(bootloader_t)
|
2005-06-29 14:26:41 +00:00
|
|
|
files_read_usr_src_files(bootloader_t)
|
2005-06-13 17:35:46 +00:00
|
|
|
files_read_usr_files(bootloader_t)
|
2005-06-29 14:26:41 +00:00
|
|
|
files_read_var_files(bootloader_t)
|
2005-05-13 14:37:13 +00:00
|
|
|
# for nscd
|
2005-06-13 17:35:46 +00:00
|
|
|
files_dontaudit_search_pids(bootloader_t)
|
2005-04-28 21:41:09 +00:00
|
|
|
|
2005-06-13 17:35:46 +00:00
|
|
|
corecmd_exec_bin(bootloader_t)
|
|
|
|
corecmd_exec_sbin(bootloader_t)
|
|
|
|
corecmd_exec_shell(bootloader_t)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-06-13 17:35:46 +00:00
|
|
|
logging_send_syslog_msg(bootloader_t)
|
|
|
|
logging_rw_generic_logs(bootloader_t)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-05-13 14:37:13 +00:00
|
|
|
miscfiles_read_localization(bootloader_t)
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-06-14 20:48:34 +00:00
|
|
|
seutil_read_binary_pol(bootloader_t)
|
|
|
|
seutil_read_loadpol(bootloader_t)
|
2005-04-22 19:31:32 +00:00
|
|
|
|
2005-06-27 20:59:28 +00:00
|
|
|
ifdef(`distro_debian',`
|
|
|
|
allow bootloader_t bootloader_tmp_t:{ dir file } { relabelfrom relabelto };
|
|
|
|
allow bootloader_t modules_object_t:file { relabelfrom relabelto unlink };
|
|
|
|
allow bootloader_t boot_t:file relabelfrom;
|
|
|
|
|
|
|
|
# for /usr/share/initrd-tools/scripts
|
|
|
|
files_exec_usr_files(bootloader_t)
|
2005-05-13 14:37:13 +00:00
|
|
|
')
|
2005-04-28 21:41:09 +00:00
|
|
|
|
2005-06-27 20:59:28 +00:00
|
|
|
ifdef(`distro_redhat',`
|
2005-06-03 12:25:14 +00:00
|
|
|
# for memlock
|
|
|
|
allow bootloader_t self:capability ipc_lock;
|
|
|
|
|
|
|
|
# new file system defaults to file_t, granting file_t access is still bad.
|
2005-06-08 20:28:45 +00:00
|
|
|
allow bootloader_t boot_runtime_t:file { r_file_perms unlink };
|
2005-06-03 12:25:14 +00:00
|
|
|
|
|
|
|
# mkinitrd mount initrd on bootloader temp dir
|
2005-06-13 17:35:46 +00:00
|
|
|
files_mountpoint(bootloader_tmp_t)
|
2005-06-03 12:25:14 +00:00
|
|
|
|
2005-06-27 20:59:28 +00:00
|
|
|
# new file system defaults to file_t, granting file_t access is still bad.
|
|
|
|
files_manage_isid_type_dir(bootloader_t)
|
|
|
|
files_manage_isid_type_file(bootloader_t)
|
|
|
|
files_manage_isid_type_symlink(bootloader_t)
|
|
|
|
files_manage_isid_type_blk_node(bootloader_t)
|
|
|
|
files_manage_isid_type_chr_node(bootloader_t)
|
|
|
|
|
2005-06-03 12:25:14 +00:00
|
|
|
# for mke2fs
|
2005-06-13 17:35:46 +00:00
|
|
|
mount_domtrans(bootloader_t)
|
2005-05-13 14:37:13 +00:00
|
|
|
')
|
2005-04-28 21:41:09 +00:00
|
|
|
|
2005-06-27 20:59:28 +00:00
|
|
|
optional_policy(`filesystemtools.te',`
|
2005-06-03 12:25:14 +00:00
|
|
|
filesystemtools_execute(bootloader_t)
|
2005-05-13 14:37:13 +00:00
|
|
|
')
|
2005-04-28 21:41:09 +00:00
|
|
|
|
2005-06-27 20:59:28 +00:00
|
|
|
optional_policy(`lvm.te',`
|
2005-06-13 16:22:32 +00:00
|
|
|
dev_rw_lvm_control(bootloader_t)
|
2005-06-03 12:25:14 +00:00
|
|
|
|
2005-06-13 17:35:46 +00:00
|
|
|
lvm_domtrans(bootloader_t)
|
2005-06-03 12:25:14 +00:00
|
|
|
lvm_read_config(bootloader_t)
|
2005-05-13 14:37:13 +00:00
|
|
|
')
|
2005-04-28 21:41:09 +00:00
|
|
|
|
2005-05-13 14:37:13 +00:00
|
|
|
optional_policy(`modutils.te',`
|
2005-06-13 17:35:46 +00:00
|
|
|
modutils_exec_insmod(insmod_t)
|
2005-06-29 14:26:41 +00:00
|
|
|
modutils_read_mods_deps(bootloader_t)
|
2005-06-13 17:35:46 +00:00
|
|
|
modutils_read_module_conf(bootloader_t)
|
|
|
|
modutils_exec_insmod(bootloader_t)
|
|
|
|
modutils_exec_depmod(bootloader_t)
|
|
|
|
modutils_exec_update_mods(bootloader_t)
|
2005-05-13 14:37:13 +00:00
|
|
|
')
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-05-13 14:37:13 +00:00
|
|
|
ifdef(`TODO',`
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-06-27 20:59:28 +00:00
|
|
|
dontaudit bootloader_t selinux_config_t:dir search;
|
|
|
|
dontaudit bootloader_t { staff_home_dir_t sysadm_home_dir_t }:dir search;
|
|
|
|
dontaudit bootloader_t devpts_t:dir create_dir_perms;
|
2005-04-14 20:18:17 +00:00
|
|
|
|
2005-06-07 18:45:47 +00:00
|
|
|
ifdef(`distro_debian', `
|
2005-06-03 12:25:14 +00:00
|
|
|
allow bootloader_t { usr_t lib_t fsadm_exec_t }:file relabelto;
|
|
|
|
allow bootloader_t { usr_t lib_t fsadm_exec_t }:file create_file_perms;
|
|
|
|
allow bootloader_t tmpfs_t:dir r_dir_perms;
|
|
|
|
allow bootloader_t initrc_var_run_t:dir r_dir_perms;
|
|
|
|
allow bootloader_t var_lib_t:dir search;
|
|
|
|
allow bootloader_t dpkg_var_lib_t:dir r_dir_perms;
|
|
|
|
allow bootloader_t dpkg_var_lib_t:file { getattr read };
|
|
|
|
|
2005-04-14 20:18:17 +00:00
|
|
|
')
|
|
|
|
|
|
|
|
') dnl end TODO
|