dovecot.if 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. ## <summary>POP and IMAP mail server.</summary>
  2. #######################################
  3. ## <summary>
  4. ## Connect to dovecot using a unix
  5. ## domain stream socket.
  6. ## </summary>
  7. ## <param name="domain">
  8. ## <summary>
  9. ## Domain allowed access.
  10. ## </summary>
  11. ## </param>
  12. #
  13. interface(`dovecot_stream_connect',`
  14. gen_require(`
  15. type dovecot_t, dovecot_var_run_t;
  16. ')
  17. files_search_pids($1)
  18. stream_connect_pattern($1, dovecot_var_run_t, dovecot_var_run_t, dovecot_t)
  19. ')
  20. ########################################
  21. ## <summary>
  22. ## Connect to dovecot using a unix
  23. ## domain stream socket.
  24. ## </summary>
  25. ## <param name="domain">
  26. ## <summary>
  27. ## Domain allowed access.
  28. ## </summary>
  29. ## </param>
  30. ## <rolecap/>
  31. #
  32. interface(`dovecot_stream_connect_auth',`
  33. gen_require(`
  34. type dovecot_auth_t, dovecot_var_run_t;
  35. ')
  36. files_search_pids($1)
  37. stream_connect_pattern($1, dovecot_var_run_t, dovecot_var_run_t, dovecot_auth_t)
  38. ')
  39. ########################################
  40. ## <summary>
  41. ## Execute dovecot_deliver in the
  42. ## dovecot_deliver domain.
  43. ## </summary>
  44. ## <param name="domain">
  45. ## <summary>
  46. ## Domain allowed to transition.
  47. ## </summary>
  48. ## </param>
  49. #
  50. interface(`dovecot_domtrans_deliver',`
  51. gen_require(`
  52. type dovecot_deliver_t, dovecot_deliver_exec_t;
  53. ')
  54. corecmd_search_bin($1)
  55. domtrans_pattern($1, dovecot_deliver_exec_t, dovecot_deliver_t)
  56. ')
  57. ########################################
  58. ## <summary>
  59. ## Create, read, write, and delete
  60. ## dovecot spool files.
  61. ## </summary>
  62. ## <param name="domain">
  63. ## <summary>
  64. ## Domain allowed access.
  65. ## </summary>
  66. ## </param>
  67. #
  68. interface(`dovecot_manage_spool',`
  69. gen_require(`
  70. type dovecot_spool_t;
  71. ')
  72. files_search_spool($1)
  73. allow $1 dovecot_spool_t:dir manage_dir_perms;
  74. allow $1 dovecot_spool_t:file manage_file_perms;
  75. allow $1 dovecot_spool_t:lnk_file manage_lnk_file_perms;
  76. ')
  77. ########################################
  78. ## <summary>
  79. ## Do not audit attempts to delete
  80. ## dovecot lib files.
  81. ## </summary>
  82. ## <param name="domain">
  83. ## <summary>
  84. ## Domain to not audit.
  85. ## </summary>
  86. ## </param>
  87. #
  88. interface(`dovecot_dontaudit_unlink_lib_files',`
  89. gen_require(`
  90. type dovecot_var_lib_t;
  91. ')
  92. dontaudit $1 dovecot_var_lib_t:file delete_file_perms;
  93. ')
  94. ######################################
  95. ## <summary>
  96. ## Write inherited dovecot tmp files.
  97. ## </summary>
  98. ## <param name="domain">
  99. ## <summary>
  100. ## Domain to not audit.
  101. ## </summary>
  102. ## </param>
  103. #
  104. interface(`dovecot_write_inherited_tmp_files',`
  105. gen_require(`
  106. type dovecot_tmp_t;
  107. ')
  108. allow $1 dovecot_tmp_t:file write;
  109. ')
  110. ########################################
  111. ## <summary>
  112. ## All of the rules required to
  113. ## administrate an dovecot environment.
  114. ## </summary>
  115. ## <param name="domain">
  116. ## <summary>
  117. ## Domain allowed access.
  118. ## </summary>
  119. ## </param>
  120. ## <param name="role">
  121. ## <summary>
  122. ## Role allowed access.
  123. ## </summary>
  124. ## </param>
  125. ## <rolecap/>
  126. #
  127. interface(`dovecot_admin',`
  128. gen_require(`
  129. type dovecot_t, dovecot_etc_t, dovecot_var_log_t;
  130. type dovecot_spool_t, dovecot_var_lib_t, dovecot_initrc_exec_t;
  131. type dovecot_var_run_t, dovecot_cert_t, dovecot_passwd_t;
  132. type dovecot_tmp_t, dovecot_auth_tmp_t, dovecot_deliver_tmp_t;
  133. type dovecot_keytab_t;
  134. ')
  135. allow $1 dovecot_t:process { ptrace signal_perms };
  136. ps_process_pattern($1, dovecot_t)
  137. init_labeled_script_domtrans($1, dovecot_initrc_exec_t)
  138. domain_system_change_exemption($1)
  139. role_transition $2 dovecot_initrc_exec_t system_r;
  140. allow $2 system_r;
  141. files_list_etc($1)
  142. admin_pattern($1, { dovecot_keytab_t dovecot_etc_t })
  143. logging_list_logs($1)
  144. admin_pattern($1, dovecot_var_log_t)
  145. files_list_spool($1)
  146. admin_pattern($1, dovecot_spool_t)
  147. files_search_tmp($1)
  148. admin_pattern($1, { dovecot_tmp_t dovecot_auth_tmp_t dovecot_deliver_tmp_t })
  149. files_list_var_lib($1)
  150. admin_pattern($1, dovecot_var_lib_t)
  151. files_list_pids($1)
  152. admin_pattern($1, dovecot_var_run_t)
  153. admin_pattern($1, { dovecot_cert_t dovecot_passwd_t })
  154. ')