postfix.te 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815
  1. policy_module(postfix, 1.16.4)
  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_server_domain postfix_master_t:unix_stream_socket { connectto rw_stream_socket_perms };
  123. corenet_all_recvfrom_unlabeled(postfix_server_domain)
  124. corenet_all_recvfrom_netlabel(postfix_server_domain)
  125. corenet_tcp_sendrecv_generic_if(postfix_server_domain)
  126. corenet_tcp_sendrecv_generic_node(postfix_server_domain)
  127. corenet_sendrecv_all_client_packets(postfix_server_domain)
  128. corenet_tcp_connect_all_ports(postfix_server_domain)
  129. corenet_tcp_sendrecv_all_ports(postfix_server_domain)
  130. ########################################
  131. #
  132. # Common postfix user domain local policy
  133. #
  134. allow postfix_user_domains self:capability dac_override;
  135. domain_use_interactive_fds(postfix_user_domains)
  136. ########################################
  137. #
  138. # Master local policy
  139. #
  140. allow postfix_master_t self:capability { chown dac_override kill fowner setgid setuid sys_tty_config };
  141. allow postfix_master_t self:capability2 block_suspend;
  142. allow postfix_master_t self:process setrlimit;
  143. allow postfix_master_t self:tcp_socket create_stream_socket_perms;
  144. allow postfix_master_t self:udp_socket create_socket_perms;
  145. allow postfix_master_t postfix_domain:fifo_file rw_fifo_file_perms;
  146. allow postfix_master_t postfix_domain:process signal;
  147. allow postfix_master_t postfix_etc_t:dir rw_dir_perms;
  148. allow postfix_master_t postfix_etc_t:file rw_file_perms;
  149. allow postfix_master_t postfix_data_t:dir manage_dir_perms;
  150. allow postfix_master_t postfix_data_t:file manage_file_perms;
  151. allow postfix_master_t postfix_keytab_t:file read_file_perms;
  152. allow postfix_master_t postfix_map_exec_t:file { mmap_file_perms ioctl lock };
  153. allow postfix_master_t { postfix_postdrop_exec_t postfix_postqueue_exec_t }:file getattr_file_perms;
  154. allow postfix_master_t postfix_prng_t:file rw_file_perms;
  155. manage_dirs_pattern(postfix_master_t, postfix_spool_t, postfix_spool_t)
  156. manage_files_pattern(postfix_master_t, postfix_spool_t, postfix_spool_t)
  157. files_spool_filetrans(postfix_master_t, postfix_spool_t, dir)
  158. allow postfix_master_t postfix_spool_bounce_t:dir manage_dir_perms;
  159. allow postfix_master_t postfix_spool_bounce_t:file getattr_file_perms;
  160. filetrans_pattern(postfix_master_t, postfix_spool_t, postfix_spool_bounce_t, dir, "bounce")
  161. manage_dirs_pattern(postfix_master_t, postfix_spool_flush_t, postfix_spool_flush_t)
  162. manage_files_pattern(postfix_master_t, postfix_spool_flush_t, postfix_spool_flush_t)
  163. manage_lnk_files_pattern(postfix_master_t, postfix_spool_flush_t, postfix_spool_flush_t)
  164. filetrans_pattern(postfix_master_t, postfix_spool_t, postfix_spool_flush_t, dir, "flush")
  165. create_dirs_pattern(postfix_master_t, postfix_spool_t, postfix_private_t)
  166. manage_fifo_files_pattern(postfix_master_t, postfix_private_t, postfix_private_t)
  167. manage_sock_files_pattern(postfix_master_t, postfix_private_t, postfix_private_t)
  168. setattr_dirs_pattern(postfix_master_t, postfix_private_t, postfix_private_t)
  169. filetrans_pattern(postfix_master_t, postfix_spool_t, postfix_private_t, dir, "private")
  170. create_dirs_pattern(postfix_master_t, postfix_spool_t, postfix_public_t)
  171. manage_fifo_files_pattern(postfix_master_t, postfix_public_t, postfix_public_t)
  172. manage_sock_files_pattern(postfix_master_t, postfix_public_t, postfix_public_t)
  173. setattr_dirs_pattern(postfix_master_t, postfix_public_t, postfix_public_t)
  174. filetrans_pattern(postfix_master_t, postfix_spool_t, postfix_public_t, dir, "public")
  175. create_dirs_pattern(postfix_master_t, postfix_spool_t, postfix_spool_maildrop_t)
  176. delete_files_pattern(postfix_master_t, postfix_spool_maildrop_t, postfix_spool_maildrop_t)
  177. rename_files_pattern(postfix_master_t, postfix_spool_maildrop_t, postfix_spool_maildrop_t)
  178. setattr_dirs_pattern(postfix_master_t, postfix_spool_maildrop_t, postfix_spool_maildrop_t)
  179. filetrans_pattern(postfix_master_t, postfix_spool_t, postfix_spool_maildrop_t, dir, "defer")
  180. filetrans_pattern(postfix_master_t, postfix_spool_t, postfix_spool_maildrop_t, dir, "deferred")
  181. filetrans_pattern(postfix_master_t, postfix_spool_t, postfix_spool_maildrop_t, dir, "maildrop")
  182. create_dirs_pattern(postfix_master_t, postfix_spool_t, postfix_var_run_t)
  183. setattr_dirs_pattern(postfix_master_t, postfix_var_run_t, postfix_var_run_t)
  184. filetrans_pattern(postfix_master_t, postfix_spool_t, postfix_var_run_t, dir, "pid")
  185. can_exec(postfix_master_t, postfix_exec_t)
  186. domtrans_pattern(postfix_master_t, postfix_postqueue_exec_t, postfix_postqueue_t)
  187. domtrans_pattern(postfix_master_t, postfix_showq_exec_t, postfix_showq_t)
  188. corenet_all_recvfrom_unlabeled(postfix_master_t)
  189. corenet_all_recvfrom_netlabel(postfix_master_t)
  190. corenet_tcp_sendrecv_generic_if(postfix_master_t)
  191. corenet_udp_sendrecv_generic_if(postfix_master_t)
  192. corenet_tcp_sendrecv_generic_node(postfix_master_t)
  193. corenet_udp_sendrecv_generic_node(postfix_master_t)
  194. corenet_tcp_sendrecv_all_ports(postfix_master_t)
  195. corenet_udp_sendrecv_all_ports(postfix_master_t)
  196. corenet_tcp_bind_generic_node(postfix_master_t)
  197. corenet_tcp_bind_all_unreserved_ports(postfix_master_t)
  198. corenet_sendrecv_amavisd_send_server_packets(postfix_master_t)
  199. corenet_tcp_bind_amavisd_send_port(postfix_master_t)
  200. corenet_sendrecv_smtp_server_packets(postfix_master_t)
  201. corenet_tcp_bind_smtp_port(postfix_master_t)
  202. corenet_sendrecv_spamd_server_packets(postfix_master_t)
  203. corenet_tcp_bind_spamd_port(postfix_master_t)
  204. corenet_sendrecv_all_client_packets(postfix_master_t)
  205. corenet_tcp_connect_all_ports(postfix_master_t)
  206. # Can this be conditional?
  207. corenet_sendrecv_all_server_packets(postfix_master_t)
  208. corenet_udp_bind_all_unreserved_ports(postfix_master_t)
  209. corenet_dontaudit_udp_bind_all_ports(postfix_master_t)
  210. selinux_dontaudit_search_fs(postfix_master_t)
  211. corecmd_exec_bin(postfix_master_t)
  212. domain_use_interactive_fds(postfix_master_t)
  213. files_search_tmp(postfix_master_t)
  214. mcs_file_read_all(postfix_master_t)
  215. term_dontaudit_search_ptys(postfix_master_t)
  216. miscfiles_read_man_pages(postfix_master_t)
  217. seutil_sigchld_newrole(postfix_master_t)
  218. seutil_dontaudit_search_config(postfix_master_t)
  219. mta_manage_aliases(postfix_master_t)
  220. mta_etc_filetrans_aliases(postfix_master_t, file, "aliases")
  221. mta_etc_filetrans_aliases(postfix_master_t, file, "aliases.db")
  222. mta_etc_filetrans_aliases(postfix_master_t, file, "aliasesdb-stamp")
  223. mta_spec_filetrans_aliases(postfix_master_t, postfix_etc_t, file)
  224. mta_read_sendmail_bin(postfix_master_t)
  225. mta_getattr_spool(postfix_master_t)
  226. connect_udev_udp_socket(postfix_master_t)
  227. corenet_udp_bind_generic_node(postfix_master_t)
  228. optional_policy(`
  229. cyrus_stream_connect(postfix_master_t)
  230. ')
  231. optional_policy(`
  232. kerberos_read_keytab(postfix_master_t)
  233. kerberos_use(postfix_master_t)
  234. ')
  235. optional_policy(`
  236. mailman_manage_data_files(postfix_master_t)
  237. ')
  238. optional_policy(`
  239. mysql_stream_connect(postfix_master_t)
  240. ')
  241. optional_policy(`
  242. postgrey_search_spool(postfix_master_t)
  243. ')
  244. optional_policy(`
  245. sendmail_signal(postfix_master_t)
  246. ')
  247. ########################################
  248. #
  249. # Bounce local policy
  250. #
  251. allow postfix_bounce_t self:capability dac_read_search;
  252. write_sock_files_pattern(postfix_bounce_t, postfix_public_t, postfix_public_t)
  253. manage_dirs_pattern(postfix_bounce_t, postfix_spool_t, postfix_spool_t)
  254. manage_files_pattern(postfix_bounce_t, postfix_spool_t, postfix_spool_t)
  255. manage_lnk_files_pattern(postfix_bounce_t, postfix_spool_t, postfix_spool_t)
  256. files_spool_filetrans(postfix_bounce_t, postfix_spool_t, dir)
  257. manage_files_pattern(postfix_bounce_t, postfix_spool_maildrop_t, postfix_spool_maildrop_t)
  258. manage_dirs_pattern(postfix_bounce_t, postfix_spool_maildrop_t, postfix_spool_maildrop_t)
  259. allow postfix_bounce_t postfix_spool_maildrop_t:lnk_file read_lnk_file_perms;
  260. manage_dirs_pattern(postfix_bounce_t, postfix_spool_bounce_t, postfix_spool_bounce_t)
  261. manage_files_pattern(postfix_bounce_t, postfix_spool_bounce_t, postfix_spool_bounce_t)
  262. manage_lnk_files_pattern(postfix_bounce_t, postfix_spool_bounce_t, postfix_spool_bounce_t)
  263. ########################################
  264. #
  265. # Cleanup local policy
  266. #
  267. allow postfix_cleanup_t self:process setrlimit;
  268. allow postfix_cleanup_t postfix_smtpd_t:tcp_socket rw_stream_socket_perms;
  269. allow postfix_cleanup_t postfix_smtpd_t:unix_stream_socket rw_socket_perms;
  270. allow postfix_cleanup_t postfix_spool_maildrop_t:dir list_dir_perms;
  271. allow postfix_cleanup_t postfix_spool_maildrop_t:file read_file_perms;
  272. allow postfix_cleanup_t postfix_spool_maildrop_t:lnk_file read_lnk_file_perms;
  273. stream_connect_pattern(postfix_cleanup_t, postfix_private_t, postfix_private_t, postfix_master_t)
  274. rw_fifo_files_pattern(postfix_cleanup_t, postfix_public_t, postfix_public_t)
  275. write_sock_files_pattern(postfix_cleanup_t, postfix_public_t, postfix_public_t)
  276. manage_dirs_pattern(postfix_cleanup_t, postfix_spool_t, postfix_spool_t)
  277. manage_files_pattern(postfix_cleanup_t, postfix_spool_t, postfix_spool_t)
  278. manage_lnk_files_pattern(postfix_cleanup_t, postfix_spool_t, postfix_spool_t)
  279. files_spool_filetrans(postfix_cleanup_t, postfix_spool_t, dir)
  280. allow postfix_cleanup_t postfix_spool_bounce_t:dir list_dir_perms;
  281. corecmd_exec_bin(postfix_cleanup_t)
  282. corenet_sendrecv_kismet_client_packets(postfix_cleanup_t)
  283. corenet_tcp_connect_kismet_port(postfix_cleanup_t)
  284. corenet_tcp_sendrecv_kismet_port(postfix_cleanup_t)
  285. mta_read_aliases(postfix_cleanup_t)
  286. optional_policy(`
  287. mailman_read_data_files(postfix_cleanup_t)
  288. ')
  289. ########################################
  290. #
  291. # Local local policy
  292. #
  293. allow postfix_local_t self:capability chown;
  294. allow postfix_local_t self:process setrlimit;
  295. stream_connect_pattern(postfix_local_t, postfix_public_t, postfix_public_t, postfix_master_t)
  296. rw_sock_files_pattern(postfix_local_t, postfix_private_t, postfix_private_t)
  297. allow postfix_local_t postfix_spool_t:file rw_file_perms;
  298. domtrans_pattern(postfix_local_t, postfix_postdrop_exec_t, postfix_postdrop_t)
  299. corecmd_exec_bin(postfix_local_t)
  300. logging_dontaudit_search_logs(postfix_local_t)
  301. mta_delete_spool(postfix_local_t)
  302. mta_read_aliases(postfix_local_t)
  303. mta_read_config(postfix_local_t)
  304. mta_send_mail(postfix_local_t)
  305. tunable_policy(`postfix_local_write_mail_spool',`
  306. mta_manage_spool(postfix_local_t)
  307. ')
  308. optional_policy(`
  309. clamav_search_lib(postfix_local_t)
  310. clamav_exec_clamscan(postfix_local_t)
  311. ')
  312. optional_policy(`
  313. dovecot_domtrans_deliver(postfix_local_t)
  314. ')
  315. optional_policy(`
  316. dspam_domtrans(postfix_local_t)
  317. ')
  318. optional_policy(`
  319. mailman_manage_data_files(postfix_local_t)
  320. mailman_append_log(postfix_local_t)
  321. mailman_read_log(postfix_local_t)
  322. ')
  323. optional_policy(`
  324. nagios_search_spool(postfix_local_t)
  325. ')
  326. optional_policy(`
  327. procmail_domtrans(postfix_local_t)
  328. ')
  329. optional_policy(`
  330. sendmail_rw_pipes(postfix_local_t)
  331. ')
  332. optional_policy(`
  333. zarafa_domtrans_deliver(postfix_local_t)
  334. zarafa_stream_connect_server(postfix_local_t)
  335. ')
  336. ########################################
  337. #
  338. # Map local policy
  339. #
  340. allow postfix_map_t self:capability { dac_override setgid setuid };
  341. allow postfix_map_t self:tcp_socket { accept listen };
  342. allow postfix_map_t postfix_etc_t:dir manage_dir_perms;
  343. allow postfix_map_t postfix_etc_t:file manage_file_perms;
  344. allow postfix_map_t postfix_etc_t:lnk_file manage_lnk_file_perms;
  345. manage_dirs_pattern(postfix_map_t, postfix_map_tmp_t, postfix_map_tmp_t)
  346. manage_files_pattern(postfix_map_t, postfix_map_tmp_t, postfix_map_tmp_t)
  347. files_tmp_filetrans(postfix_map_t, postfix_map_tmp_t, { file dir })
  348. kernel_read_kernel_sysctls(postfix_map_t)
  349. kernel_dontaudit_list_proc(postfix_map_t)
  350. kernel_dontaudit_read_system_state(postfix_map_t)
  351. corenet_all_recvfrom_unlabeled(postfix_map_t)
  352. corenet_all_recvfrom_netlabel(postfix_map_t)
  353. corenet_tcp_sendrecv_generic_if(postfix_map_t)
  354. corenet_tcp_sendrecv_generic_node(postfix_map_t)
  355. corenet_sendrecv_all_client_packets(postfix_map_t)
  356. corenet_tcp_connect_all_ports(postfix_map_t)
  357. corenet_tcp_sendrecv_all_ports(postfix_map_t)
  358. corecmd_list_bin(postfix_map_t)
  359. corecmd_read_bin_symlinks(postfix_map_t)
  360. corecmd_read_bin_files(postfix_map_t)
  361. corecmd_read_bin_pipes(postfix_map_t)
  362. corecmd_read_bin_sockets(postfix_map_t)
  363. files_list_home(postfix_map_t)
  364. files_read_usr_files(postfix_map_t)
  365. files_read_etc_runtime_files(postfix_map_t)
  366. files_dontaudit_search_var(postfix_map_t)
  367. auth_use_nsswitch(postfix_map_t)
  368. logging_send_syslog_msg(postfix_map_t)
  369. miscfiles_read_localization(postfix_map_t)
  370. optional_policy(`
  371. locallogin_dontaudit_use_fds(postfix_map_t)
  372. ')
  373. optional_policy(`
  374. mailman_manage_data_files(postfix_map_t)
  375. ')
  376. ########################################
  377. #
  378. # Pickup local policy
  379. #
  380. stream_connect_pattern(postfix_pickup_t, postfix_private_t, postfix_private_t, postfix_master_t)
  381. rw_fifo_files_pattern(postfix_pickup_t, postfix_public_t, postfix_public_t)
  382. rw_sock_files_pattern(postfix_pickup_t, postfix_public_t, postfix_public_t)
  383. allow postfix_pickup_t postfix_spool_t:dir list_dir_perms;
  384. read_files_pattern(postfix_pickup_t, postfix_spool_t, postfix_spool_t)
  385. delete_files_pattern(postfix_pickup_t, postfix_spool_t, postfix_spool_t)
  386. allow postfix_pickup_t postfix_spool_maildrop_t:dir list_dir_perms;
  387. read_files_pattern(postfix_pickup_t, postfix_spool_maildrop_t, postfix_spool_maildrop_t)
  388. delete_files_pattern(postfix_pickup_t, postfix_spool_maildrop_t, postfix_spool_maildrop_t)
  389. mcs_file_read_all(postfix_pickup_t)
  390. mcs_file_write_all(postfix_pickup_t)
  391. ########################################
  392. #
  393. # Pipe local policy
  394. #
  395. allow postfix_pipe_t self:process setrlimit;
  396. write_sock_files_pattern(postfix_pipe_t, postfix_private_t, postfix_private_t)
  397. write_fifo_files_pattern(postfix_pipe_t, postfix_public_t, postfix_public_t)
  398. rw_files_pattern(postfix_pipe_t, postfix_spool_t, postfix_spool_t)
  399. domtrans_pattern(postfix_pipe_t, postfix_postdrop_exec_t, postfix_postdrop_t)
  400. corecmd_exec_bin(postfix_pipe_t)
  401. optional_policy(`
  402. dovecot_domtrans_deliver(postfix_pipe_t)
  403. ')
  404. optional_policy(`
  405. procmail_domtrans(postfix_pipe_t)
  406. ')
  407. optional_policy(`
  408. mailman_domtrans_queue(postfix_pipe_t)
  409. ')
  410. optional_policy(`
  411. mta_manage_spool(postfix_pipe_t)
  412. mta_send_mail(postfix_pipe_t)
  413. ')
  414. optional_policy(`
  415. spamassassin_domtrans_client(postfix_pipe_t)
  416. spamassassin_kill_client(postfix_pipe_t)
  417. ')
  418. optional_policy(`
  419. uucp_domtrans_uux(postfix_pipe_t)
  420. ')
  421. ########################################
  422. #
  423. # Postdrop local policy
  424. #
  425. allow postfix_postdrop_t self:capability sys_resource;
  426. rw_fifo_files_pattern(postfix_postdrop_t, postfix_public_t, postfix_public_t)
  427. manage_files_pattern(postfix_postdrop_t, postfix_spool_maildrop_t, postfix_spool_maildrop_t)
  428. allow postfix_postdrop_t postfix_local_t:unix_stream_socket { read write };
  429. allow postfix_postdrop_t postfix_master_t:unix_stream_socket connectto;
  430. allow postfix_postdrop_t postfix_public_t:sock_file { write getattr };
  431. mcs_file_read_all(postfix_postdrop_t)
  432. mcs_file_write_all(postfix_postdrop_t)
  433. term_dontaudit_use_all_ptys(postfix_postdrop_t)
  434. term_dontaudit_use_all_ttys(postfix_postdrop_t)
  435. mta_rw_user_mail_stream_sockets(postfix_postdrop_t)
  436. optional_policy(`
  437. apache_dontaudit_rw_fifo_file(postfix_postdrop_t)
  438. ')
  439. optional_policy(`
  440. cron_system_entry(postfix_postdrop_t, postfix_postdrop_exec_t)
  441. ')
  442. optional_policy(`
  443. fail2ban_dontaudit_use_fds(postfix_postdrop_t)
  444. ')
  445. optional_policy(`
  446. fstools_read_pipes(postfix_postdrop_t)
  447. ')
  448. optional_policy(`
  449. sendmail_rw_unix_stream_sockets(postfix_postdrop_t)
  450. ')
  451. optional_policy(`
  452. uucp_manage_spool(postfix_postdrop_t)
  453. ')
  454. #######################################
  455. #
  456. # Postqueue local policy
  457. #
  458. stream_connect_pattern(postfix_postqueue_t, postfix_public_t, postfix_public_t, postfix_master_t)
  459. write_fifo_files_pattern(postfix_postqueue_t, postfix_public_t, postfix_public_t)
  460. domtrans_pattern(postfix_postqueue_t, postfix_showq_exec_t, postfix_showq_t)
  461. term_use_all_ptys(postfix_postqueue_t)
  462. term_use_all_ttys(postfix_postqueue_t)
  463. init_sigchld_script(postfix_postqueue_t)
  464. init_use_script_fds(postfix_postqueue_t)
  465. optional_policy(`
  466. cron_system_entry(postfix_postqueue_t, postfix_postqueue_exec_t)
  467. ')
  468. optional_policy(`
  469. ppp_use_fds(postfix_postqueue_t)
  470. ppp_sigchld(postfix_postqueue_t)
  471. ')
  472. optional_policy(`
  473. userdom_sigchld_all_users(postfix_postqueue_t)
  474. ')
  475. ########################################
  476. #
  477. # Qmgr local policy
  478. #
  479. allow postfix_qmgr_t postfix_spool_bounce_t:dir list_dir_perms;
  480. allow postfix_qmgr_t postfix_spool_bounce_t:file read_file_perms;
  481. allow postfix_qmgr_t postfix_spool_bounce_t:lnk_file read_lnk_file_perms;
  482. stream_connect_pattern(postfix_qmgr_t, { postfix_private_t postfix_public_t }, { postfix_private_t postfix_public_t }, postfix_master_t)
  483. rw_fifo_files_pattern(postfix_qmgr_t, postfix_public_t, postfix_public_t)
  484. manage_files_pattern(postfix_qmgr_t, postfix_spool_maildrop_t, postfix_spool_maildrop_t)
  485. manage_dirs_pattern(postfix_qmgr_t, postfix_spool_maildrop_t, postfix_spool_maildrop_t)
  486. allow postfix_qmgr_t postfix_spool_maildrop_t:lnk_file read_lnk_file_perms;
  487. manage_dirs_pattern(postfix_qmgr_t, postfix_spool_t, postfix_spool_t)
  488. manage_files_pattern(postfix_qmgr_t, postfix_spool_t, postfix_spool_t)
  489. manage_lnk_files_pattern(postfix_qmgr_t, postfix_spool_t, postfix_spool_t)
  490. files_spool_filetrans(postfix_qmgr_t, postfix_spool_t, dir)
  491. corecmd_exec_bin(postfix_qmgr_t)
  492. ########################################
  493. #
  494. # Showq local policy
  495. #
  496. allow postfix_showq_t self:capability { setuid setgid };
  497. allow postfix_showq_t postfix_master_t:unix_stream_socket { accept rw_socket_perms };
  498. allow postfix_showq_t postfix_spool_maildrop_t:dir list_dir_perms;
  499. allow postfix_showq_t postfix_spool_maildrop_t:file read_file_perms;
  500. allow postfix_showq_t postfix_spool_maildrop_t:lnk_file read_lnk_file_perms;
  501. allow postfix_showq_t postfix_spool_t:file read_file_perms;
  502. mcs_file_read_all(postfix_showq_t)
  503. term_use_all_ptys(postfix_showq_t)
  504. term_use_all_ttys(postfix_showq_t)
  505. ########################################
  506. #
  507. # Smtp delivery local policy
  508. #
  509. allow postfix_smtp_t self:capability sys_chroot;
  510. stream_connect_pattern(postfix_smtp_t, { postfix_private_t postfix_public_t }, { postfix_private_t postfix_public_t }, postfix_master_t)
  511. allow postfix_smtp_t { postfix_prng_t postfix_spool_t }:file rw_file_perms;
  512. rw_files_pattern(postfix_smtp_t, postfix_spool_maildrop_t, postfix_spool_maildrop_t)
  513. corenet_tcp_bind_generic_node(postfix_smtp_t)
  514. optional_policy(`
  515. cyrus_stream_connect(postfix_smtp_t)
  516. ')
  517. optional_policy(`
  518. dovecot_stream_connect(postfix_smtp_t)
  519. ')
  520. optional_policy(`
  521. dspam_stream_connect(postfix_smtp_t)
  522. ')
  523. optional_policy(`
  524. milter_stream_connect_all(postfix_smtp_t)
  525. ')
  526. ########################################
  527. #
  528. # Smtpd local policy
  529. #
  530. allow postfix_smtpd_t postfix_master_t:tcp_socket rw_stream_socket_perms;
  531. stream_connect_pattern(postfix_smtpd_t, { postfix_private_t postfix_public_t }, { postfix_private_t postfix_public_t }, postfix_master_t)
  532. manage_dirs_pattern(postfix_smtpd_t, postfix_spool_t, postfix_spool_t)
  533. manage_files_pattern(postfix_smtpd_t, postfix_spool_t, postfix_spool_t)
  534. manage_lnk_files_pattern(postfix_smtpd_t, postfix_spool_t, postfix_spool_t)
  535. allow postfix_smtpd_t postfix_prng_t:file rw_file_perms;
  536. corenet_sendrecv_postfix_policyd_client_packets(postfix_smtpd_t)
  537. corenet_tcp_connect_postfix_policyd_port(postfix_smtpd_t)
  538. corenet_tcp_sendrecv_postfix_policyd_port(postfix_smtpd_t)
  539. corecmd_exec_bin(postfix_smtpd_t)
  540. fs_getattr_all_dirs(postfix_smtpd_t)
  541. fs_getattr_all_fs(postfix_smtpd_t)
  542. mta_read_aliases(postfix_smtpd_t)
  543. optional_policy(`
  544. dovecot_stream_connect_auth(postfix_smtpd_t)
  545. dovecot_stream_connect(postfix_smtpd_t)
  546. ')
  547. optional_policy(`
  548. mailman_read_data_files(postfix_smtpd_t)
  549. ')
  550. optional_policy(`
  551. milter_stream_connect_all(postfix_smtpd_t)
  552. ')
  553. optional_policy(`
  554. postgrey_stream_connect(postfix_smtpd_t)
  555. ')
  556. optional_policy(`
  557. sasl_connect(postfix_smtpd_t)
  558. ')
  559. optional_policy(`
  560. spamassassin_read_spamd_pid_files(postfix_smtpd_t)
  561. spamassassin_stream_connect_spamd(postfix_smtpd_t)
  562. ')
  563. ########################################
  564. #
  565. # Virtual local policy
  566. #
  567. allow postfix_virtual_t self:process setrlimit;
  568. allow postfix_virtual_t postfix_spool_t:file rw_file_perms;
  569. stream_connect_pattern(postfix_virtual_t, { postfix_private_t postfix_public_t }, { postfix_private_t postfix_public_t }, postfix_master_t)
  570. corecmd_exec_bin(postfix_virtual_t)
  571. mta_read_aliases(postfix_virtual_t)
  572. mta_delete_spool(postfix_virtual_t)
  573. mta_read_config(postfix_virtual_t)
  574. mta_manage_spool(postfix_virtual_t)
  575. userdom_manage_user_home_dirs(postfix_virtual_t)
  576. userdom_manage_user_home_content_dirs(postfix_virtual_t)
  577. userdom_manage_user_home_content_files(postfix_virtual_t)
  578. userdom_home_filetrans_user_home_dir(postfix_virtual_t)
  579. userdom_user_home_dir_filetrans_user_home_content(postfix_virtual_t, { file dir })