logrotate.te 6.2 KB

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