bind.if 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  1. ## <summary>Berkeley Internet name domain DNS server.</summary>
  2. ########################################
  3. ## <summary>
  4. ## Execute bind server in the bind domain.
  5. ## </summary>
  6. ## <param name="domain">
  7. ## <summary>
  8. ## Domain allowed to transition.
  9. ## </summary>
  10. ## </param>
  11. #
  12. interface(`bind_initrc_domtrans',`
  13. gen_require(`
  14. type named_initrc_exec_t;
  15. ')
  16. init_labeled_script_domtrans($1, named_initrc_exec_t)
  17. ')
  18. ########################################
  19. ## <summary>
  20. ## Execute ndc in the ndc domain.
  21. ## </summary>
  22. ## <param name="domain">
  23. ## <summary>
  24. ## Domain allowed to transition.
  25. ## </summary>
  26. ## </param>
  27. #
  28. interface(`bind_domtrans_ndc',`
  29. gen_require(`
  30. type ndc_t, ndc_exec_t;
  31. ')
  32. corecmd_search_bin($1)
  33. domtrans_pattern($1, ndc_exec_t, ndc_t)
  34. ')
  35. ########################################
  36. ## <summary>
  37. ## Send generic signals to bind.
  38. ## </summary>
  39. ## <param name="domain">
  40. ## <summary>
  41. ## Domain allowed access.
  42. ## </summary>
  43. ## </param>
  44. #
  45. interface(`bind_signal',`
  46. gen_require(`
  47. type named_t;
  48. ')
  49. allow $1 named_t:process signal;
  50. ')
  51. ########################################
  52. ## <summary>
  53. ## Send null signals to bind.
  54. ## </summary>
  55. ## <param name="domain">
  56. ## <summary>
  57. ## Domain allowed access.
  58. ## </summary>
  59. ## </param>
  60. #
  61. interface(`bind_signull',`
  62. gen_require(`
  63. type named_t;
  64. ')
  65. allow $1 named_t:process signull;
  66. ')
  67. ########################################
  68. ## <summary>
  69. ## Send kill signals to bind.
  70. ## </summary>
  71. ## <param name="domain">
  72. ## <summary>
  73. ## Domain allowed access.
  74. ## </summary>
  75. ## </param>
  76. #
  77. interface(`bind_kill',`
  78. gen_require(`
  79. type named_t;
  80. ')
  81. allow $1 named_t:process sigkill;
  82. ')
  83. ########################################
  84. ## <summary>
  85. ## Execute ndc in the ndc domain, and
  86. ## allow the specified role the ndc domain.
  87. ## </summary>
  88. ## <param name="domain">
  89. ## <summary>
  90. ## Domain allowed to transition.
  91. ## </summary>
  92. ## </param>
  93. ## <param name="role">
  94. ## <summary>
  95. ## Role allowed access.
  96. ## </summary>
  97. ## </param>
  98. ## <rolecap/>
  99. #
  100. interface(`bind_run_ndc',`
  101. gen_require(`
  102. attribute_role ndc_roles;
  103. ')
  104. bind_domtrans_ndc($1)
  105. roleattribute $2 ndc_roles;
  106. ')
  107. ########################################
  108. ## <summary>
  109. ## Execute bind in the named domain.
  110. ## </summary>
  111. ## <param name="domain">
  112. ## <summary>
  113. ## Domain allowed to transition.
  114. ## </summary>
  115. ## </param>
  116. #
  117. interface(`bind_domtrans',`
  118. gen_require(`
  119. type named_t, named_exec_t;
  120. ')
  121. corecmd_search_bin($1)
  122. domtrans_pattern($1, named_exec_t, named_t)
  123. ')
  124. ########################################
  125. ## <summary>
  126. ## Read dnssec key files.
  127. ## </summary>
  128. ## <param name="domain">
  129. ## <summary>
  130. ## Domain allowed access.
  131. ## </summary>
  132. ## </param>
  133. #
  134. interface(`bind_read_dnssec_keys',`
  135. gen_require(`
  136. type named_conf_t, named_zone_t, dnssec_t;
  137. ')
  138. read_files_pattern($1, { named_conf_t named_zone_t }, dnssec_t)
  139. ')
  140. ########################################
  141. ## <summary>
  142. ## Read bind named configuration files.
  143. ## </summary>
  144. ## <param name="domain">
  145. ## <summary>
  146. ## Domain allowed access.
  147. ## </summary>
  148. ## </param>
  149. #
  150. interface(`bind_read_config',`
  151. gen_require(`
  152. type named_conf_t;
  153. ')
  154. read_files_pattern($1, named_conf_t, named_conf_t)
  155. ')
  156. ########################################
  157. ## <summary>
  158. ## Write bind named configuration files.
  159. ## </summary>
  160. ## <param name="domain">
  161. ## <summary>
  162. ## Domain allowed access.
  163. ## </summary>
  164. ## </param>
  165. #
  166. interface(`bind_write_config',`
  167. gen_require(`
  168. type named_conf_t;
  169. ')
  170. write_files_pattern($1, named_conf_t, named_conf_t)
  171. allow $1 named_conf_t:file setattr_file_perms;
  172. ')
  173. ########################################
  174. ## <summary>
  175. ## Create, read, write, and delete
  176. ## bind configuration directories.
  177. ## </summary>
  178. ## <param name="domain">
  179. ## <summary>
  180. ## Domain allowed access.
  181. ## </summary>
  182. ## </param>
  183. #
  184. interface(`bind_manage_config_dirs',`
  185. gen_require(`
  186. type named_conf_t;
  187. ')
  188. manage_dirs_pattern($1, named_conf_t, named_conf_t)
  189. ')
  190. ########################################
  191. ## <summary>
  192. ## Search bind cache directories.
  193. ## </summary>
  194. ## <param name="domain">
  195. ## <summary>
  196. ## Domain allowed access.
  197. ## </summary>
  198. ## </param>
  199. #
  200. interface(`bind_search_cache',`
  201. gen_require(`
  202. type named_conf_t, named_cache_t, named_zone_t;
  203. ')
  204. files_search_var($1)
  205. allow $1 named_conf_t:dir search_dir_perms;
  206. allow $1 named_zone_t:dir search_dir_perms;
  207. allow $1 named_cache_t:dir search_dir_perms;
  208. ')
  209. ########################################
  210. ## <summary>
  211. ## Create, read, write, and delete
  212. ## bind cache files.
  213. ## </summary>
  214. ## <param name="domain">
  215. ## <summary>
  216. ## Domain allowed access.
  217. ## </summary>
  218. ## </param>
  219. #
  220. interface(`bind_manage_cache',`
  221. gen_require(`
  222. type named_cache_t, named_zone_t;
  223. ')
  224. files_search_var($1)
  225. allow $1 named_zone_t:dir search_dir_perms;
  226. manage_files_pattern($1, named_cache_t, named_cache_t)
  227. manage_lnk_files_pattern($1, named_cache_t, named_cache_t)
  228. ')
  229. ########################################
  230. ## <summary>
  231. ## Set attributes of bind pid directories.
  232. ## </summary>
  233. ## <param name="domain">
  234. ## <summary>
  235. ## Domain allowed access.
  236. ## </summary>
  237. ## </param>
  238. #
  239. interface(`bind_setattr_pid_dirs',`
  240. gen_require(`
  241. type named_var_run_t;
  242. ')
  243. allow $1 named_var_run_t:dir setattr_dir_perms;
  244. ')
  245. ########################################
  246. ## <summary>
  247. ## Set attributes of bind zone directories.
  248. ## </summary>
  249. ## <param name="domain">
  250. ## <summary>
  251. ## Domain allowed access.
  252. ## </summary>
  253. ## </param>
  254. #
  255. interface(`bind_setattr_zone_dirs',`
  256. gen_require(`
  257. type named_zone_t;
  258. ')
  259. allow $1 named_zone_t:dir setattr_dir_perms;
  260. ')
  261. ########################################
  262. ## <summary>
  263. ## Read bind zone files.
  264. ## </summary>
  265. ## <param name="domain">
  266. ## <summary>
  267. ## Domain allowed access.
  268. ## </summary>
  269. ## </param>
  270. #
  271. interface(`bind_read_zone',`
  272. gen_require(`
  273. type named_zone_t;
  274. ')
  275. files_search_var($1)
  276. read_files_pattern($1, named_zone_t, named_zone_t)
  277. ')
  278. ########################################
  279. ## <summary>
  280. ## Create, read, write, and delete
  281. ## bind zone files.
  282. ## </summary>
  283. ## <param name="domain">
  284. ## <summary>
  285. ## Domain allowed access.
  286. ## </summary>
  287. ## </param>
  288. #
  289. interface(`bind_manage_zone',`
  290. gen_require(`
  291. type named_zone_t;
  292. ')
  293. files_search_var($1)
  294. manage_files_pattern($1, named_zone_t, named_zone_t)
  295. ')
  296. ########################################
  297. ## <summary>
  298. ## Send and receive datagrams to and from named. (Deprecated)
  299. ## </summary>
  300. ## <param name="domain">
  301. ## <summary>
  302. ## Domain allowed access.
  303. ## </summary>
  304. ## </param>
  305. #
  306. interface(`bind_udp_chat_named',`
  307. refpolicywarn(`$0($*) has been deprecated.')
  308. ')
  309. ########################################
  310. ## <summary>
  311. ## All of the rules required to
  312. ## administrate an bind environment.
  313. ## </summary>
  314. ## <param name="domain">
  315. ## <summary>
  316. ## Domain allowed access.
  317. ## </summary>
  318. ## </param>
  319. ## <param name="role">
  320. ## <summary>
  321. ## Role allowed access.
  322. ## </summary>
  323. ## </param>
  324. ## <rolecap/>
  325. #
  326. interface(`bind_admin',`
  327. gen_require(`
  328. type named_t, named_tmp_t, named_log_t;
  329. type named_cache_t, named_zone_t, named_initrc_exec_t;
  330. type dnssec_t, ndc_t, named_conf_t, named_var_run_t;
  331. type named_keytab_t;
  332. ')
  333. allow $1 { named_t ndc_t }:process { ptrace signal_perms };
  334. ps_process_pattern($1, { named_t ndc_t })
  335. init_labeled_script_domtrans($1, named_initrc_exec_t)
  336. domain_system_change_exemption($1)
  337. role_transition $2 named_initrc_exec_t system_r;
  338. allow $2 system_r;
  339. files_list_tmp($1)
  340. admin_pattern($1, named_tmp_t)
  341. logging_list_logs($1)
  342. admin_pattern($1, named_log_t)
  343. files_list_etc($1)
  344. admin_pattern($1, { named_keytab_t named_conf_t })
  345. files_list_var($1)
  346. admin_pattern($1, { dnssec_t named_cache_t named_zone_t })
  347. files_list_pids($1)
  348. admin_pattern($1, named_var_run_t)
  349. bind_run_ndc($1, $2)
  350. ')