logrotate.te 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. policy_module(logrotate, 1.18.2)
  2. ########################################
  3. #
  4. # Declarations
  5. #
  6. attribute_role logrotate_roles;
  7. roleattribute system_r logrotate_roles;
  8. type logrotate_t;
  9. type logrotate_exec_t;
  10. domain_type(logrotate_t)
  11. domain_obj_id_change_exemption(logrotate_t)
  12. domain_system_change_exemption(logrotate_t)
  13. domain_entry_file(logrotate_t, logrotate_exec_t)
  14. role logrotate_roles types logrotate_t;
  15. type logrotate_lock_t;
  16. files_lock_file(logrotate_lock_t)
  17. type logrotate_tmp_t;
  18. files_tmp_file(logrotate_tmp_t)
  19. type logrotate_var_lib_t;
  20. files_type(logrotate_var_lib_t)
  21. type logrotate_unit_t;
  22. init_unit_file(logrotate_unit_t)
  23. mta_base_mail_template(logrotate)
  24. role system_r types logrotate_mail_t;
  25. ########################################
  26. #
  27. # Local policy
  28. #
  29. allow logrotate_t self:capability { chown dac_override dac_read_search kill fsetid fowner net_admin setuid setgid sys_resource sys_nice sys_ptrace };
  30. allow logrotate_t self:process ~{ ptrace setcurrent setexec execmem execstack execheap };
  31. allow logrotate_t self:process execmem;
  32. allow logrotate_t self:fd use;
  33. allow logrotate_t self:key manage_key_perms;
  34. allow logrotate_t self:fifo_file rw_fifo_file_perms;
  35. allow logrotate_t self:unix_dgram_socket sendto;
  36. allow logrotate_t self:unix_stream_socket { accept connectto listen };
  37. allow logrotate_t self:shm create_shm_perms;
  38. allow logrotate_t self:sem create_sem_perms;
  39. allow logrotate_t self:msgq create_msgq_perms;
  40. allow logrotate_t self:msg { send receive };
  41. allow logrotate_t logrotate_lock_t:file manage_file_perms;
  42. files_lock_filetrans(logrotate_t, logrotate_lock_t, file)
  43. manage_dirs_pattern(logrotate_t, logrotate_tmp_t, logrotate_tmp_t)
  44. manage_files_pattern(logrotate_t, logrotate_tmp_t, logrotate_tmp_t)
  45. files_tmp_filetrans(logrotate_t, logrotate_tmp_t, { file dir })
  46. create_dirs_pattern(logrotate_t, logrotate_var_lib_t, logrotate_var_lib_t)
  47. manage_files_pattern(logrotate_t, logrotate_var_lib_t, logrotate_var_lib_t)
  48. read_lnk_files_pattern(logrotate_t, logrotate_var_lib_t, logrotate_var_lib_t)
  49. files_var_lib_filetrans(logrotate_t, logrotate_var_lib_t, file)
  50. can_exec(logrotate_t, { logrotate_exec_t logrotate_tmp_t })
  51. kernel_read_system_state(logrotate_t)
  52. kernel_read_kernel_sysctls(logrotate_t)
  53. corecmd_exec_bin(logrotate_t)
  54. corecmd_exec_shell(logrotate_t)
  55. corecmd_getattr_all_executables(logrotate_t)
  56. dev_read_urand(logrotate_t)
  57. domain_signal_all_domains(logrotate_t)
  58. domain_use_interactive_fds(logrotate_t)
  59. domain_getattr_all_entry_files(logrotate_t)
  60. domain_read_all_domains_state(logrotate_t)
  61. files_read_usr_files(logrotate_t)
  62. files_read_etc_runtime_files(logrotate_t)
  63. files_read_all_pids(logrotate_t)
  64. files_search_all(logrotate_t)
  65. files_read_var_lib_files(logrotate_t)
  66. files_manage_generic_spool(logrotate_t)
  67. files_manage_generic_spool_dirs(logrotate_t)
  68. files_getattr_generic_locks(logrotate_t)
  69. files_dontaudit_list_mnt(logrotate_t)
  70. fs_search_auto_mountpoints(logrotate_t)
  71. fs_getattr_xattr_fs(logrotate_t)
  72. fs_list_inotifyfs(logrotate_t)
  73. fs_getattr_tmpfs(logrotate_t)
  74. mls_file_read_all_levels(logrotate_t)
  75. mls_file_write_all_levels(logrotate_t)
  76. mls_file_upgrade(logrotate_t)
  77. mls_process_write_to_clearance(logrotate_t)
  78. selinux_get_fs_mount(logrotate_t)
  79. selinux_get_enforce_mode(logrotate_t)
  80. auth_manage_login_records(logrotate_t)
  81. auth_use_nsswitch(logrotate_t)
  82. init_all_labeled_script_domtrans(logrotate_t)
  83. init_script_service_restart(logrotate_t)
  84. init_get_generic_units_status(logrotate_t)
  85. init_get_all_units_status(logrotate_t)
  86. init_get_system_status(logrotate_t)
  87. init_dbus_chat(logrotate_t)
  88. init_stream_connect(logrotate_t)
  89. dbus_system_bus_client(logrotate_t)
  90. init_write_pid_socket(logrotate_t)
  91. logging_manage_all_logs(logrotate_t)
  92. logging_send_syslog_msg(logrotate_t)
  93. logging_send_audit_msgs(logrotate_t)
  94. logging_exec_all_logs(logrotate_t)
  95. miscfiles_read_localization(logrotate_t)
  96. seutil_dontaudit_read_config(logrotate_t)
  97. userdom_use_user_terminals(logrotate_t)
  98. userdom_list_user_home_dirs(logrotate_t)
  99. userdom_use_unpriv_users_fds(logrotate_t)
  100. mta_sendmail_domtrans(logrotate_t, logrotate_mail_t)
  101. ifdef(`distro_debian',`
  102. allow logrotate_t logrotate_tmp_t:file relabel_file_perms;
  103. can_exec(logrotate_t, logrotate_exec_t)
  104. logging_check_exec_syslog(logrotate_t)
  105. logging_read_syslog_config(logrotate_t)
  106. ')
  107. init_manage_all_units(logrotate_t)
  108. optional_policy(`
  109. abrt_manage_cache(logrotate_t)
  110. ')
  111. optional_policy(`
  112. acct_domtrans(logrotate_t)
  113. acct_manage_data(logrotate_t)
  114. acct_exec_data(logrotate_t)
  115. ')
  116. optional_policy(`
  117. apache_read_config(logrotate_t)
  118. apache_domtrans(logrotate_t)
  119. apache_signull(logrotate_t)
  120. ')
  121. optional_policy(`
  122. asterisk_domtrans(logrotate_t)
  123. ')
  124. optional_policy(`
  125. awstats_domtrans(logrotate_t)
  126. ')
  127. optional_policy(`
  128. bind_manage_cache(logrotate_t)
  129. ')
  130. optional_policy(`
  131. callweaver_exec(logrotate_t)
  132. callweaver_stream_connect(logrotate_t)
  133. ')
  134. optional_policy(`
  135. consoletype_exec(logrotate_t)
  136. ')
  137. optional_policy(`
  138. cron_system_entry(logrotate_t, logrotate_exec_t)
  139. cron_search_spool(logrotate_t)
  140. ')
  141. optional_policy(`
  142. cups_domtrans(logrotate_t)
  143. ')
  144. optional_policy(`
  145. fail2ban_stream_connect(logrotate_t)
  146. ')
  147. optional_policy(`
  148. hostname_exec(logrotate_t)
  149. ')
  150. optional_policy(`
  151. chronyd_read_key_files(logrotate_t)
  152. ')
  153. optional_policy(`
  154. icecast_signal(logrotate_t)
  155. ')
  156. optional_policy(`
  157. mailman_domtrans(logrotate_t)
  158. mailman_search_data(logrotate_t)
  159. mailman_manage_log(logrotate_t)
  160. ')
  161. optional_policy(`
  162. munin_read_config(logrotate_t)
  163. munin_stream_connect(logrotate_t)
  164. munin_search_lib(logrotate_t)
  165. ')
  166. optional_policy(`
  167. mysql_read_config(logrotate_t)
  168. mysql_stream_connect(logrotate_t)
  169. mysql_signal(logrotate_t)
  170. ')
  171. optional_policy(`
  172. openvswitch_read_pid_files(logrotate_t)
  173. openvswitch_domtrans(logrotate_t)
  174. ')
  175. optional_policy(`
  176. polipo_log_filetrans_log(logrotate_t, file, "polipo")
  177. ')
  178. optional_policy(`
  179. psad_domtrans(logrotate_t)
  180. ')
  181. optional_policy(`
  182. samba_exec_log(logrotate_t)
  183. ')
  184. optional_policy(`
  185. sssd_domtrans(logrotate_t)
  186. ')
  187. optional_policy(`
  188. slrnpull_manage_spool(logrotate_t)
  189. ')
  190. optional_policy(`
  191. squid_domtrans(logrotate_t)
  192. ')
  193. optional_policy(`
  194. su_exec(logrotate_t)
  195. ')
  196. optional_policy(`
  197. varnishd_manage_log(logrotate_t)
  198. ')
  199. optional_policy(`
  200. manage_webalizer_var_lib(logrotate_t)
  201. webalizer_run(logrotate_t, system_r)
  202. ')
  203. optional_policy(`
  204. gen_require(`
  205. type phpfpm_etc_t;
  206. ')
  207. read_files_pattern(logrotate_t,phpfpm_etc_t,phpfpm_etc_t)
  208. ')
  209. optional_policy(`
  210. gen_require(`
  211. type php_usr_lib_t;
  212. ')
  213. allow logrotate_t php_usr_lib_t:file { read open execute execute_no_trans };
  214. ')
  215. optional_policy(`
  216. gen_require(`
  217. type php_etc_t;
  218. ')
  219. read_files_pattern(logrotate_t,php_etc_t,php_etc_t)
  220. ')
  221. #######################################
  222. #
  223. # Mail local policy
  224. #
  225. allow logrotate_mail_t logrotate_t:fd use;
  226. allow logrotate_mail_t logrotate_t:fifo_file rw_fifo_file_perms;
  227. allow logrotate_mail_t logrotate_t:process sigchld;
  228. manage_files_pattern(logrotate_mail_t, logrotate_tmp_t, logrotate_tmp_t)
  229. logging_read_all_logs(logrotate_mail_t)