amavis.te 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. policy_module(amavis, 1.15.2)
  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_sock_files_pattern(amavis_t, amavis_var_lib_t, amavis_var_lib_t)
  59. allow amavis_t amavis_var_log_t:dir setattr_dir_perms;
  60. manage_files_pattern(amavis_t, amavis_var_log_t, amavis_var_log_t)
  61. manage_sock_files_pattern(amavis_t, amavis_var_log_t, amavis_var_log_t)
  62. logging_log_filetrans(amavis_t, amavis_var_log_t, { sock_file file dir })
  63. manage_dirs_pattern(amavis_t, amavis_var_run_t, amavis_var_run_t)
  64. manage_files_pattern(amavis_t, amavis_var_run_t, amavis_var_run_t)
  65. manage_sock_files_pattern(amavis_t, amavis_var_run_t, amavis_var_run_t)
  66. files_pid_filetrans(amavis_t, amavis_var_run_t, { dir file sock_file })
  67. can_exec(amavis_t, amavis_exec_t)
  68. kernel_read_kernel_sysctls(amavis_t)
  69. kernel_read_system_state(amavis_t)
  70. kernel_dontaudit_list_proc(amavis_t)
  71. kernel_dontaudit_read_proc_symlinks(amavis_t)
  72. corecmd_exec_bin(amavis_t)
  73. corecmd_exec_shell(amavis_t)
  74. corenet_all_recvfrom_unlabeled(amavis_t)
  75. corenet_all_recvfrom_netlabel(amavis_t)
  76. corenet_tcp_sendrecv_generic_if(amavis_t)
  77. corenet_udp_sendrecv_generic_if(amavis_t)
  78. corenet_tcp_sendrecv_generic_node(amavis_t)
  79. corenet_udp_sendrecv_generic_node(amavis_t)
  80. corenet_tcp_sendrecv_all_ports(amavis_t)
  81. corenet_udp_sendrecv_all_ports(amavis_t)
  82. corenet_tcp_bind_generic_node(amavis_t)
  83. corenet_udp_bind_generic_node(amavis_t)
  84. corenet_sendrecv_amavisd_send_client_packets(amavis_t)
  85. corenet_tcp_connect_amavisd_send_port(amavis_t)
  86. corenet_sendrecv_amavisd_recv_server_packets(amavis_t)
  87. corenet_tcp_bind_amavisd_recv_port(amavis_t)
  88. corenet_sendrecv_generic_server_packets(amavis_t)
  89. corenet_udp_bind_generic_port(amavis_t)
  90. corenet_dontaudit_udp_bind_all_ports(amavis_t)
  91. corenet_sendrecv_razor_client_packets(amavis_t)
  92. corenet_tcp_connect_razor_port(amavis_t)
  93. dev_read_rand(amavis_t)
  94. dev_read_sysfs(amavis_t)
  95. dev_read_urand(amavis_t)
  96. domain_use_interactive_fds(amavis_t)
  97. domain_dontaudit_read_all_domains_state(amavis_t)
  98. files_read_etc_runtime_files(amavis_t)
  99. files_read_usr_files(amavis_t)
  100. files_search_spool(amavis_t)
  101. fs_getattr_xattr_fs(amavis_t)
  102. auth_use_nsswitch(amavis_t)
  103. auth_dontaudit_read_shadow(amavis_t)
  104. init_read_state(amavis_t)
  105. init_read_utmp(amavis_t)
  106. init_stream_connect_script(amavis_t)
  107. logging_send_syslog_msg(amavis_t)
  108. miscfiles_read_localization(amavis_t)
  109. userdom_dontaudit_search_user_home_dirs(amavis_t)
  110. hostname_domtrans(amavis_t)
  111. gen_require(`
  112. type lib_t;
  113. ')
  114. allow amavis_t lib_t:file execute_no_trans;
  115. tunable_policy(`amavis_use_jit',`
  116. allow amavis_t self:process execmem;
  117. ',`
  118. dontaudit amavis_t self:process execmem;
  119. ')
  120. optional_policy(`
  121. clamav_stream_connect(amavis_t)
  122. clamav_domtrans_clamscan(amavis_t)
  123. clamav_read_state_clamd(amavis_t)
  124. ')
  125. optional_policy(`
  126. cron_use_fds(amavis_t)
  127. cron_use_system_job_fds(amavis_t)
  128. cron_rw_pipes(amavis_t)
  129. ')
  130. optional_policy(`
  131. dcc_domtrans_client(amavis_t)
  132. dcc_stream_connect_dccifd(amavis_t)
  133. ')
  134. optional_policy(`
  135. mta_read_config(amavis_t)
  136. ')
  137. optional_policy(`
  138. postfix_read_config(amavis_t)
  139. postfix_list_spool(amavis_t)
  140. ')
  141. optional_policy(`
  142. pyzor_domtrans(amavis_t)
  143. pyzor_signal(amavis_t)
  144. ')
  145. optional_policy(`
  146. razor_domtrans(amavis_t)
  147. ')
  148. optional_policy(`
  149. snmp_manage_var_lib_dirs(amavis_t)
  150. snmp_manage_var_lib_files(amavis_t)
  151. snmp_stream_connect(amavis_t)
  152. ')
  153. optional_policy(`
  154. spamassassin_exec(amavis_t)
  155. spamassassin_exec_client(amavis_t)
  156. spamassassin_read_lib_files(amavis_t)
  157. ')