amavis.te 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. policy_module(amavis, 1.15.3)
  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. ########################################
  33. #
  34. # Local policy
  35. #
  36. allow amavis_t self:capability { kill chown dac_override setgid setuid };
  37. dontaudit amavis_t self:capability sys_tty_config;
  38. allow amavis_t self:process signal_perms;
  39. allow amavis_t self:fifo_file rw_fifo_file_perms;
  40. allow amavis_t self:unix_stream_socket { accept connectto listen };
  41. allow amavis_t self:tcp_socket { listen accept };
  42. allow amavis_t amavis_etc_t:dir list_dir_perms;
  43. read_files_pattern(amavis_t, amavis_etc_t, amavis_etc_t)
  44. read_lnk_files_pattern(amavis_t, amavis_etc_t, amavis_etc_t)
  45. manage_dirs_pattern(amavis_t, amavis_quarantine_t, amavis_quarantine_t)
  46. manage_files_pattern(amavis_t, amavis_quarantine_t, amavis_quarantine_t)
  47. manage_sock_files_pattern(amavis_t, amavis_quarantine_t, amavis_quarantine_t)
  48. manage_dirs_pattern(amavis_t, amavis_spool_t, amavis_spool_t)
  49. manage_files_pattern(amavis_t, amavis_spool_t, amavis_spool_t)
  50. manage_lnk_files_pattern(amavis_t, amavis_spool_t, amavis_spool_t)
  51. manage_sock_files_pattern(amavis_t, amavis_spool_t, amavis_spool_t)
  52. filetrans_pattern(amavis_t, amavis_spool_t, amavis_var_run_t, sock_file)
  53. manage_files_pattern(amavis_t, amavis_tmp_t, amavis_tmp_t)
  54. allow amavis_t amavis_tmp_t:dir setattr_dir_perms;
  55. files_tmp_filetrans(amavis_t, amavis_tmp_t, file)
  56. manage_dirs_pattern(amavis_t, amavis_var_lib_t, amavis_var_lib_t)
  57. manage_files_pattern(amavis_t, amavis_var_lib_t, amavis_var_lib_t)
  58. manage_lnk_files_pattern(amavis_t, amavis_var_lib_t, amavis_var_lib_t)
  59. manage_sock_files_pattern(amavis_t, amavis_var_lib_t, amavis_var_lib_t)
  60. allow amavis_t amavis_var_log_t:dir setattr_dir_perms;
  61. manage_files_pattern(amavis_t, amavis_var_log_t, amavis_var_log_t)
  62. manage_sock_files_pattern(amavis_t, amavis_var_log_t, amavis_var_log_t)
  63. logging_log_filetrans(amavis_t, amavis_var_log_t, { sock_file file dir })
  64. manage_dirs_pattern(amavis_t, amavis_var_run_t, amavis_var_run_t)
  65. manage_files_pattern(amavis_t, amavis_var_run_t, amavis_var_run_t)
  66. manage_sock_files_pattern(amavis_t, amavis_var_run_t, amavis_var_run_t)
  67. files_pid_filetrans(amavis_t, amavis_var_run_t, { dir file sock_file })
  68. can_exec(amavis_t, amavis_exec_t)
  69. kernel_read_kernel_sysctls(amavis_t)
  70. kernel_read_system_state(amavis_t)
  71. kernel_dontaudit_list_proc(amavis_t)
  72. kernel_dontaudit_read_proc_symlinks(amavis_t)
  73. corecmd_exec_bin(amavis_t)
  74. corecmd_exec_shell(amavis_t)
  75. corenet_all_recvfrom_unlabeled(amavis_t)
  76. corenet_all_recvfrom_netlabel(amavis_t)
  77. corenet_tcp_sendrecv_generic_if(amavis_t)
  78. corenet_udp_sendrecv_generic_if(amavis_t)
  79. corenet_tcp_sendrecv_generic_node(amavis_t)
  80. corenet_udp_sendrecv_generic_node(amavis_t)
  81. corenet_tcp_sendrecv_all_ports(amavis_t)
  82. corenet_udp_sendrecv_all_ports(amavis_t)
  83. corenet_tcp_bind_generic_node(amavis_t)
  84. corenet_udp_bind_generic_node(amavis_t)
  85. corenet_sendrecv_amavisd_send_client_packets(amavis_t)
  86. corenet_tcp_connect_amavisd_send_port(amavis_t)
  87. corenet_sendrecv_amavisd_recv_server_packets(amavis_t)
  88. corenet_tcp_bind_amavisd_recv_port(amavis_t)
  89. corenet_sendrecv_generic_server_packets(amavis_t)
  90. corenet_udp_bind_generic_port(amavis_t)
  91. corenet_dontaudit_udp_bind_all_ports(amavis_t)
  92. corenet_sendrecv_razor_client_packets(amavis_t)
  93. corenet_tcp_connect_razor_port(amavis_t)
  94. dev_read_rand(amavis_t)
  95. dev_read_sysfs(amavis_t)
  96. dev_read_urand(amavis_t)
  97. domain_use_interactive_fds(amavis_t)
  98. domain_dontaudit_read_all_domains_state(amavis_t)
  99. files_read_etc_runtime_files(amavis_t)
  100. files_read_usr_files(amavis_t)
  101. files_search_spool(amavis_t)
  102. fs_getattr_xattr_fs(amavis_t)
  103. auth_use_nsswitch(amavis_t)
  104. auth_dontaudit_read_shadow(amavis_t)
  105. init_read_state(amavis_t)
  106. init_read_utmp(amavis_t)
  107. init_stream_connect_script(amavis_t)
  108. logging_send_syslog_msg(amavis_t)
  109. miscfiles_read_localization(amavis_t)
  110. userdom_dontaudit_search_user_home_dirs(amavis_t)
  111. hostname_domtrans(amavis_t)
  112. gen_require(`
  113. type lib_t;
  114. ')
  115. allow amavis_t lib_t:file execute_no_trans;
  116. tunable_policy(`amavis_use_jit',`
  117. allow amavis_t self:process execmem;
  118. ',`
  119. dontaudit amavis_t self:process execmem;
  120. ')
  121. optional_policy(`
  122. clamav_stream_connect(amavis_t)
  123. clamav_domtrans_clamscan(amavis_t)
  124. clamav_read_state_clamd(amavis_t)
  125. ')
  126. optional_policy(`
  127. cron_use_fds(amavis_t)
  128. cron_use_system_job_fds(amavis_t)
  129. cron_rw_pipes(amavis_t)
  130. ')
  131. optional_policy(`
  132. dcc_domtrans_client(amavis_t)
  133. dcc_stream_connect_dccifd(amavis_t)
  134. ')
  135. optional_policy(`
  136. mta_read_config(amavis_t)
  137. ')
  138. optional_policy(`
  139. postfix_read_config(amavis_t)
  140. postfix_list_spool(amavis_t)
  141. ')
  142. optional_policy(`
  143. pyzor_domtrans(amavis_t)
  144. pyzor_signal(amavis_t)
  145. ')
  146. optional_policy(`
  147. razor_domtrans(amavis_t)
  148. ')
  149. optional_policy(`
  150. snmp_manage_var_lib_dirs(amavis_t)
  151. snmp_manage_var_lib_files(amavis_t)
  152. snmp_stream_connect(amavis_t)
  153. ')
  154. optional_policy(`
  155. spamassassin_exec(amavis_t)
  156. spamassassin_exec_client(amavis_t)
  157. spamassassin_read_lib_files(amavis_t)
  158. ')