mta.if 22 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100
  1. ## <summary>Common e-mail transfer agent policy.</summary>
  2. ########################################
  3. ## <summary>
  4. ## MTA stub interface. No access allowed.
  5. ## </summary>
  6. ## <param name="domain" unused="true">
  7. ## <summary>
  8. ## Domain allowed access.
  9. ## </summary>
  10. ## </param>
  11. #
  12. interface(`mta_stub',`
  13. gen_require(`
  14. type sendmail_exec_t;
  15. ')
  16. ')
  17. #######################################
  18. ## <summary>
  19. ## The template to define a mail domain.
  20. ## </summary>
  21. ## <param name="domain_prefix">
  22. ## <summary>
  23. ## Domain prefix to be used.
  24. ## </summary>
  25. ## </param>
  26. #
  27. template(`mta_base_mail_template',`
  28. gen_require(`
  29. attribute user_mail_domain;
  30. type sendmail_exec_t;
  31. ')
  32. ########################################
  33. #
  34. # Declarations
  35. #
  36. type $1_mail_t, user_mail_domain;
  37. application_domain($1_mail_t, sendmail_exec_t)
  38. type $1_mail_tmp_t;
  39. files_tmp_file($1_mail_tmp_t)
  40. ########################################
  41. #
  42. # Declarations
  43. #
  44. manage_dirs_pattern($1_mail_t, $1_mail_tmp_t, $1_mail_tmp_t)
  45. manage_files_pattern($1_mail_t, $1_mail_tmp_t, $1_mail_tmp_t)
  46. files_tmp_filetrans($1_mail_t, $1_mail_tmp_t, { file dir })
  47. auth_use_nsswitch($1_mail_t)
  48. optional_policy(`
  49. postfix_domtrans_user_mail_handler($1_mail_t)
  50. ')
  51. ')
  52. ########################################
  53. ## <summary>
  54. ## Role access for mta.
  55. ## </summary>
  56. ## <param name="role">
  57. ## <summary>
  58. ## Role allowed access.
  59. ## </summary>
  60. ## </param>
  61. ## <param name="domain">
  62. ## <summary>
  63. ## User domain for the role.
  64. ## </summary>
  65. ## </param>
  66. #
  67. interface(`mta_role',`
  68. gen_require(`
  69. attribute mta_user_agent;
  70. attribute_role user_mail_roles;
  71. type user_mail_t, sendmail_exec_t, mail_home_t;
  72. type user_mail_tmp_t, mail_home_rw_t;
  73. ')
  74. roleattribute $1 user_mail_roles;
  75. # this is something i need to fix
  76. # i dont know if and why it is needed
  77. # will role attribute work?
  78. role $1 types mta_user_agent;
  79. domtrans_pattern($2, sendmail_exec_t, user_mail_t)
  80. allow $2 sendmail_exec_t:lnk_file read_lnk_file_perms;
  81. allow $2 { user_mail_t mta_user_agent }:process { ptrace signal_perms };
  82. ps_process_pattern($2, { user_mail_t mta_user_agent })
  83. allow $2 mail_home_t:file { manage_file_perms relabel_file_perms };
  84. userdom_user_home_dir_filetrans($2, mail_home_t, file, ".esmtp_queue")
  85. userdom_user_home_dir_filetrans($2, mail_home_t, file, ".forward")
  86. userdom_user_home_dir_filetrans($2, mail_home_t, file, ".mailrc")
  87. userdom_user_home_dir_filetrans($2, mail_home_t, file, "dead.letter")
  88. allow $2 mail_home_rw_t:dir { manage_dir_perms relabel_dir_perms };
  89. allow $2 mail_home_rw_t:file { manage_file_perms relabel_file_perms };
  90. allow $2 mail_home_rw_t:lnk_file { manage_lnk_file_perms relabel_lnk_file_perms };
  91. userdom_user_home_dir_filetrans($2, mail_home_rw_t, dir, "Maildir")
  92. userdom_user_home_dir_filetrans($2, mail_home_rw_t, dir, ".maildir")
  93. allow $2 user_mail_tmp_t:dir { manage_dir_perms relabel_dir_perms };
  94. allow $2 user_mail_tmp_t:file { manage_file_perms relabel_file_perms };
  95. optional_policy(`
  96. exim_run($2, $1)
  97. ')
  98. optional_policy(`
  99. mailman_run($2, $1)
  100. ')
  101. ')
  102. ########################################
  103. ## <summary>
  104. ## Enable system_mail_t to run in the specified role
  105. ## </summary>
  106. ## <param name="role">
  107. ## <summary>
  108. ## Role allowed access.
  109. ## </summary>
  110. ## </param>
  111. #
  112. interface(`system_mail_role',`
  113. gen_require(`
  114. type system_mail_t;
  115. ')
  116. role $1 types system_mail_t;
  117. ')
  118. ########################################
  119. ## <summary>
  120. ## Make the specified domain usable for a mail server.
  121. ## </summary>
  122. ## <param name="type">
  123. ## <summary>
  124. ## Type to be used as a mail server domain.
  125. ## </summary>
  126. ## </param>
  127. ## <param name="entry_point">
  128. ## <summary>
  129. ## Type of the program to be used as an entry point to this domain.
  130. ## </summary>
  131. ## </param>
  132. #
  133. interface(`mta_mailserver',`
  134. gen_require(`
  135. attribute mailserver_domain;
  136. ')
  137. init_daemon_domain($1, $2)
  138. typeattribute $1 mailserver_domain;
  139. ')
  140. ########################################
  141. ## <summary>
  142. ## Make the specified type a MTA executable file.
  143. ## </summary>
  144. ## <param name="type">
  145. ## <summary>
  146. ## Type to be used as a mail client.
  147. ## </summary>
  148. ## </param>
  149. #
  150. interface(`mta_agent_executable',`
  151. gen_require(`
  152. attribute mta_exec_type;
  153. ')
  154. typeattribute $1 mta_exec_type;
  155. application_executable_file($1)
  156. ')
  157. #######################################
  158. ## <summary>
  159. ## Read mta mail home files.
  160. ## </summary>
  161. ## <param name="domain">
  162. ## <summary>
  163. ## Domain allowed access.
  164. ## </summary>
  165. ## </param>
  166. #
  167. interface(`mta_read_mail_home_files',`
  168. gen_require(`
  169. type mail_home_t;
  170. ')
  171. userdom_search_user_home_dirs($1)
  172. allow $1 mail_home_t:file read_file_perms;
  173. ')
  174. #######################################
  175. ## <summary>
  176. ## Create, read, write, and delete
  177. ## mta mail home files.
  178. ## </summary>
  179. ## <param name="domain">
  180. ## <summary>
  181. ## Domain allowed access.
  182. ## </summary>
  183. ## </param>
  184. #
  185. interface(`mta_manage_mail_home_files',`
  186. gen_require(`
  187. type mail_home_t;
  188. ')
  189. userdom_search_user_home_dirs($1)
  190. allow $1 mail_home_t:file manage_file_perms;
  191. ')
  192. ########################################
  193. ## <summary>
  194. ## Create specified objects in user home
  195. ## directories with the generic mail
  196. ## home type.
  197. ## </summary>
  198. ## <param name="domain">
  199. ## <summary>
  200. ## Domain allowed access.
  201. ## </summary>
  202. ## </param>
  203. ## <param name="object_class">
  204. ## <summary>
  205. ## Class of the object being created.
  206. ## </summary>
  207. ## </param>
  208. ## <param name="name" optional="true">
  209. ## <summary>
  210. ## The name of the object being created.
  211. ## </summary>
  212. ## </param>
  213. #
  214. interface(`mta_home_filetrans_mail_home',`
  215. gen_require(`
  216. type mail_home_t;
  217. ')
  218. userdom_user_home_dir_filetrans($1, mail_home_t, $2, $3)
  219. ')
  220. #######################################
  221. ## <summary>
  222. ## Create, read, write, and delete
  223. ## mta mail home rw content.
  224. ## </summary>
  225. ## <param name="domain">
  226. ## <summary>
  227. ## Domain allowed access.
  228. ## </summary>
  229. ## </param>
  230. #
  231. interface(`mta_manage_mail_home_rw_content',`
  232. gen_require(`
  233. type mail_home_rw_t;
  234. ')
  235. userdom_search_user_home_dirs($1)
  236. manage_dirs_pattern($1, mail_home_rw_t, mail_home_rw_t)
  237. manage_files_pattern($1, mail_home_rw_t, mail_home_rw_t)
  238. manage_lnk_files_pattern($1, mail_home_rw_t, mail_home_rw_t)
  239. ')
  240. ########################################
  241. ## <summary>
  242. ## Create specified objects in user home
  243. ## directories with the generic mail
  244. ## home rw type.
  245. ## </summary>
  246. ## <param name="domain">
  247. ## <summary>
  248. ## Domain allowed access.
  249. ## </summary>
  250. ## </param>
  251. ## <param name="object_class">
  252. ## <summary>
  253. ## Class of the object being created.
  254. ## </summary>
  255. ## </param>
  256. ## <param name="name" optional="true">
  257. ## <summary>
  258. ## The name of the object being created.
  259. ## </summary>
  260. ## </param>
  261. #
  262. interface(`mta_home_filetrans_mail_home_rw',`
  263. gen_require(`
  264. type mail_home_rw_t;
  265. ')
  266. userdom_user_home_dir_filetrans($1, mail_home_rw_t, $2, $3)
  267. ')
  268. ########################################
  269. ## <summary>
  270. ## Make the specified type by a system MTA.
  271. ## </summary>
  272. ## <param name="type">
  273. ## <summary>
  274. ## Type to be used as a mail client.
  275. ## </summary>
  276. ## </param>
  277. #
  278. interface(`mta_system_content',`
  279. gen_require(`
  280. attribute mailcontent_type;
  281. ')
  282. typeattribute $1 mailcontent_type;
  283. ')
  284. ########################################
  285. ## <summary>
  286. ## Modified mailserver interface for
  287. ## sendmail daemon use.
  288. ## </summary>
  289. ## <desc>
  290. ## <p>
  291. ## A modified MTA mail server interface for
  292. ## the sendmail program. It's design does
  293. ## not fit well with policy, and using the
  294. ## regular interface causes a type_transition
  295. ## conflict if direct running of init scripts
  296. ## is enabled.
  297. ## </p>
  298. ## <p>
  299. ## This interface should most likely only be used
  300. ## by the sendmail policy.
  301. ## </p>
  302. ## </desc>
  303. ## <param name="domain">
  304. ## <summary>
  305. ## The type to be used for the mail server.
  306. ## </summary>
  307. ## </param>
  308. #
  309. interface(`mta_sendmail_mailserver',`
  310. gen_require(`
  311. attribute mailserver_domain;
  312. type sendmail_exec_t;
  313. ')
  314. init_system_domain($1, sendmail_exec_t)
  315. typeattribute $1 mailserver_domain;
  316. ')
  317. #######################################
  318. ## <summary>
  319. ## Make a type a mailserver type used
  320. ## for sending mail.
  321. ## </summary>
  322. ## <param name="domain">
  323. ## <summary>
  324. ## Mail server domain type used for sending mail.
  325. ## </summary>
  326. ## </param>
  327. #
  328. interface(`mta_mailserver_sender',`
  329. gen_require(`
  330. attribute mailserver_sender;
  331. ')
  332. typeattribute $1 mailserver_sender;
  333. ')
  334. #######################################
  335. ## <summary>
  336. ## Make a type a mailserver type used
  337. ## for delivering mail to local users.
  338. ## </summary>
  339. ## <param name="domain">
  340. ## <summary>
  341. ## Mail server domain type used for delivering mail.
  342. ## </summary>
  343. ## </param>
  344. #
  345. interface(`mta_mailserver_delivery',`
  346. gen_require(`
  347. attribute mailserver_delivery;
  348. ')
  349. typeattribute $1 mailserver_delivery;
  350. ')
  351. #######################################
  352. ## <summary>
  353. ## Make a type a mailserver type used
  354. ## for sending mail on behalf of local
  355. ## users to the local mail spool.
  356. ## </summary>
  357. ## <param name="domain">
  358. ## <summary>
  359. ## Mail server domain type used for sending local mail.
  360. ## </summary>
  361. ## </param>
  362. #
  363. interface(`mta_mailserver_user_agent',`
  364. gen_require(`
  365. attribute mta_user_agent;
  366. ')
  367. typeattribute $1 mta_user_agent;
  368. ')
  369. ########################################
  370. ## <summary>
  371. ## Send mail from the system.
  372. ## </summary>
  373. ## <param name="domain">
  374. ## <summary>
  375. ## Domain allowed to transition.
  376. ## </summary>
  377. ## </param>
  378. #
  379. interface(`mta_send_mail',`
  380. gen_require(`
  381. type system_mail_t;
  382. attribute mta_exec_type;
  383. ')
  384. corecmd_search_bin($1)
  385. domtrans_pattern($1, mta_exec_type, system_mail_t)
  386. allow $1 mta_exec_type:lnk_file read_lnk_file_perms;
  387. ')
  388. ########################################
  389. ## <summary>
  390. ## Execute send mail in a specified domain.
  391. ## </summary>
  392. ## <desc>
  393. ## <p>
  394. ## Execute send mail in a specified domain.
  395. ## </p>
  396. ## <p>
  397. ## No interprocess communication (signals, pipes,
  398. ## etc.) is provided by this interface since
  399. ## the domains are not owned by this module.
  400. ## </p>
  401. ## </desc>
  402. ## <param name="source_domain">
  403. ## <summary>
  404. ## Domain allowed to transition.
  405. ## </summary>
  406. ## </param>
  407. ## <param name="target_domain">
  408. ## <summary>
  409. ## Domain to transition to.
  410. ## </summary>
  411. ## </param>
  412. #
  413. interface(`mta_sendmail_domtrans',`
  414. gen_require(`
  415. type sendmail_exec_t;
  416. ')
  417. corecmd_search_bin($1)
  418. domain_auto_trans($1, sendmail_exec_t, $2)
  419. allow $1 sendmail_exec_t:lnk_file read_lnk_file_perms;
  420. ')
  421. ########################################
  422. ## <summary>
  423. ## Send signals to system mail.
  424. ## </summary>
  425. ## <param name="domain">
  426. ## <summary>
  427. ## Domain allowed access.
  428. ## </summary>
  429. ## </param>
  430. #
  431. #
  432. interface(`mta_signal_system_mail',`
  433. gen_require(`
  434. type system_mail_t;
  435. ')
  436. allow $1 system_mail_t:process signal;
  437. ')
  438. ########################################
  439. ## <summary>
  440. ## Send kill signals to system mail.
  441. ## </summary>
  442. ## <param name="domain">
  443. ## <summary>
  444. ## Domain allowed access.
  445. ## </summary>
  446. ## </param>
  447. #
  448. interface(`mta_kill_system_mail',`
  449. gen_require(`
  450. type system_mail_t;
  451. ')
  452. allow $1 system_mail_t:process sigkill;
  453. ')
  454. ########################################
  455. ## <summary>
  456. ## Execute sendmail in the caller domain.
  457. ## </summary>
  458. ## <param name="domain">
  459. ## <summary>
  460. ## Domain allowed access.
  461. ## </summary>
  462. ## </param>
  463. #
  464. interface(`mta_sendmail_exec',`
  465. gen_require(`
  466. type sendmail_exec_t;
  467. ')
  468. corecmd_search_bin($1)
  469. can_exec($1, sendmail_exec_t)
  470. ')
  471. ########################################
  472. ## <summary>
  473. ## Read mail server configuration content.
  474. ## </summary>
  475. ## <param name="domain">
  476. ## <summary>
  477. ## Domain allowed access.
  478. ## </summary>
  479. ## </param>
  480. ## <rolecap/>
  481. #
  482. interface(`mta_read_config',`
  483. gen_require(`
  484. type etc_mail_t;
  485. ')
  486. files_search_etc($1)
  487. allow $1 etc_mail_t:dir list_dir_perms;
  488. allow $1 etc_mail_t:file read_file_perms;
  489. allow $1 etc_mail_t:lnk_file read_lnk_file_perms;
  490. ')
  491. ########################################
  492. ## <summary>
  493. ## Write mail server configuration files.
  494. ## </summary>
  495. ## <param name="domain">
  496. ## <summary>
  497. ## Domain allowed access.
  498. ## </summary>
  499. ## </param>
  500. ## <rolecap/>
  501. #
  502. interface(`mta_write_config',`
  503. gen_require(`
  504. type etc_mail_t;
  505. ')
  506. files_search_etc($1)
  507. write_files_pattern($1, etc_mail_t, etc_mail_t)
  508. ')
  509. ########################################
  510. ## <summary>
  511. ## Read mail address alias files.
  512. ## </summary>
  513. ## <param name="domain">
  514. ## <summary>
  515. ## Domain allowed access.
  516. ## </summary>
  517. ## </param>
  518. #
  519. interface(`mta_read_aliases',`
  520. gen_require(`
  521. type etc_aliases_t;
  522. ')
  523. files_search_etc($1)
  524. allow $1 etc_aliases_t:file read_file_perms;
  525. ')
  526. ########################################
  527. ## <summary>
  528. ## Create, read, write, and delete
  529. ## mail address alias content.
  530. ## </summary>
  531. ## <param name="domain">
  532. ## <summary>
  533. ## Domain allowed access.
  534. ## </summary>
  535. ## </param>
  536. #
  537. interface(`mta_manage_aliases',`
  538. gen_require(`
  539. type etc_aliases_t;
  540. ')
  541. files_search_etc($1)
  542. manage_files_pattern($1, etc_aliases_t, etc_aliases_t)
  543. manage_lnk_files_pattern($1, etc_aliases_t, etc_aliases_t)
  544. ')
  545. ########################################
  546. ## <summary>
  547. ## Create specified object in generic
  548. ## etc directories with the mail address
  549. ## alias type.
  550. ## </summary>
  551. ## <param name="domain">
  552. ## <summary>
  553. ## Domain allowed access.
  554. ## </summary>
  555. ## </param>
  556. ## <param name="object">
  557. ## <summary>
  558. ## The object class of the object being created.
  559. ## </summary>
  560. ## </param>
  561. ## <param name="name" optional="true">
  562. ## <summary>
  563. ## The name of the object being created.
  564. ## </summary>
  565. ## </param>
  566. #
  567. interface(`mta_etc_filetrans_aliases',`
  568. gen_require(`
  569. type etc_aliases_t;
  570. ')
  571. files_etc_filetrans($1, etc_aliases_t, $2, $3)
  572. ')
  573. ########################################
  574. ## <summary>
  575. ## Create specified objects in specified
  576. ## directories with a type transition to
  577. ## the mail address alias type.
  578. ## </summary>
  579. ## <param name="domain">
  580. ## <summary>
  581. ## Domain allowed access.
  582. ## </summary>
  583. ## </param>
  584. ## <param name="file_type">
  585. ## <summary>
  586. ## Directory to transition on.
  587. ## </summary>
  588. ## </param>
  589. ## <param name="object">
  590. ## <summary>
  591. ## The object class of the object being created.
  592. ## </summary>
  593. ## </param>
  594. ## <param name="name" optional="true">
  595. ## <summary>
  596. ## The name of the object being created.
  597. ## </summary>
  598. ## </param>
  599. #
  600. interface(`mta_spec_filetrans_aliases',`
  601. gen_require(`
  602. type etc_aliases_t;
  603. ')
  604. filetrans_pattern($1, $2, etc_aliases_t, $3, $4)
  605. ')
  606. ########################################
  607. ## <summary>
  608. ## Read and write mail alias files.
  609. ## </summary>
  610. ## <param name="domain">
  611. ## <summary>
  612. ## Domain allowed access.
  613. ## </summary>
  614. ## </param>
  615. ## <rolecap/>
  616. #
  617. interface(`mta_rw_aliases',`
  618. gen_require(`
  619. type etc_aliases_t;
  620. ')
  621. files_search_etc($1)
  622. allow $1 etc_aliases_t:file rw_file_perms;
  623. ')
  624. #######################################
  625. ## <summary>
  626. ## Do not audit attempts to read
  627. ## and write TCP sockets of mail
  628. ## delivery domains.
  629. ## </summary>
  630. ## <param name="domain">
  631. ## <summary>
  632. ## Domain to not audit.
  633. ## </summary>
  634. ## </param>
  635. #
  636. interface(`mta_dontaudit_rw_delivery_tcp_sockets',`
  637. gen_require(`
  638. attribute mailserver_delivery;
  639. ')
  640. dontaudit $1 mailserver_delivery:tcp_socket { read write };
  641. ')
  642. #######################################
  643. ## <summary>
  644. ## Connect to all mail servers over TCP. (Deprecated)
  645. ## </summary>
  646. ## <param name="domain">
  647. ## <summary>
  648. ## Domain allowed access.
  649. ## </summary>
  650. ## </param>
  651. #
  652. interface(`mta_tcp_connect_all_mailservers',`
  653. refpolicywarn(`$0($*) has been deprecated.')
  654. ')
  655. #######################################
  656. ## <summary>
  657. ## Do not audit attempts to read
  658. ## mail spool symlinks.
  659. ## </summary>
  660. ## <param name="domain">
  661. ## <summary>
  662. ## Domain to not audit.
  663. ## </summary>
  664. ## </param>
  665. #
  666. interface(`mta_dontaudit_read_spool_symlinks',`
  667. gen_require(`
  668. type mail_spool_t;
  669. ')
  670. dontaudit $1 mail_spool_t:lnk_file read;
  671. ')
  672. ########################################
  673. ## <summary>
  674. ## Get attributes of mail spool content.
  675. ## </summary>
  676. ## <param name="domain">
  677. ## <summary>
  678. ## Domain allowed access.
  679. ## </summary>
  680. ## </param>
  681. #
  682. interface(`mta_getattr_spool',`
  683. gen_require(`
  684. type mail_spool_t;
  685. ')
  686. files_search_spool($1)
  687. allow $1 mail_spool_t:dir list_dir_perms;
  688. getattr_files_pattern($1, mail_spool_t, mail_spool_t)
  689. read_lnk_files_pattern($1, mail_spool_t, mail_spool_t)
  690. ')
  691. ########################################
  692. ## <summary>
  693. ## Do not audit attempts to get
  694. ## attributes of mail spool files.
  695. ## </summary>
  696. ## <param name="domain">
  697. ## <summary>
  698. ## Domain to not audit.
  699. ## </summary>
  700. ## </param>
  701. #
  702. interface(`mta_dontaudit_getattr_spool_files',`
  703. gen_require(`
  704. type mail_spool_t;
  705. ')
  706. files_dontaudit_search_spool($1)
  707. dontaudit $1 mail_spool_t:dir search_dir_perms;
  708. dontaudit $1 mail_spool_t:lnk_file read_lnk_file_perms;
  709. dontaudit $1 mail_spool_t:file getattr_file_perms;
  710. ')
  711. #######################################
  712. ## <summary>
  713. ## Create specified objects in the
  714. ## mail spool directory with a
  715. ## private type.
  716. ## </summary>
  717. ## <param name="domain">
  718. ## <summary>
  719. ## Domain allowed access.
  720. ## </summary>
  721. ## </param>
  722. ## <param name="private type">
  723. ## <summary>
  724. ## The type of the object to be created.
  725. ## </summary>
  726. ## </param>
  727. ## <param name="object">
  728. ## <summary>
  729. ## The object class of the object being created.
  730. ## </summary>
  731. ## </param>
  732. ## <param name="name" optional="true">
  733. ## <summary>
  734. ## The name of the object being created.
  735. ## </summary>
  736. ## </param>
  737. #
  738. interface(`mta_spool_filetrans',`
  739. gen_require(`
  740. type mail_spool_t;
  741. ')
  742. files_search_spool($1)
  743. filetrans_pattern($1, mail_spool_t, $2, $3, $4)
  744. ')
  745. #######################################
  746. ## <summary>
  747. ## Read mail spool files.
  748. ## </summary>
  749. ## <param name="domain">
  750. ## <summary>
  751. ## Domain allowed access.
  752. ## </summary>
  753. ## </param>
  754. #
  755. interface(`mta_read_spool_files',`
  756. gen_require(`
  757. type mail_spool_t;
  758. ')
  759. files_search_spool($1)
  760. read_files_pattern($1, mail_spool_t, mail_spool_t)
  761. ')
  762. ########################################
  763. ## <summary>
  764. ## Read and write mail spool files.
  765. ## </summary>
  766. ## <param name="domain">
  767. ## <summary>
  768. ## Domain allowed access.
  769. ## </summary>
  770. ## </param>
  771. #
  772. interface(`mta_rw_spool',`
  773. gen_require(`
  774. type mail_spool_t;
  775. ')
  776. files_search_spool($1)
  777. allow $1 mail_spool_t:dir list_dir_perms;
  778. allow $1 mail_spool_t:file rw_file_perms;
  779. allow $1 mail_spool_t:lnk_file read_lnk_file_perms;
  780. ')
  781. #######################################
  782. ## <summary>
  783. ## Create, read, and write mail spool files.
  784. ## </summary>
  785. ## <param name="domain">
  786. ## <summary>
  787. ## Domain allowed access.
  788. ## </summary>
  789. ## </param>
  790. #
  791. interface(`mta_append_spool',`
  792. gen_require(`
  793. type mail_spool_t;
  794. ')
  795. files_search_spool($1)
  796. allow $1 mail_spool_t:dir list_dir_perms;
  797. manage_files_pattern($1, mail_spool_t, mail_spool_t)
  798. allow $1 mail_spool_t:lnk_file read_lnk_file_perms;
  799. ')
  800. #######################################
  801. ## <summary>
  802. ## Delete mail spool files.
  803. ## </summary>
  804. ## <param name="domain">
  805. ## <summary>
  806. ## Domain allowed access.
  807. ## </summary>
  808. ## </param>
  809. #
  810. interface(`mta_delete_spool',`
  811. gen_require(`
  812. type mail_spool_t;
  813. ')
  814. files_search_spool($1)
  815. delete_files_pattern($1, mail_spool_t, mail_spool_t)
  816. ')
  817. ########################################
  818. ## <summary>
  819. ## Create, read, write, and delete
  820. ## mail spool content.
  821. ## </summary>
  822. ## <param name="domain">
  823. ## <summary>
  824. ## Domain allowed access.
  825. ## </summary>
  826. ## </param>
  827. #
  828. interface(`mta_manage_spool',`
  829. gen_require(`
  830. type mail_spool_t;
  831. ')
  832. files_search_spool($1)
  833. manage_dirs_pattern($1, mail_spool_t, mail_spool_t)
  834. manage_files_pattern($1, mail_spool_t, mail_spool_t)
  835. manage_lnk_files_pattern($1, mail_spool_t, mail_spool_t)
  836. ')
  837. #######################################
  838. ## <summary>
  839. ## Create specified objects in the
  840. ## mail queue spool directory with a
  841. ## private type.
  842. ## </summary>
  843. ## <param name="domain">
  844. ## <summary>
  845. ## Domain allowed access.
  846. ## </summary>
  847. ## </param>
  848. ## <param name="private type">
  849. ## <summary>
  850. ## The type of the object to be created.
  851. ## </summary>
  852. ## </param>
  853. ## <param name="object">
  854. ## <summary>
  855. ## The object class of the object being created.
  856. ## </summary>
  857. ## </param>
  858. ## <param name="name" optional="true">
  859. ## <summary>
  860. ## The name of the object being created.
  861. ## </summary>
  862. ## </param>
  863. #
  864. interface(`mta_queue_filetrans',`
  865. gen_require(`
  866. type mqueue_spool_t;
  867. ')
  868. files_search_spool($1)
  869. filetrans_pattern($1, mqueue_spool_t, $2, $3, $4)
  870. ')
  871. ########################################
  872. ## <summary>
  873. ## Search mail queue directories.
  874. ## </summary>
  875. ## <param name="domain">
  876. ## <summary>
  877. ## Domain allowed access.
  878. ## </summary>
  879. ## </param>
  880. #
  881. interface(`mta_search_queue',`
  882. gen_require(`
  883. type mqueue_spool_t;
  884. ')
  885. files_search_spool($1)
  886. allow $1 mqueue_spool_t:dir search_dir_perms;
  887. ')
  888. #######################################
  889. ## <summary>
  890. ## List mail queue directories.
  891. ## </summary>
  892. ## <param name="domain">
  893. ## <summary>
  894. ## Domain allowed access.
  895. ## </summary>
  896. ## </param>
  897. #
  898. interface(`mta_list_queue',`
  899. gen_require(`
  900. type mqueue_spool_t;
  901. ')
  902. files_search_spool($1)
  903. allow $1 mqueue_spool_t:dir list_dir_perms;
  904. ')
  905. #######################################
  906. ## <summary>
  907. ## Read mail queue files.
  908. ## </summary>
  909. ## <param name="domain">
  910. ## <summary>
  911. ## Domain allowed access.
  912. ## </summary>
  913. ## </param>
  914. #
  915. interface(`mta_read_queue',`
  916. gen_require(`
  917. type mqueue_spool_t;
  918. ')
  919. files_search_spool($1)
  920. read_files_pattern($1, mqueue_spool_t, mqueue_spool_t)
  921. ')
  922. #######################################
  923. ## <summary>
  924. ## Do not audit attempts to read and
  925. ## write mail queue content.
  926. ## </summary>
  927. ## <param name="domain">
  928. ## <summary>
  929. ## Domain to not audit.
  930. ## </summary>
  931. ## </param>
  932. #
  933. interface(`mta_dontaudit_rw_queue',`
  934. gen_require(`
  935. type mqueue_spool_t;
  936. ')
  937. dontaudit $1 mqueue_spool_t:dir search_dir_perms;
  938. dontaudit $1 mqueue_spool_t:file rw_file_perms;
  939. ')
  940. ########################################
  941. ## <summary>
  942. ## Create, read, write, and delete
  943. ## mail queue content.
  944. ## </summary>
  945. ## <param name="domain">
  946. ## <summary>
  947. ## Domain allowed access.
  948. ## </summary>
  949. ## </param>
  950. #
  951. interface(`mta_manage_queue',`
  952. gen_require(`
  953. type mqueue_spool_t;
  954. ')
  955. files_search_spool($1)
  956. manage_dirs_pattern($1, mqueue_spool_t, mqueue_spool_t)
  957. manage_files_pattern($1, mqueue_spool_t, mqueue_spool_t)
  958. ')
  959. #######################################
  960. ## <summary>
  961. ## Read sendmail binary.
  962. ## </summary>
  963. ## <param name="domain">
  964. ## <summary>
  965. ## Domain allowed access.
  966. ## </summary>
  967. ## </param>
  968. #
  969. interface(`mta_read_sendmail_bin',`
  970. gen_require(`
  971. type sendmail_exec_t;
  972. ')
  973. allow $1 sendmail_exec_t:file read_file_perms;
  974. ')
  975. #######################################
  976. ## <summary>
  977. ## Read and write unix domain stream
  978. ## sockets of all base mail domains.
  979. ## </summary>
  980. ## <param name="domain">
  981. ## <summary>
  982. ## Domain allowed access.
  983. ## </summary>
  984. ## </param>
  985. #
  986. interface(`mta_rw_user_mail_stream_sockets',`
  987. gen_require(`
  988. attribute user_mail_domain;
  989. ')
  990. allow $1 user_mail_domain:unix_stream_socket rw_socket_perms;
  991. ')