iptables.if 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. ## <summary>Policy for iptables.</summary>
  2. ########################################
  3. ## <summary>
  4. ## Execute iptables in the iptables domain.
  5. ## </summary>
  6. ## <param name="domain">
  7. ## <summary>
  8. ## Domain allowed to transition.
  9. ## </summary>
  10. ## </param>
  11. #
  12. interface(`iptables_domtrans',`
  13. gen_require(`
  14. type iptables_t, iptables_exec_t;
  15. ')
  16. corecmd_search_bin($1)
  17. domtrans_pattern($1, iptables_exec_t, iptables_t)
  18. ifdef(`hide_broken_symptoms', `
  19. dontaudit iptables_t $1:socket_class_set { read write };
  20. ')
  21. ')
  22. ########################################
  23. ## <summary>
  24. ## Execute iptables in the iptables domain, and
  25. ## allow the specified role the iptables domain.
  26. ## </summary>
  27. ## <param name="domain">
  28. ## <summary>
  29. ## Domain allowed to transition.
  30. ## </summary>
  31. ## </param>
  32. ## <param name="role">
  33. ## <summary>
  34. ## Role allowed access.
  35. ## </summary>
  36. ## </param>
  37. ## <rolecap/>
  38. #
  39. interface(`iptables_run',`
  40. gen_require(`
  41. attribute_role iptables_roles;
  42. ')
  43. iptables_domtrans($1)
  44. roleattribute $2 iptables_roles;
  45. ')
  46. ########################################
  47. ## <summary>
  48. ## Execute iptables in the caller domain.
  49. ## </summary>
  50. ## <param name="domain">
  51. ## <summary>
  52. ## Domain allowed access.
  53. ## </summary>
  54. ## </param>
  55. #
  56. interface(`iptables_exec',`
  57. gen_require(`
  58. type iptables_exec_t;
  59. ')
  60. corecmd_search_bin($1)
  61. can_exec($1, iptables_exec_t)
  62. ')
  63. #####################################
  64. ## <summary>
  65. ## Execute iptables in the iptables domain.
  66. ## </summary>
  67. ## <param name="domain">
  68. ## <summary>
  69. ## Domain allowed to transition.
  70. ## </summary>
  71. ## </param>
  72. #
  73. interface(`iptables_initrc_domtrans',`
  74. gen_require(`
  75. type iptables_initrc_exec_t;
  76. ')
  77. init_labeled_script_domtrans($1, iptables_initrc_exec_t)
  78. ')
  79. #####################################
  80. ## <summary>
  81. ## Set the attributes of iptables config files.
  82. ## </summary>
  83. ## <param name="domain">
  84. ## <summary>
  85. ## Domain allowed access.
  86. ## </summary>
  87. ## </param>
  88. #
  89. interface(`iptables_setattr_config',`
  90. gen_require(`
  91. type iptables_conf_t;
  92. ')
  93. files_search_etc($1)
  94. allow $1 iptables_conf_t:file setattr;
  95. ')
  96. #####################################
  97. ## <summary>
  98. ## Read iptables config files.
  99. ## </summary>
  100. ## <param name="domain">
  101. ## <summary>
  102. ## Domain allowed access.
  103. ## </summary>
  104. ## </param>
  105. #
  106. interface(`iptables_read_config',`
  107. gen_require(`
  108. type iptables_conf_t;
  109. ')
  110. files_search_etc($1)
  111. allow $1 iptables_conf_t:dir list_dir_perms;
  112. read_files_pattern($1, iptables_conf_t, iptables_conf_t)
  113. ')
  114. #####################################
  115. ## <summary>
  116. ## Create files in /etc with the type used for
  117. ## the iptables config files.
  118. ## </summary>
  119. ## <param name="domain">
  120. ## <summary>
  121. ## Domain allowed access.
  122. ## </summary>
  123. ## </param>
  124. #
  125. interface(`iptables_etc_filetrans_config',`
  126. gen_require(`
  127. type iptables_conf_t;
  128. ')
  129. files_etc_filetrans($1, iptables_conf_t, file)
  130. ')
  131. ###################################
  132. ## <summary>
  133. ## Manage iptables config files.
  134. ## </summary>
  135. ## <param name="domain">
  136. ## <summary>
  137. ## Domain allowed access.
  138. ## </summary>
  139. ## </param>
  140. #
  141. interface(`iptables_manage_config',`
  142. gen_require(`
  143. type iptables_conf_t;
  144. type etc_t;
  145. ')
  146. files_search_etc($1)
  147. manage_files_pattern($1, iptables_conf_t, iptables_conf_t)
  148. ')