amavis.te 5.5 KB

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