amavis.if 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. ## <summary>High-performance interface between an email server and content checkers.</summary>
  2. ########################################
  3. ## <summary>
  4. ## Execute a domain transition to run amavis.
  5. ## </summary>
  6. ## <param name="domain">
  7. ## <summary>
  8. ## Domain allowed to transition.
  9. ## </summary>
  10. ## </param>
  11. #
  12. interface(`amavis_domtrans',`
  13. gen_require(`
  14. type amavis_t, amavis_exec_t;
  15. ')
  16. corecmd_search_bin($1)
  17. domtrans_pattern($1, amavis_exec_t, amavis_t)
  18. ')
  19. ########################################
  20. ## <summary>
  21. ## Execute amavis server in the amavis domain.
  22. ## </summary>
  23. ## <param name="domain">
  24. ## <summary>
  25. ## Domain allowed to transition.
  26. ## </summary>
  27. ## </param>
  28. #
  29. interface(`amavis_initrc_domtrans',`
  30. gen_require(`
  31. type amavis_initrc_exec_t;
  32. ')
  33. init_labeled_script_domtrans($1, amavis_initrc_exec_t)
  34. ')
  35. ########################################
  36. ## <summary>
  37. ## Read amavis spool files.
  38. ## </summary>
  39. ## <param name="domain">
  40. ## <summary>
  41. ## Domain allowed access.
  42. ## </summary>
  43. ## </param>
  44. #
  45. interface(`amavis_read_spool_files',`
  46. gen_require(`
  47. type amavis_spool_t;
  48. ')
  49. files_search_spool($1)
  50. read_files_pattern($1, amavis_spool_t, amavis_spool_t)
  51. ')
  52. ########################################
  53. ## <summary>
  54. ## Create, read, write, and delete
  55. ## amavis spool files.
  56. ## </summary>
  57. ## <param name="domain">
  58. ## <summary>
  59. ## Domain allowed access.
  60. ## </summary>
  61. ## </param>
  62. #
  63. interface(`amavis_manage_spool_files',`
  64. gen_require(`
  65. type amavis_spool_t;
  66. ')
  67. files_search_spool($1)
  68. manage_dirs_pattern($1, amavis_spool_t, amavis_spool_t)
  69. manage_files_pattern($1, amavis_spool_t, amavis_spool_t)
  70. ')
  71. ########################################
  72. ## <summary>
  73. ## Create objects in the amavis spool directories
  74. ## with a private type.
  75. ## </summary>
  76. ## <param name="domain">
  77. ## <summary>
  78. ## Domain allowed access.
  79. ## </summary>
  80. ## </param>
  81. ## <param name="private_type">
  82. ## <summary>
  83. ## Private file type.
  84. ## </summary>
  85. ## </param>
  86. ## <param name="object_class">
  87. ## <summary>
  88. ## Class of the object being created.
  89. ## </summary>
  90. ## </param>
  91. ## <param name="name" optional="true">
  92. ## <summary>
  93. ## The name of the object being created.
  94. ## </summary>
  95. ## </param>
  96. #
  97. interface(`amavis_spool_filetrans',`
  98. gen_require(`
  99. type amavis_spool_t;
  100. ')
  101. files_search_spool($1)
  102. filetrans_pattern($1, amavis_spool_t, $2, $3, $4)
  103. ')
  104. ########################################
  105. ## <summary>
  106. ## Search amavis lib directories.
  107. ## </summary>
  108. ## <param name="domain">
  109. ## <summary>
  110. ## Domain allowed access.
  111. ## </summary>
  112. ## </param>
  113. #
  114. interface(`amavis_search_lib',`
  115. gen_require(`
  116. type amavis_var_lib_t;
  117. ')
  118. allow $1 amavis_var_lib_t:dir search_dir_perms;
  119. files_search_var_lib($1)
  120. ')
  121. ########################################
  122. ## <summary>
  123. ## Read amavis lib files.
  124. ## </summary>
  125. ## <param name="domain">
  126. ## <summary>
  127. ## Domain allowed access.
  128. ## </summary>
  129. ## </param>
  130. #
  131. interface(`amavis_read_lib_files',`
  132. gen_require(`
  133. type amavis_var_lib_t;
  134. ')
  135. read_files_pattern($1, amavis_var_lib_t, amavis_var_lib_t)
  136. allow $1 amavis_var_lib_t:dir list_dir_perms;
  137. files_search_var_lib($1)
  138. ')
  139. ########################################
  140. ## <summary>
  141. ## Create, read, write, and delete
  142. ## amavis lib files.
  143. ## </summary>
  144. ## <param name="domain">
  145. ## <summary>
  146. ## Domain allowed access.
  147. ## </summary>
  148. ## </param>
  149. #
  150. interface(`amavis_manage_lib_files',`
  151. gen_require(`
  152. type amavis_var_lib_t;
  153. ')
  154. manage_files_pattern($1, amavis_var_lib_t, amavis_var_lib_t)
  155. files_search_var_lib($1)
  156. ')
  157. ########################################
  158. ## <summary>
  159. ## Set attributes of amavis pid files.
  160. ## </summary>
  161. ## <param name="domain">
  162. ## <summary>
  163. ## Domain allowed access.
  164. ## </summary>
  165. ## </param>
  166. #
  167. interface(`amavis_setattr_pid_files',`
  168. gen_require(`
  169. type amavis_var_run_t;
  170. ')
  171. allow $1 amavis_var_run_t:file setattr_file_perms;
  172. files_search_pids($1)
  173. ')
  174. ########################################
  175. ## <summary>
  176. ## Create amavis pid files.
  177. ## </summary>
  178. ## <param name="domain">
  179. ## <summary>
  180. ## Domain allowed access.
  181. ## </summary>
  182. ## </param>
  183. #
  184. interface(`amavis_create_pid_files',`
  185. gen_require(`
  186. type amavis_var_run_t;
  187. ')
  188. allow $1 amavis_var_run_t:dir add_entry_dir_perms;
  189. allow $1 amavis_var_run_t:file create_file_perms;
  190. files_search_pids($1)
  191. ')
  192. ########################################
  193. ## <summary>
  194. ## All of the rules required to
  195. ## administrate an amavis environment.
  196. ## </summary>
  197. ## <param name="domain">
  198. ## <summary>
  199. ## Domain allowed access.
  200. ## </summary>
  201. ## </param>
  202. ## <param name="role">
  203. ## <summary>
  204. ## Role allowed access.
  205. ## </summary>
  206. ## </param>
  207. ## <rolecap/>
  208. #
  209. interface(`amavis_admin',`
  210. gen_require(`
  211. type amavis_t, amavis_tmp_t, amavis_var_log_t;
  212. type amavis_spool_t, amavis_var_lib_t, amavis_var_run_t;
  213. type amavis_etc_t, amavis_quarantine_t, amavis_initrc_exec_t;
  214. ')
  215. allow $1 amavis_t:process { ptrace signal_perms };
  216. ps_process_pattern($1, amavis_t)
  217. amavis_initrc_domtrans($1)
  218. domain_system_change_exemption($1)
  219. role_transition $2 amavis_initrc_exec_t system_r;
  220. allow $2 system_r;
  221. files_list_etc($1)
  222. admin_pattern($1, amavis_etc_t)
  223. admin_pattern($1, amavis_quarantine_t)
  224. files_list_spool($1)
  225. admin_pattern($1, amavis_spool_t)
  226. files_list_tmp($1)
  227. admin_pattern($1, amavis_tmp_t)
  228. files_list_var_lib($1)
  229. admin_pattern($1, amavis_var_lib_t)
  230. logging_list_logs($1)
  231. admin_pattern($1, amavis_var_log_t)
  232. files_list_pids($1)
  233. admin_pattern($1, amavis_var_run_t)
  234. ')