bootloader.te 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. policy_module(bootloader, 1.15.1)
  2. ########################################
  3. #
  4. # Declarations
  5. #
  6. attribute_role bootloader_roles;
  7. roleattribute system_r bootloader_roles;
  8. #
  9. # boot_runtime_t is the type for /boot/kernel.h,
  10. # which is automatically generated at boot time.
  11. # only for Red Hat
  12. #
  13. type boot_runtime_t;
  14. files_type(boot_runtime_t)
  15. type bootloader_t;
  16. type bootloader_exec_t;
  17. application_domain(bootloader_t, bootloader_exec_t)
  18. role bootloader_roles types bootloader_t;
  19. #
  20. # bootloader_etc_t is the configuration file,
  21. # grub.conf, lilo.conf, etc.
  22. #
  23. type bootloader_etc_t alias etc_bootloader_t;
  24. files_type(bootloader_etc_t)
  25. #
  26. # The temp file is used for initrd creation;
  27. # it consists of files and device nodes
  28. #
  29. type bootloader_tmp_t;
  30. files_tmp_file(bootloader_tmp_t)
  31. dev_node(bootloader_tmp_t)
  32. ########################################
  33. #
  34. # bootloader local policy
  35. #
  36. allow bootloader_t self:capability { dac_override dac_read_search fsetid sys_rawio sys_admin mknod chown };
  37. allow bootloader_t self:process { signal_perms execmem };
  38. allow bootloader_t self:fifo_file rw_fifo_file_perms;
  39. allow bootloader_t bootloader_etc_t:file read_file_perms;
  40. # uncomment the following lines if you use "lilo -p"
  41. #allow bootloader_t bootloader_etc_t:file manage_file_perms;
  42. #files_etc_filetrans(bootloader_t,bootloader_etc_t,file)
  43. manage_dirs_pattern(bootloader_t, bootloader_tmp_t, bootloader_tmp_t)
  44. manage_files_pattern(bootloader_t, bootloader_tmp_t, bootloader_tmp_t)
  45. manage_lnk_files_pattern(bootloader_t, bootloader_tmp_t, bootloader_tmp_t)
  46. manage_blk_files_pattern(bootloader_t, bootloader_tmp_t, bootloader_tmp_t)
  47. manage_chr_files_pattern(bootloader_t, bootloader_tmp_t, bootloader_tmp_t)
  48. files_tmp_filetrans(bootloader_t, bootloader_tmp_t, { dir file lnk_file chr_file blk_file })
  49. # for tune2fs (cjp: ?)
  50. files_root_filetrans(bootloader_t, bootloader_tmp_t, file)
  51. kernel_getattr_core_if(bootloader_t)
  52. kernel_read_network_state(bootloader_t)
  53. kernel_read_system_state(bootloader_t)
  54. kernel_read_software_raid_state(bootloader_t)
  55. kernel_read_kernel_sysctls(bootloader_t)
  56. # for grub-probe
  57. kernel_request_load_module(bootloader_t)
  58. storage_raw_read_fixed_disk(bootloader_t)
  59. storage_raw_write_fixed_disk(bootloader_t)
  60. storage_raw_read_removable_device(bootloader_t)
  61. storage_raw_write_removable_device(bootloader_t)
  62. dev_getattr_all_chr_files(bootloader_t)
  63. dev_getattr_all_blk_files(bootloader_t)
  64. dev_dontaudit_rw_generic_dev_nodes(bootloader_t)
  65. dev_read_rand(bootloader_t)
  66. dev_read_urand(bootloader_t)
  67. dev_read_sysfs(bootloader_t)
  68. # needed on some hardware
  69. dev_rw_nvram(bootloader_t)
  70. fs_getattr_xattr_fs(bootloader_t)
  71. fs_getattr_tmpfs(bootloader_t)
  72. fs_read_tmpfs_symlinks(bootloader_t)
  73. #Needed for ia64
  74. fs_manage_dos_files(bootloader_t)
  75. mls_file_read_all_levels(bootloader_t)
  76. mls_file_write_all_levels(bootloader_t)
  77. term_getattr_all_ttys(bootloader_t)
  78. term_dontaudit_manage_pty_dirs(bootloader_t)
  79. corecmd_exec_all_executables(bootloader_t)
  80. domain_use_interactive_fds(bootloader_t)
  81. files_create_boot_dirs(bootloader_t)
  82. files_manage_boot_files(bootloader_t)
  83. files_manage_boot_symlinks(bootloader_t)
  84. files_read_etc_files(bootloader_t)
  85. files_exec_etc_files(bootloader_t)
  86. files_read_usr_src_files(bootloader_t)
  87. files_read_usr_files(bootloader_t)
  88. files_read_var_files(bootloader_t)
  89. files_read_kernel_modules(bootloader_t)
  90. # for nscd
  91. files_dontaudit_search_pids(bootloader_t)
  92. # for blkid.tab
  93. files_manage_etc_runtime_files(bootloader_t)
  94. files_etc_filetrans_etc_runtime(bootloader_t, file)
  95. files_dontaudit_search_home(bootloader_t)
  96. init_getattr_initctl(bootloader_t)
  97. init_use_script_ptys(bootloader_t)
  98. init_use_script_fds(bootloader_t)
  99. init_rw_script_pipes(bootloader_t)
  100. libs_read_lib_files(bootloader_t)
  101. libs_exec_lib_files(bootloader_t)
  102. logging_send_syslog_msg(bootloader_t)
  103. logging_rw_generic_logs(bootloader_t)
  104. miscfiles_read_localization(bootloader_t)
  105. modutils_domtrans_insmod(bootloader_t)
  106. seutil_read_bin_policy(bootloader_t)
  107. seutil_read_loadpolicy(bootloader_t)
  108. seutil_dontaudit_search_config(bootloader_t)
  109. userdom_use_user_terminals(bootloader_t)
  110. userdom_dontaudit_search_user_home_dirs(bootloader_t)
  111. seutil_read_file_contexts(bootloader_t)
  112. gen_require(`
  113. type xconsole_device_t;
  114. ')
  115. allow bootloader_t xconsole_device_t:fifo_file getattr;
  116. ifdef(`distro_debian',`
  117. allow bootloader_t bootloader_tmp_t:{ dir file } { relabelfrom relabelto };
  118. fs_list_tmpfs(bootloader_t)
  119. files_relabel_kernel_modules(bootloader_t)
  120. files_relabelfrom_boot_files(bootloader_t)
  121. files_delete_kernel_modules(bootloader_t)
  122. files_relabelto_usr_files(bootloader_t)
  123. files_search_var_lib(bootloader_t)
  124. # for /usr/share/initrd-tools/scripts
  125. files_exec_usr_files(bootloader_t)
  126. fstools_manage_entry_files(bootloader_t)
  127. fstools_relabelto_entry_files(bootloader_t)
  128. libs_relabelto_lib_files(bootloader_t)
  129. # for apt-cache
  130. dpkg_read_db(bootloader_t)
  131. apt_read_db(bootloader_t)
  132. apt_read_cache(bootloader_t)
  133. ')
  134. ifdef(`distro_redhat',`
  135. # for memlock
  136. allow bootloader_t self:capability ipc_lock;
  137. allow bootloader_t boot_runtime_t:file { read_file_perms delete_file_perms };
  138. # new file system defaults to unlabeled, granting unlabeled access is still bad.
  139. kernel_manage_unlabeled_dirs(bootloader_t)
  140. kernel_manage_unlabeled_files(bootloader_t)
  141. kernel_manage_unlabeled_symlinks(bootloader_t)
  142. kernel_manage_unlabeled_blk_files(bootloader_t)
  143. kernel_manage_unlabeled_chr_files(bootloader_t)
  144. # for mke2fs
  145. mount_run(bootloader_t, bootloader_roles)
  146. optional_policy(`
  147. unconfined_domain(bootloader_t)
  148. ')
  149. ')
  150. optional_policy(`
  151. fstools_exec(bootloader_t)
  152. ')
  153. optional_policy(`
  154. hal_dontaudit_append_lib_files(bootloader_t)
  155. hal_write_log(bootloader_t)
  156. ')
  157. optional_policy(`
  158. kudzu_domtrans(bootloader_t)
  159. ')
  160. optional_policy(`
  161. dev_rw_lvm_control(bootloader_t)
  162. lvm_domtrans(bootloader_t)
  163. lvm_read_config(bootloader_t)
  164. ')
  165. optional_policy(`
  166. modutils_exec_insmod(bootloader_t)
  167. modutils_read_module_deps(bootloader_t)
  168. modutils_read_module_config(bootloader_t)
  169. modutils_exec_insmod(bootloader_t)
  170. modutils_exec_depmod(bootloader_t)
  171. modutils_exec_update_mods(bootloader_t)
  172. ')
  173. optional_policy(`
  174. nscd_use(bootloader_t)
  175. ')
  176. optional_policy(`
  177. rpm_rw_pipes(bootloader_t)
  178. ')