postfix.te 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834
  1. policy_module(postfix, 1.17.1)
  2. ########################################
  3. #
  4. # Declarations
  5. #
  6. ## <desc>
  7. ## <p>
  8. ## Determine whether postfix local
  9. ## can manage mail spool content.
  10. ## </p>
  11. ## </desc>
  12. gen_tunable(postfix_local_write_mail_spool, true)
  13. attribute postfix_domain;
  14. attribute postfix_server_domain;
  15. attribute postfix_server_tmp_content;
  16. attribute postfix_spool_type;
  17. attribute postfix_user_domains;
  18. attribute postfix_user_domtrans;
  19. attribute_role postfix_map_roles;
  20. roleattribute system_r postfix_map_roles;
  21. postfix_server_domain_template(bounce)
  22. type postfix_spool_bounce_t, postfix_spool_type;
  23. files_type(postfix_spool_bounce_t)
  24. postfix_server_domain_template(cleanup)
  25. type postfix_etc_t;
  26. files_config_file(postfix_etc_t)
  27. type postfix_exec_t;
  28. application_executable_file(postfix_exec_t)
  29. type postfix_keytab_t;
  30. files_type(postfix_keytab_t)
  31. postfix_server_domain_template(local)
  32. mta_mailserver_delivery(postfix_local_t)
  33. type postfix_map_t;
  34. type postfix_map_exec_t;
  35. application_domain(postfix_map_t, postfix_map_exec_t)
  36. role postfix_map_roles types postfix_map_t;
  37. type postfix_map_tmp_t;
  38. files_tmp_file(postfix_map_tmp_t)
  39. postfix_domain_template(master)
  40. typealias postfix_master_t alias postfix_t;
  41. mta_mailserver(postfix_t, postfix_master_exec_t)
  42. type postfix_initrc_exec_t;
  43. init_script_file(postfix_initrc_exec_t)
  44. postfix_server_domain_template(pickup)
  45. postfix_server_domain_template(pipe)
  46. postfix_user_domain_template(postdrop)
  47. mta_mailserver_user_agent(postfix_postdrop_t)
  48. postfix_user_domain_template(postqueue)
  49. mta_mailserver_user_agent(postfix_postqueue_t)
  50. type postfix_private_t;
  51. files_type(postfix_private_t)
  52. type postfix_prng_t;
  53. files_type(postfix_prng_t)
  54. postfix_server_domain_template(qmgr)
  55. postfix_user_domain_template(showq)
  56. postfix_server_domain_template(smtp)
  57. mta_mailserver_sender(postfix_smtp_t)
  58. postfix_server_domain_template(smtpd)
  59. type postfix_spool_t, postfix_spool_type;
  60. files_type(postfix_spool_t)
  61. type postfix_spool_maildrop_t, postfix_spool_type;
  62. files_type(postfix_spool_maildrop_t)
  63. type postfix_spool_flush_t, postfix_spool_type;
  64. files_type(postfix_spool_flush_t)
  65. type postfix_public_t;
  66. files_type(postfix_public_t)
  67. type postfix_var_run_t;
  68. files_pid_file(postfix_var_run_t)
  69. type postfix_data_t;
  70. files_type(postfix_data_t)
  71. postfix_server_domain_template(virtual)
  72. mta_mailserver_delivery(postfix_virtual_t)
  73. ########################################
  74. #
  75. # Common postfix domain local policy
  76. #
  77. allow postfix_domain self:capability { sys_nice sys_chroot };
  78. dontaudit postfix_domain self:capability sys_tty_config;
  79. allow postfix_domain self:process { signal_perms setpgid setsched };
  80. allow postfix_domain self:fifo_file rw_fifo_file_perms;
  81. allow postfix_domain self:unix_stream_socket { accept connectto listen };
  82. allow postfix_domain postfix_etc_t:dir list_dir_perms;
  83. allow postfix_domain postfix_etc_t:file read_file_perms;
  84. allow postfix_domain postfix_etc_t:lnk_file read_lnk_file_perms;
  85. allow postfix_domain postfix_master_t:file read_file_perms;
  86. allow postfix_domain postfix_exec_t:file { mmap_file_perms lock };
  87. allow postfix_domain postfix_master_t:process sigchld;
  88. allow postfix_domain postfix_spool_t:dir list_dir_perms;
  89. manage_files_pattern(postfix_domain, postfix_var_run_t, postfix_var_run_t)
  90. files_pid_filetrans(postfix_domain, postfix_var_run_t, file)
  91. kernel_read_system_state(postfix_domain)
  92. kernel_read_network_state(postfix_domain)
  93. kernel_read_all_sysctls(postfix_domain)
  94. dev_read_sysfs(postfix_domain)
  95. dev_read_rand(postfix_domain)
  96. dev_read_urand(postfix_domain)
  97. fs_search_auto_mountpoints(postfix_domain)
  98. fs_getattr_all_fs(postfix_domain)
  99. fs_rw_anon_inodefs_files(postfix_domain)
  100. term_dontaudit_use_console(postfix_domain)
  101. corecmd_exec_shell(postfix_domain)
  102. corecmd_getattr_all_executables(postfix_domain)
  103. files_read_etc_runtime_files(postfix_domain)
  104. files_read_usr_files(postfix_domain)
  105. files_search_spool(postfix_domain)
  106. files_getattr_tmp_dirs(postfix_domain)
  107. files_search_all_mountpoints(postfix_domain)
  108. init_dontaudit_use_fds(postfix_domain)
  109. init_sigchld(postfix_domain)
  110. logging_send_syslog_msg(postfix_domain)
  111. miscfiles_read_localization(postfix_domain)
  112. miscfiles_read_generic_certs(postfix_domain)
  113. userdom_dontaudit_use_unpriv_user_fds(postfix_domain)
  114. optional_policy(`
  115. udev_read_db(postfix_domain)
  116. ')
  117. ########################################
  118. #
  119. # Common postfix server domain local policy
  120. #
  121. allow postfix_server_domain self:capability { setuid setgid dac_override };
  122. allow postfix_master_t self:process getsched;
  123. allow postfix_server_domain postfix_master_t:unix_stream_socket { connectto rw_stream_socket_perms };
  124. corenet_all_recvfrom_unlabeled(postfix_server_domain)
  125. corenet_all_recvfrom_netlabel(postfix_server_domain)
  126. corenet_tcp_sendrecv_generic_if(postfix_server_domain)
  127. corenet_tcp_sendrecv_generic_node(postfix_server_domain)
  128. corenet_tcp_bind_all_unreserved_ports(postfix_master_t)
  129. corenet_sendrecv_all_client_packets(postfix_server_domain)
  130. corenet_tcp_connect_all_ports(postfix_server_domain)
  131. corenet_tcp_sendrecv_all_ports(postfix_server_domain)
  132. ########################################
  133. #
  134. # Common postfix user domain local policy
  135. #
  136. allow postfix_user_domains self:capability dac_override;
  137. domain_use_interactive_fds(postfix_user_domains)
  138. ########################################
  139. #
  140. # Master local policy
  141. #
  142. allow postfix_master_t self:capability { chown dac_override kill fowner setgid setuid sys_tty_config };
  143. allow postfix_master_t self:capability2 block_suspend;
  144. allow postfix_master_t self:process setrlimit;
  145. allow postfix_master_t self:tcp_socket create_stream_socket_perms;
  146. allow postfix_master_t self:udp_socket create_socket_perms;
  147. allow postfix_master_t postfix_domain:fifo_file rw_fifo_file_perms;
  148. allow postfix_master_t postfix_domain:process signal;
  149. allow postfix_master_t postfix_etc_t:dir rw_dir_perms;
  150. allow postfix_master_t postfix_etc_t:file rw_file_perms;
  151. allow postfix_master_t postfix_data_t:dir manage_dir_perms;
  152. allow postfix_master_t postfix_data_t:file manage_file_perms;
  153. allow postfix_master_t postfix_keytab_t:file read_file_perms;
  154. allow postfix_master_t postfix_map_exec_t:file { mmap_file_perms ioctl lock };
  155. allow postfix_master_t { postfix_postdrop_exec_t postfix_postqueue_exec_t }:file getattr_file_perms;
  156. allow postfix_master_t postfix_prng_t:file rw_file_perms;
  157. manage_dirs_pattern(postfix_master_t, postfix_spool_t, postfix_spool_t)
  158. manage_files_pattern(postfix_master_t, postfix_spool_t, postfix_spool_t)
  159. files_spool_filetrans(postfix_master_t, postfix_spool_t, dir)
  160. allow postfix_master_t postfix_spool_bounce_t:dir manage_dir_perms;
  161. allow postfix_master_t postfix_spool_bounce_t:file getattr_file_perms;
  162. filetrans_pattern(postfix_master_t, postfix_spool_t, postfix_spool_bounce_t, dir, "bounce")
  163. manage_dirs_pattern(postfix_master_t, postfix_spool_flush_t, postfix_spool_flush_t)
  164. manage_files_pattern(postfix_master_t, postfix_spool_flush_t, postfix_spool_flush_t)
  165. manage_lnk_files_pattern(postfix_master_t, postfix_spool_flush_t, postfix_spool_flush_t)
  166. filetrans_pattern(postfix_master_t, postfix_spool_t, postfix_spool_flush_t, dir, "flush")
  167. hostname_exec(postfix_master_t)
  168. create_dirs_pattern(postfix_master_t, postfix_spool_t, postfix_private_t)
  169. manage_fifo_files_pattern(postfix_master_t, postfix_private_t, postfix_private_t)
  170. manage_sock_files_pattern(postfix_master_t, postfix_private_t, postfix_private_t)
  171. setattr_dirs_pattern(postfix_master_t, postfix_private_t, postfix_private_t)
  172. filetrans_pattern(postfix_master_t, postfix_spool_t, postfix_private_t, dir, "private")
  173. create_dirs_pattern(postfix_master_t, postfix_spool_t, postfix_public_t)
  174. manage_fifo_files_pattern(postfix_master_t, postfix_public_t, postfix_public_t)
  175. manage_sock_files_pattern(postfix_master_t, postfix_public_t, postfix_public_t)
  176. setattr_dirs_pattern(postfix_master_t, postfix_public_t, postfix_public_t)
  177. filetrans_pattern(postfix_master_t, postfix_spool_t, postfix_public_t, dir, "public")
  178. create_dirs_pattern(postfix_master_t, postfix_spool_t, postfix_spool_maildrop_t)
  179. delete_files_pattern(postfix_master_t, postfix_spool_maildrop_t, postfix_spool_maildrop_t)
  180. rename_files_pattern(postfix_master_t, postfix_spool_maildrop_t, postfix_spool_maildrop_t)
  181. setattr_dirs_pattern(postfix_master_t, postfix_spool_maildrop_t, postfix_spool_maildrop_t)
  182. filetrans_pattern(postfix_master_t, postfix_spool_t, postfix_spool_maildrop_t, dir, "defer")
  183. filetrans_pattern(postfix_master_t, postfix_spool_t, postfix_spool_maildrop_t, dir, "deferred")
  184. filetrans_pattern(postfix_master_t, postfix_spool_t, postfix_spool_maildrop_t, dir, "maildrop")
  185. create_dirs_pattern(postfix_master_t, postfix_spool_t, postfix_var_run_t)
  186. setattr_dirs_pattern(postfix_master_t, postfix_var_run_t, postfix_var_run_t)
  187. filetrans_pattern(postfix_master_t, postfix_spool_t, postfix_var_run_t, dir, "pid")
  188. can_exec(postfix_master_t, postfix_exec_t)
  189. domtrans_pattern(postfix_master_t, postfix_postqueue_exec_t, postfix_postqueue_t)
  190. domtrans_pattern(postfix_master_t, postfix_showq_exec_t, postfix_showq_t)
  191. corenet_all_recvfrom_unlabeled(postfix_master_t)
  192. corenet_all_recvfrom_netlabel(postfix_master_t)
  193. corenet_tcp_sendrecv_generic_if(postfix_master_t)
  194. corenet_udp_sendrecv_generic_if(postfix_master_t)
  195. corenet_tcp_sendrecv_generic_node(postfix_master_t)
  196. corenet_udp_sendrecv_generic_node(postfix_master_t)
  197. corenet_tcp_sendrecv_all_ports(postfix_master_t)
  198. corenet_udp_sendrecv_all_ports(postfix_master_t)
  199. corenet_tcp_bind_generic_node(postfix_master_t)
  200. corenet_udp_bind_generic_node(postfix_master_t)
  201. corenet_sendrecv_amavisd_send_server_packets(postfix_master_t)
  202. corenet_tcp_bind_amavisd_send_port(postfix_master_t)
  203. corenet_sendrecv_smtp_server_packets(postfix_master_t)
  204. corenet_tcp_bind_smtp_port(postfix_master_t)
  205. corenet_sendrecv_spamd_server_packets(postfix_master_t)
  206. corenet_tcp_bind_spamd_port(postfix_master_t)
  207. corenet_sendrecv_all_client_packets(postfix_master_t)
  208. corenet_tcp_connect_all_ports(postfix_master_t)
  209. # Can this be conditional?
  210. corenet_sendrecv_all_server_packets(postfix_master_t)
  211. corenet_udp_bind_all_unreserved_ports(postfix_master_t)
  212. corenet_dontaudit_udp_bind_all_ports(postfix_master_t)
  213. selinux_dontaudit_search_fs(postfix_master_t)
  214. corecmd_exec_bin(postfix_master_t)
  215. domain_use_interactive_fds(postfix_master_t)
  216. files_search_tmp(postfix_master_t)
  217. mcs_file_read_all(postfix_master_t)
  218. term_dontaudit_search_ptys(postfix_master_t)
  219. miscfiles_read_man_pages(postfix_master_t)
  220. seutil_sigchld_newrole(postfix_master_t)
  221. seutil_dontaudit_search_config(postfix_master_t)
  222. mta_manage_aliases(postfix_master_t)
  223. mta_etc_filetrans_aliases(postfix_master_t, file, "aliases")
  224. mta_etc_filetrans_aliases(postfix_master_t, file, "aliases.db")
  225. mta_etc_filetrans_aliases(postfix_master_t, file, "aliasesdb-stamp")
  226. mta_spec_filetrans_aliases(postfix_master_t, postfix_etc_t, file)
  227. mta_read_sendmail_bin(postfix_master_t)
  228. mta_getattr_spool(postfix_master_t)
  229. optional_policy(`
  230. cyrus_stream_connect(postfix_master_t)
  231. ')
  232. optional_policy(`
  233. kerberos_read_keytab(postfix_master_t)
  234. kerberos_use(postfix_master_t)
  235. ')
  236. optional_policy(`
  237. mailman_manage_data_files(postfix_master_t)
  238. mailman_search_data(postfix_pipe_t)
  239. ')
  240. optional_policy(`
  241. milter_getattr_data_dir(postfix_master_t)
  242. ')
  243. optional_policy(`
  244. mysql_stream_connect(postfix_master_t)
  245. ')
  246. optional_policy(`
  247. postgrey_search_spool(postfix_master_t)
  248. ')
  249. optional_policy(`
  250. sendmail_signal(postfix_master_t)
  251. ')
  252. ########################################
  253. #
  254. # Bounce local policy
  255. #
  256. allow postfix_bounce_t self:capability dac_read_search;
  257. write_sock_files_pattern(postfix_bounce_t, postfix_public_t, postfix_public_t)
  258. manage_dirs_pattern(postfix_bounce_t, postfix_spool_t, postfix_spool_t)
  259. manage_files_pattern(postfix_bounce_t, postfix_spool_t, postfix_spool_t)
  260. manage_lnk_files_pattern(postfix_bounce_t, postfix_spool_t, postfix_spool_t)
  261. files_spool_filetrans(postfix_bounce_t, postfix_spool_t, dir)
  262. manage_files_pattern(postfix_bounce_t, postfix_spool_maildrop_t, postfix_spool_maildrop_t)
  263. manage_dirs_pattern(postfix_bounce_t, postfix_spool_maildrop_t, postfix_spool_maildrop_t)
  264. allow postfix_bounce_t postfix_spool_maildrop_t:lnk_file read_lnk_file_perms;
  265. manage_dirs_pattern(postfix_bounce_t, postfix_spool_bounce_t, postfix_spool_bounce_t)
  266. manage_files_pattern(postfix_bounce_t, postfix_spool_bounce_t, postfix_spool_bounce_t)
  267. manage_lnk_files_pattern(postfix_bounce_t, postfix_spool_bounce_t, postfix_spool_bounce_t)
  268. ########################################
  269. #
  270. # Cleanup local policy
  271. #
  272. allow postfix_cleanup_t self:process setrlimit;
  273. allow postfix_cleanup_t postfix_smtpd_t:tcp_socket rw_stream_socket_perms;
  274. allow postfix_cleanup_t postfix_smtpd_t:unix_stream_socket rw_socket_perms;
  275. allow postfix_cleanup_t postfix_smtpd_t:fd use;
  276. allow postfix_cleanup_t postfix_spool_maildrop_t:dir list_dir_perms;
  277. allow postfix_cleanup_t postfix_spool_maildrop_t:file read_file_perms;
  278. allow postfix_cleanup_t postfix_spool_maildrop_t:lnk_file read_lnk_file_perms;
  279. stream_connect_pattern(postfix_cleanup_t, postfix_private_t, postfix_private_t, postfix_master_t)
  280. rw_fifo_files_pattern(postfix_cleanup_t, postfix_public_t, postfix_public_t)
  281. write_sock_files_pattern(postfix_cleanup_t, postfix_public_t, postfix_public_t)
  282. manage_dirs_pattern(postfix_cleanup_t, postfix_spool_t, postfix_spool_t)
  283. manage_files_pattern(postfix_cleanup_t, postfix_spool_t, postfix_spool_t)
  284. manage_lnk_files_pattern(postfix_cleanup_t, postfix_spool_t, postfix_spool_t)
  285. files_spool_filetrans(postfix_cleanup_t, postfix_spool_t, dir)
  286. allow postfix_cleanup_t postfix_spool_bounce_t:dir list_dir_perms;
  287. corecmd_exec_bin(postfix_cleanup_t)
  288. corenet_sendrecv_kismet_client_packets(postfix_cleanup_t)
  289. corenet_tcp_connect_kismet_port(postfix_cleanup_t)
  290. corenet_tcp_sendrecv_kismet_port(postfix_cleanup_t)
  291. mta_read_aliases(postfix_cleanup_t)
  292. optional_policy(`
  293. mailman_read_data_files(postfix_cleanup_t)
  294. ')
  295. optional_policy(`
  296. dkim_stream_connect(postfix_cleanup_t)
  297. ')
  298. ########################################
  299. #
  300. # Local local policy
  301. #
  302. allow postfix_local_t self:capability chown;
  303. allow postfix_local_t self:process setrlimit;
  304. stream_connect_pattern(postfix_local_t, postfix_public_t, postfix_public_t, postfix_master_t)
  305. rw_sock_files_pattern(postfix_local_t, postfix_private_t, postfix_private_t)
  306. allow postfix_local_t postfix_spool_t:file rw_file_perms;
  307. domtrans_pattern(postfix_local_t, postfix_postdrop_exec_t, postfix_postdrop_t)
  308. corecmd_exec_bin(postfix_local_t)
  309. logging_dontaudit_search_logs(postfix_local_t)
  310. mta_delete_spool(postfix_local_t)
  311. mta_read_aliases(postfix_local_t)
  312. mta_read_config(postfix_local_t)
  313. mta_send_mail(postfix_local_t)
  314. tunable_policy(`postfix_local_write_mail_spool',`
  315. mta_manage_spool(postfix_local_t)
  316. ')
  317. optional_policy(`
  318. clamav_search_lib(postfix_local_t)
  319. clamav_exec_clamscan(postfix_local_t)
  320. clamav_stream_connect(postfix_smtpd_t)
  321. ')
  322. optional_policy(`
  323. dovecot_domtrans_deliver(postfix_local_t)
  324. ')
  325. optional_policy(`
  326. dspam_domtrans(postfix_local_t)
  327. ')
  328. optional_policy(`
  329. mailman_manage_data_files(postfix_local_t)
  330. mailman_append_log(postfix_local_t)
  331. mailman_read_log(postfix_local_t)
  332. ')
  333. optional_policy(`
  334. nagios_search_spool(postfix_local_t)
  335. ')
  336. optional_policy(`
  337. procmail_domtrans(postfix_local_t)
  338. ')
  339. optional_policy(`
  340. sendmail_rw_pipes(postfix_local_t)
  341. ')
  342. optional_policy(`
  343. zarafa_domtrans_deliver(postfix_local_t)
  344. zarafa_stream_connect_server(postfix_local_t)
  345. ')
  346. ########################################
  347. #
  348. # Map local policy
  349. #
  350. allow postfix_map_t self:capability { dac_override setgid setuid };
  351. allow postfix_map_t self:tcp_socket { accept listen };
  352. allow postfix_map_t postfix_etc_t:dir manage_dir_perms;
  353. allow postfix_map_t postfix_etc_t:file manage_file_perms;
  354. allow postfix_map_t postfix_etc_t:lnk_file manage_lnk_file_perms;
  355. manage_dirs_pattern(postfix_map_t, postfix_map_tmp_t, postfix_map_tmp_t)
  356. manage_files_pattern(postfix_map_t, postfix_map_tmp_t, postfix_map_tmp_t)
  357. files_tmp_filetrans(postfix_map_t, postfix_map_tmp_t, { file dir })
  358. kernel_read_kernel_sysctls(postfix_map_t)
  359. kernel_dontaudit_list_proc(postfix_map_t)
  360. kernel_dontaudit_read_system_state(postfix_map_t)
  361. corenet_all_recvfrom_unlabeled(postfix_map_t)
  362. corenet_all_recvfrom_netlabel(postfix_map_t)
  363. corenet_tcp_sendrecv_generic_if(postfix_map_t)
  364. corenet_tcp_sendrecv_generic_node(postfix_map_t)
  365. corenet_sendrecv_all_client_packets(postfix_map_t)
  366. corenet_tcp_connect_all_ports(postfix_map_t)
  367. corenet_tcp_sendrecv_all_ports(postfix_map_t)
  368. corecmd_list_bin(postfix_map_t)
  369. corecmd_read_bin_symlinks(postfix_map_t)
  370. corecmd_read_bin_files(postfix_map_t)
  371. corecmd_read_bin_pipes(postfix_map_t)
  372. corecmd_read_bin_sockets(postfix_map_t)
  373. files_list_home(postfix_map_t)
  374. files_read_usr_files(postfix_map_t)
  375. files_read_etc_runtime_files(postfix_map_t)
  376. files_dontaudit_search_var(postfix_map_t)
  377. auth_use_nsswitch(postfix_map_t)
  378. logging_send_syslog_msg(postfix_map_t)
  379. miscfiles_read_localization(postfix_map_t)
  380. optional_policy(`
  381. locallogin_dontaudit_use_fds(postfix_map_t)
  382. ')
  383. optional_policy(`
  384. mailman_manage_data_files(postfix_map_t)
  385. ')
  386. ########################################
  387. #
  388. # Pickup local policy
  389. #
  390. stream_connect_pattern(postfix_pickup_t, postfix_private_t, postfix_private_t, postfix_master_t)
  391. rw_fifo_files_pattern(postfix_pickup_t, postfix_public_t, postfix_public_t)
  392. rw_sock_files_pattern(postfix_pickup_t, postfix_public_t, postfix_public_t)
  393. allow postfix_pickup_t postfix_spool_t:dir list_dir_perms;
  394. read_files_pattern(postfix_pickup_t, postfix_spool_t, postfix_spool_t)
  395. delete_files_pattern(postfix_pickup_t, postfix_spool_t, postfix_spool_t)
  396. allow postfix_pickup_t postfix_spool_maildrop_t:dir list_dir_perms;
  397. read_files_pattern(postfix_pickup_t, postfix_spool_maildrop_t, postfix_spool_maildrop_t)
  398. delete_files_pattern(postfix_pickup_t, postfix_spool_maildrop_t, postfix_spool_maildrop_t)
  399. mcs_file_read_all(postfix_pickup_t)
  400. mcs_file_write_all(postfix_pickup_t)
  401. ########################################
  402. #
  403. # Pipe local policy
  404. #
  405. allow postfix_pipe_t self:process setrlimit;
  406. write_sock_files_pattern(postfix_pipe_t, postfix_private_t, postfix_private_t)
  407. write_fifo_files_pattern(postfix_pipe_t, postfix_public_t, postfix_public_t)
  408. rw_files_pattern(postfix_pipe_t, postfix_spool_t, postfix_spool_t)
  409. domtrans_pattern(postfix_pipe_t, postfix_postdrop_exec_t, postfix_postdrop_t)
  410. corecmd_exec_bin(postfix_pipe_t)
  411. write_sock_files_pattern(postfix_pipe_t, postfix_public_t, postfix_public_t)
  412. optional_policy(`
  413. dovecot_domtrans_deliver(postfix_pipe_t)
  414. ')
  415. optional_policy(`
  416. procmail_domtrans(postfix_pipe_t)
  417. ')
  418. optional_policy(`
  419. mailman_domtrans_queue(postfix_pipe_t)
  420. mailman_domtrans(postfix_pipe_t)
  421. ')
  422. optional_policy(`
  423. mta_manage_spool(postfix_pipe_t)
  424. mta_send_mail(postfix_pipe_t)
  425. ')
  426. optional_policy(`
  427. spamassassin_domtrans_client(postfix_pipe_t)
  428. spamassassin_kill_client(postfix_pipe_t)
  429. ')
  430. optional_policy(`
  431. uucp_domtrans_uux(postfix_pipe_t)
  432. ')
  433. ########################################
  434. #
  435. # Postdrop local policy
  436. #
  437. allow postfix_postdrop_t self:capability sys_resource;
  438. rw_fifo_files_pattern(postfix_postdrop_t, postfix_public_t, postfix_public_t)
  439. manage_files_pattern(postfix_postdrop_t, postfix_spool_maildrop_t, postfix_spool_maildrop_t)
  440. allow postfix_postdrop_t postfix_local_t:unix_stream_socket { read write };
  441. # for /var/spool/postfix/public/pickup
  442. allow postfix_postdrop_t postfix_public_t:sock_file { getattr write };
  443. allow postfix_postdrop_t postfix_master_t:unix_stream_socket connectto;
  444. mcs_file_read_all(postfix_postdrop_t)
  445. mcs_file_write_all(postfix_postdrop_t)
  446. term_dontaudit_use_all_ptys(postfix_postdrop_t)
  447. term_dontaudit_use_all_ttys(postfix_postdrop_t)
  448. mta_rw_user_mail_stream_sockets(postfix_postdrop_t)
  449. optional_policy(`
  450. apache_dontaudit_rw_fifo_file(postfix_postdrop_t)
  451. ')
  452. optional_policy(`
  453. cron_system_entry(postfix_postdrop_t, postfix_postdrop_exec_t)
  454. ')
  455. optional_policy(`
  456. fail2ban_dontaudit_use_fds(postfix_postdrop_t)
  457. ')
  458. optional_policy(`
  459. fstools_read_pipes(postfix_postdrop_t)
  460. ')
  461. optional_policy(`
  462. sendmail_rw_unix_stream_sockets(postfix_postdrop_t)
  463. ')
  464. optional_policy(`
  465. uucp_manage_spool(postfix_postdrop_t)
  466. ')
  467. #######################################
  468. #
  469. # Postqueue local policy
  470. #
  471. stream_connect_pattern(postfix_postqueue_t, postfix_public_t, postfix_public_t, postfix_master_t)
  472. write_fifo_files_pattern(postfix_postqueue_t, postfix_public_t, postfix_public_t)
  473. domtrans_pattern(postfix_postqueue_t, postfix_showq_exec_t, postfix_showq_t)
  474. term_use_all_ptys(postfix_postqueue_t)
  475. term_use_all_ttys(postfix_postqueue_t)
  476. init_sigchld_script(postfix_postqueue_t)
  477. init_use_script_fds(postfix_postqueue_t)
  478. optional_policy(`
  479. cron_system_entry(postfix_postqueue_t, postfix_postqueue_exec_t)
  480. ')
  481. optional_policy(`
  482. ppp_use_fds(postfix_postqueue_t)
  483. ppp_sigchld(postfix_postqueue_t)
  484. ')
  485. optional_policy(`
  486. userdom_sigchld_all_users(postfix_postqueue_t)
  487. ')
  488. ########################################
  489. #
  490. # Qmgr local policy
  491. #
  492. allow postfix_qmgr_t postfix_spool_bounce_t:dir list_dir_perms;
  493. allow postfix_qmgr_t postfix_spool_bounce_t:file read_file_perms;
  494. allow postfix_qmgr_t postfix_spool_bounce_t:lnk_file read_lnk_file_perms;
  495. stream_connect_pattern(postfix_qmgr_t, { postfix_private_t postfix_public_t }, { postfix_private_t postfix_public_t }, postfix_master_t)
  496. rw_fifo_files_pattern(postfix_qmgr_t, postfix_public_t, postfix_public_t)
  497. manage_files_pattern(postfix_qmgr_t, postfix_spool_maildrop_t, postfix_spool_maildrop_t)
  498. manage_dirs_pattern(postfix_qmgr_t, postfix_spool_maildrop_t, postfix_spool_maildrop_t)
  499. allow postfix_qmgr_t postfix_spool_maildrop_t:lnk_file read_lnk_file_perms;
  500. manage_dirs_pattern(postfix_qmgr_t, postfix_spool_t, postfix_spool_t)
  501. manage_files_pattern(postfix_qmgr_t, postfix_spool_t, postfix_spool_t)
  502. manage_lnk_files_pattern(postfix_qmgr_t, postfix_spool_t, postfix_spool_t)
  503. files_spool_filetrans(postfix_qmgr_t, postfix_spool_t, dir)
  504. corecmd_exec_bin(postfix_qmgr_t)
  505. ########################################
  506. #
  507. # Showq local policy
  508. #
  509. allow postfix_showq_t self:capability { setuid setgid };
  510. allow postfix_showq_t postfix_master_t:unix_stream_socket { accept rw_socket_perms };
  511. allow postfix_showq_t postfix_spool_maildrop_t:dir list_dir_perms;
  512. allow postfix_showq_t postfix_spool_maildrop_t:file read_file_perms;
  513. allow postfix_showq_t postfix_spool_maildrop_t:lnk_file read_lnk_file_perms;
  514. allow postfix_showq_t postfix_spool_t:file read_file_perms;
  515. mcs_file_read_all(postfix_showq_t)
  516. term_use_all_ptys(postfix_showq_t)
  517. term_use_all_ttys(postfix_showq_t)
  518. ########################################
  519. #
  520. # Smtp delivery local policy
  521. #
  522. allow postfix_smtp_t self:capability sys_chroot;
  523. stream_connect_pattern(postfix_smtp_t, { postfix_private_t postfix_public_t }, { postfix_private_t postfix_public_t }, postfix_master_t)
  524. allow postfix_smtp_t { postfix_prng_t postfix_spool_t }:file rw_file_perms;
  525. rw_files_pattern(postfix_smtp_t, postfix_spool_maildrop_t, postfix_spool_maildrop_t)
  526. corenet_tcp_bind_generic_node(postfix_smtp_t)
  527. optional_policy(`
  528. cyrus_stream_connect(postfix_smtp_t)
  529. ')
  530. optional_policy(`
  531. dovecot_stream_connect(postfix_smtp_t)
  532. ')
  533. optional_policy(`
  534. dspam_stream_connect(postfix_smtp_t)
  535. ')
  536. optional_policy(`
  537. milter_stream_connect_all(postfix_smtp_t)
  538. ')
  539. ########################################
  540. #
  541. # Smtpd local policy
  542. #
  543. allow postfix_smtpd_t postfix_master_t:tcp_socket rw_stream_socket_perms;
  544. stream_connect_pattern(postfix_smtpd_t, { postfix_private_t postfix_public_t }, { postfix_private_t postfix_public_t }, postfix_master_t)
  545. manage_dirs_pattern(postfix_smtpd_t, postfix_spool_t, postfix_spool_t)
  546. manage_files_pattern(postfix_smtpd_t, postfix_spool_t, postfix_spool_t)
  547. manage_lnk_files_pattern(postfix_smtpd_t, postfix_spool_t, postfix_spool_t)
  548. allow postfix_smtpd_t postfix_prng_t:file rw_file_perms;
  549. corenet_sendrecv_postfix_policyd_client_packets(postfix_smtpd_t)
  550. corenet_tcp_connect_postfix_policyd_port(postfix_smtpd_t)
  551. corenet_tcp_sendrecv_postfix_policyd_port(postfix_smtpd_t)
  552. corecmd_exec_bin(postfix_smtpd_t)
  553. fs_getattr_all_dirs(postfix_smtpd_t)
  554. fs_getattr_all_fs(postfix_smtpd_t)
  555. mta_read_aliases(postfix_smtpd_t)
  556. optional_policy(`
  557. dovecot_stream_connect_auth(postfix_smtpd_t)
  558. dovecot_stream_connect(postfix_smtpd_t)
  559. ')
  560. optional_policy(`
  561. mailman_read_data_files(postfix_smtpd_t)
  562. ')
  563. optional_policy(`
  564. milter_stream_connect_all(postfix_smtpd_t)
  565. ')
  566. optional_policy(`
  567. postgrey_stream_connect(postfix_smtpd_t)
  568. ')
  569. optional_policy(`
  570. sasl_connect(postfix_smtpd_t)
  571. ')
  572. optional_policy(`
  573. spamassassin_read_spamd_pid_files(postfix_smtpd_t)
  574. spamassassin_stream_connect_spamd(postfix_smtpd_t)
  575. ')
  576. ########################################
  577. #
  578. # Virtual local policy
  579. #
  580. allow postfix_virtual_t self:process setrlimit;
  581. allow postfix_virtual_t postfix_spool_t:file rw_file_perms;
  582. stream_connect_pattern(postfix_virtual_t, { postfix_private_t postfix_public_t }, { postfix_private_t postfix_public_t }, postfix_master_t)
  583. corecmd_exec_bin(postfix_virtual_t)
  584. mta_read_aliases(postfix_virtual_t)
  585. mta_delete_spool(postfix_virtual_t)
  586. mta_read_config(postfix_virtual_t)
  587. mta_manage_spool(postfix_virtual_t)
  588. userdom_manage_user_home_dirs(postfix_virtual_t)
  589. userdom_manage_user_home_content_dirs(postfix_virtual_t)
  590. userdom_manage_user_home_content_files(postfix_virtual_t)
  591. userdom_home_filetrans_user_home_dir(postfix_virtual_t)
  592. userdom_user_home_dir_filetrans_user_home_content(postfix_virtual_t, { file dir })