ntp.if 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. ## <summary>Network time protocol daemon.</summary>
  2. ########################################
  3. ## <summary>
  4. ## NTP 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(`ntp_stub',`
  13. gen_require(`
  14. type ntpd_t;
  15. ')
  16. ')
  17. ########################################
  18. ## <summary>
  19. ## Read ntp.conf
  20. ## </summary>
  21. ## <param name="domain" unused="true">
  22. ## <summary>
  23. ## Domain allowed access.
  24. ## </summary>
  25. ## </param>
  26. #
  27. interface(`ntp_read_conf',`
  28. gen_require(`
  29. type ntp_conf_t;
  30. ')
  31. allow $1 ntp_conf_t:file read_file_perms;
  32. ')
  33. ########################################
  34. ## <summary>
  35. ## Execute ntp server in the ntpd domain.
  36. ## </summary>
  37. ## <param name="domain">
  38. ## <summary>
  39. ## Domain allowed to transition.
  40. ## </summary>
  41. ## </param>
  42. #
  43. interface(`ntp_domtrans',`
  44. gen_require(`
  45. type ntpd_t, ntpd_exec_t;
  46. ')
  47. corecmd_search_bin($1)
  48. domtrans_pattern($1, ntpd_exec_t, ntpd_t)
  49. ')
  50. ########################################
  51. ## <summary>
  52. ## Execute ntp in the ntp domain, and
  53. ## allow the specified role the ntp domain.
  54. ## </summary>
  55. ## <param name="domain">
  56. ## <summary>
  57. ## Domain allowed to transition.
  58. ## </summary>
  59. ## </param>
  60. ## <param name="role">
  61. ## <summary>
  62. ## Role allowed access.
  63. ## </summary>
  64. ## </param>
  65. ## <rolecap/>
  66. #
  67. interface(`ntp_run',`
  68. gen_require(`
  69. attribute_role ntpd_roles;
  70. ')
  71. ntp_domtrans($1)
  72. roleattribute $2 ntpd_roles;
  73. ')
  74. ########################################
  75. ## <summary>
  76. ## Execute ntpdate server in the ntpd domain.
  77. ## </summary>
  78. ## <param name="domain">
  79. ## <summary>
  80. ## Domain allowed to transition.
  81. ## </summary>
  82. ## </param>
  83. #
  84. interface(`ntp_domtrans_ntpdate',`
  85. gen_require(`
  86. type ntpd_t, ntpdate_exec_t;
  87. ')
  88. corecmd_search_bin($1)
  89. domtrans_pattern($1, ntpdate_exec_t, ntpd_t)
  90. ')
  91. ########################################
  92. ## <summary>
  93. ## Execute ntpd init scripts in
  94. ## the init script domain.
  95. ## </summary>
  96. ## <param name="domain">
  97. ## <summary>
  98. ## Domain allowed to transition.
  99. ## </summary>
  100. ## </param>
  101. #
  102. interface(`ntp_initrc_domtrans',`
  103. gen_require(`
  104. type ntpd_initrc_exec_t;
  105. ')
  106. init_labeled_script_domtrans($1, ntpd_initrc_exec_t)
  107. ')
  108. ########################################
  109. ## <summary>
  110. ## Read ntp conf files.
  111. ## </summary>
  112. ## <param name="domain">
  113. ## <summary>
  114. ## Domain allowed access.
  115. ## </summary>
  116. ## </param>
  117. #
  118. interface(`ntp_read_conf_files',`
  119. gen_require(`
  120. type ntp_conf_t;
  121. ')
  122. files_search_etc($1)
  123. read_files_pattern($1, ntp_conf_t, ntp_conf_t)
  124. ')
  125. ########################################
  126. ## <summary>
  127. ## Read ntp drift files.
  128. ## </summary>
  129. ## <param name="domain">
  130. ## <summary>
  131. ## Domain allowed access.
  132. ## </summary>
  133. ## </param>
  134. #
  135. interface(`ntp_read_drift_files',`
  136. gen_require(`
  137. type ntp_drift_t;
  138. ')
  139. files_search_var_lib($1)
  140. read_files_pattern($1, ntp_drift_t, ntp_drift_t)
  141. ')
  142. ########################################
  143. ## <summary>
  144. ## Read and write ntpd shared memory.
  145. ## </summary>
  146. ## <param name="domain">
  147. ## <summary>
  148. ## Domain allowed access.
  149. ## </summary>
  150. ## </param>
  151. #
  152. interface(`ntp_rw_shm',`
  153. gen_require(`
  154. type ntpd_t, ntpd_tmpfs_t;
  155. ')
  156. allow $1 ntpd_t:shm rw_shm_perms;
  157. list_dirs_pattern($1, ntpd_tmpfs_t, ntpd_tmpfs_t)
  158. rw_files_pattern($1, ntpd_tmpfs_t, ntpd_tmpfs_t)
  159. read_lnk_files_pattern($1, ntpd_tmpfs_t, ntpd_tmpfs_t)
  160. fs_search_tmpfs($1)
  161. ')
  162. ########################################
  163. ## <summary>
  164. ## All of the rules required to
  165. ## administrate an ntp environment.
  166. ## </summary>
  167. ## <param name="domain">
  168. ## <summary>
  169. ## Domain allowed access.
  170. ## </summary>
  171. ## </param>
  172. ## <param name="role">
  173. ## <summary>
  174. ## Role allowed access.
  175. ## </summary>
  176. ## </param>
  177. ## <rolecap/>
  178. #
  179. interface(`ntp_admin',`
  180. gen_require(`
  181. type ntpd_t, ntpd_tmp_t, ntpd_log_t;
  182. type ntpd_key_t, ntpd_var_run_t, ntp_conf_t;
  183. type ntpd_initrc_exec_t, ntp_drift_t;
  184. ')
  185. allow $1 ntpd_t:process { ptrace signal_perms };
  186. ps_process_pattern($1, ntpd_t)
  187. init_startstop_service($1, $2, ntpd_t, ntpd_initrc_exec_t)
  188. files_list_etc($1)
  189. admin_pattern($1, { ntpd_key_t ntp_conf_t })
  190. logging_list_logs($1)
  191. admin_pattern($1, ntpd_log_t)
  192. files_list_tmp($1)
  193. admin_pattern($1, ntpd_tmp_t)
  194. files_list_var_lib($1)
  195. admin_pattern($1, ntp_drift_t)
  196. files_list_pids($1)
  197. admin_pattern($1, ntpd_var_run_t)
  198. ntp_run($1, $2)
  199. ')