amavis.te 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. policy_module(amavis, 1.15.6)
  2. ########################################
  3. #
  4. # Declarations
  5. #
  6. ## <desc>
  7. ## <p>
  8. ## Determine whether amavis can
  9. ## use JIT compiler.
  10. ## </p>
  11. ## </desc>
  12. gen_tunable(amavis_use_jit, false)
  13. type amavis_t;
  14. type amavis_exec_t;
  15. init_daemon_domain(amavis_t, amavis_exec_t)
  16. type amavis_etc_t;
  17. files_config_file(amavis_etc_t)
  18. type amavis_initrc_exec_t;
  19. init_script_file(amavis_initrc_exec_t)
  20. type amavis_var_run_t;
  21. files_pid_file(amavis_var_run_t)
  22. type amavis_var_lib_t;
  23. files_type(amavis_var_lib_t)
  24. type amavis_var_log_t;
  25. logging_log_file(amavis_var_log_t)
  26. type amavis_tmp_t;
  27. files_tmp_file(amavis_tmp_t)
  28. type amavis_quarantine_t;
  29. files_type(amavis_quarantine_t)
  30. type amavis_spool_t;
  31. files_type(amavis_spool_t)
  32. type amavis_unit_t;
  33. init_unit_file(amavis_unit_t)
  34. ########################################
  35. #
  36. # Local policy
  37. #
  38. allow amavis_t amavis_var_lib_t:file map;
  39. allow amavis_t self:capability { kill chown dac_override setgid setuid };
  40. dontaudit amavis_t self:capability sys_tty_config;
  41. allow amavis_t self:process signal_perms;
  42. allow amavis_t self:fifo_file rw_fifo_file_perms;
  43. allow amavis_t self:unix_stream_socket { accept connectto listen };
  44. allow amavis_t self:tcp_socket { listen accept };
  45. allow amavis_t amavis_etc_t:dir list_dir_perms;
  46. read_files_pattern(amavis_t, amavis_etc_t, amavis_etc_t)
  47. read_lnk_files_pattern(amavis_t, amavis_etc_t, amavis_etc_t)
  48. manage_dirs_pattern(amavis_t, amavis_quarantine_t, amavis_quarantine_t)
  49. manage_files_pattern(amavis_t, amavis_quarantine_t, amavis_quarantine_t)
  50. manage_sock_files_pattern(amavis_t, amavis_quarantine_t, amavis_quarantine_t)
  51. manage_dirs_pattern(amavis_t, amavis_spool_t, amavis_spool_t)
  52. manage_files_pattern(amavis_t, amavis_spool_t, amavis_spool_t)
  53. manage_lnk_files_pattern(amavis_t, amavis_spool_t, amavis_spool_t)
  54. manage_sock_files_pattern(amavis_t, amavis_spool_t, amavis_spool_t)
  55. filetrans_pattern(amavis_t, amavis_spool_t, amavis_var_run_t, sock_file)
  56. manage_files_pattern(amavis_t, amavis_tmp_t, amavis_tmp_t)
  57. allow amavis_t amavis_tmp_t:dir setattr_dir_perms;
  58. files_tmp_filetrans(amavis_t, amavis_tmp_t, file)
  59. manage_dirs_pattern(amavis_t, amavis_var_lib_t, amavis_var_lib_t)
  60. manage_files_pattern(amavis_t, amavis_var_lib_t, amavis_var_lib_t)
  61. manage_lnk_files_pattern(amavis_t, amavis_var_lib_t, amavis_var_lib_t)
  62. manage_sock_files_pattern(amavis_t, amavis_var_lib_t, amavis_var_lib_t)
  63. allow amavis_t amavis_var_log_t:dir setattr_dir_perms;
  64. manage_files_pattern(amavis_t, amavis_var_log_t, amavis_var_log_t)
  65. manage_sock_files_pattern(amavis_t, amavis_var_log_t, amavis_var_log_t)
  66. logging_log_filetrans(amavis_t, amavis_var_log_t, { sock_file file dir })
  67. manage_dirs_pattern(amavis_t, amavis_var_run_t, amavis_var_run_t)
  68. manage_files_pattern(amavis_t, amavis_var_run_t, amavis_var_run_t)
  69. manage_sock_files_pattern(amavis_t, amavis_var_run_t, amavis_var_run_t)
  70. files_pid_filetrans(amavis_t, amavis_var_run_t, { dir file sock_file })
  71. can_exec(amavis_t, amavis_exec_t)
  72. kernel_read_kernel_sysctls(amavis_t)
  73. kernel_read_system_state(amavis_t)
  74. kernel_dontaudit_list_proc(amavis_t)
  75. kernel_dontaudit_read_proc_symlinks(amavis_t)
  76. corecmd_exec_bin(amavis_t)
  77. corecmd_exec_shell(amavis_t)
  78. corenet_all_recvfrom_unlabeled(amavis_t)
  79. corenet_all_recvfrom_netlabel(amavis_t)
  80. corenet_tcp_sendrecv_generic_if(amavis_t)
  81. corenet_udp_sendrecv_generic_if(amavis_t)
  82. corenet_tcp_sendrecv_generic_node(amavis_t)
  83. corenet_udp_sendrecv_generic_node(amavis_t)
  84. corenet_tcp_sendrecv_all_ports(amavis_t)
  85. corenet_udp_sendrecv_all_ports(amavis_t)
  86. corenet_tcp_bind_generic_node(amavis_t)
  87. corenet_udp_bind_generic_node(amavis_t)
  88. corenet_sendrecv_amavisd_send_client_packets(amavis_t)
  89. corenet_tcp_connect_amavisd_send_port(amavis_t)
  90. corenet_sendrecv_amavisd_recv_server_packets(amavis_t)
  91. corenet_tcp_bind_amavisd_recv_port(amavis_t)
  92. corenet_sendrecv_generic_server_packets(amavis_t)
  93. corenet_udp_bind_generic_port(amavis_t)
  94. corenet_dontaudit_udp_bind_all_ports(amavis_t)
  95. corenet_sendrecv_razor_client_packets(amavis_t)
  96. corenet_tcp_connect_razor_port(amavis_t)
  97. dev_read_rand(amavis_t)
  98. dev_read_sysfs(amavis_t)
  99. dev_read_urand(amavis_t)
  100. domain_use_interactive_fds(amavis_t)
  101. domain_dontaudit_read_all_domains_state(amavis_t)
  102. files_read_etc_runtime_files(amavis_t)
  103. files_read_usr_files(amavis_t)
  104. files_search_spool(amavis_t)
  105. fs_getattr_xattr_fs(amavis_t)
  106. auth_use_nsswitch(amavis_t)
  107. auth_dontaudit_read_shadow(amavis_t)
  108. init_read_state(amavis_t)
  109. init_read_utmp(amavis_t)
  110. init_stream_connect_script(amavis_t)
  111. logging_send_syslog_msg(amavis_t)
  112. miscfiles_read_localization(amavis_t)
  113. userdom_dontaudit_search_user_home_dirs(amavis_t)
  114. hostname_domtrans(amavis_t)
  115. gen_require(`
  116. type lib_t;
  117. ')
  118. allow amavis_t lib_t:file execute_no_trans;
  119. gen_require(`
  120. type usr_t;
  121. ')
  122. allow amavis_t usr_t:file map;
  123. tunable_policy(`amavis_use_jit',`
  124. allow amavis_t self:process execmem;
  125. ',`
  126. dontaudit amavis_t self:process execmem;
  127. ')
  128. optional_policy(`
  129. clamav_stream_connect(amavis_t)
  130. clamav_domtrans_clamscan(amavis_t)
  131. clamav_read_state_clamd(amavis_t)
  132. ')
  133. optional_policy(`
  134. cron_use_fds(amavis_t)
  135. cron_use_system_job_fds(amavis_t)
  136. cron_rw_pipes(amavis_t)
  137. ')
  138. optional_policy(`
  139. dcc_domtrans_client(amavis_t)
  140. dcc_stream_connect_dccifd(amavis_t)
  141. ')
  142. optional_policy(`
  143. mta_read_config(amavis_t)
  144. ')
  145. optional_policy(`
  146. postfix_read_config(amavis_t)
  147. postfix_list_spool(amavis_t)
  148. ')
  149. optional_policy(`
  150. pyzor_domtrans(amavis_t)
  151. pyzor_signal(amavis_t)
  152. ')
  153. optional_policy(`
  154. razor_domtrans(amavis_t)
  155. ')
  156. optional_policy(`
  157. snmp_manage_var_lib_dirs(amavis_t)
  158. snmp_manage_var_lib_files(amavis_t)
  159. snmp_stream_connect(amavis_t)
  160. ')
  161. optional_policy(`
  162. spamassassin_exec(amavis_t)
  163. spamassassin_exec_client(amavis_t)
  164. spamassassin_read_lib_files(amavis_t)
  165. ')