apm.if 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. ## <summary>Advanced power management.</summary>
  2. ########################################
  3. ## <summary>
  4. ## Execute apm in the apm domain.
  5. ## </summary>
  6. ## <param name="domain">
  7. ## <summary>
  8. ## Domain allowed to transition.
  9. ## </summary>
  10. ## </param>
  11. #
  12. interface(`apm_domtrans_client',`
  13. gen_require(`
  14. type apm_t, apm_exec_t;
  15. ')
  16. corecmd_search_bin($1)
  17. domtrans_pattern($1, apm_exec_t, apm_t)
  18. ')
  19. ########################################
  20. ## <summary>
  21. ## Execute apm in the apm domain
  22. ## and allow the specified role
  23. ## the apm domain.
  24. ## </summary>
  25. ## <param name="domain">
  26. ## <summary>
  27. ## Domain allowed to transition.
  28. ## </summary>
  29. ## </param>
  30. ## <param name="role">
  31. ## <summary>
  32. ## Role allowed access.
  33. ## </summary>
  34. ## </param>
  35. #
  36. interface(`apm_run_client',`
  37. gen_require(`
  38. attribute_role apm_roles;
  39. ')
  40. apm_domtrans_client($1)
  41. roleattribute $2 apm_roles;
  42. ')
  43. ########################################
  44. ## <summary>
  45. ## Use apmd file descriptors.
  46. ## </summary>
  47. ## <param name="domain">
  48. ## <summary>
  49. ## Domain allowed access.
  50. ## </summary>
  51. ## </param>
  52. #
  53. interface(`apm_use_fds',`
  54. gen_require(`
  55. type apmd_t;
  56. ')
  57. allow $1 apmd_t:fd use;
  58. ')
  59. ########################################
  60. ## <summary>
  61. ## Write apmd unnamed pipes.
  62. ## </summary>
  63. ## <param name="domain">
  64. ## <summary>
  65. ## Domain allowed access.
  66. ## </summary>
  67. ## </param>
  68. #
  69. interface(`apm_write_pipes',`
  70. gen_require(`
  71. type apmd_t;
  72. ')
  73. allow $1 apmd_t:fifo_file write;
  74. ')
  75. ########################################
  76. ## <summary>
  77. ## Read and write to apmd unix
  78. ## stream sockets.
  79. ## </summary>
  80. ## <param name="domain">
  81. ## <summary>
  82. ## Domain allowed access.
  83. ## </summary>
  84. ## </param>
  85. #
  86. interface(`apm_rw_stream_sockets',`
  87. gen_require(`
  88. type apmd_t;
  89. ')
  90. allow $1 apmd_t:unix_stream_socket { read write };
  91. ')
  92. ########################################
  93. ## <summary>
  94. ## Append apmd log files.
  95. ## </summary>
  96. ## <param name="domain">
  97. ## <summary>
  98. ## Domain allowed access.
  99. ## </summary>
  100. ## </param>
  101. #
  102. interface(`apm_append_log',`
  103. gen_require(`
  104. type apmd_log_t;
  105. ')
  106. logging_search_logs($1)
  107. allow $1 apmd_log_t:file append_file_perms;
  108. ')
  109. ########################################
  110. ## <summary>
  111. ## Connect to apmd over an unix
  112. ## stream socket.
  113. ## </summary>
  114. ## <param name="domain">
  115. ## <summary>
  116. ## Domain allowed access.
  117. ## </summary>
  118. ## </param>
  119. #
  120. interface(`apm_stream_connect',`
  121. gen_require(`
  122. type apmd_t, apmd_var_run_t;
  123. ')
  124. files_search_pids($1)
  125. stream_connect_pattern($1, apmd_var_run_t, apmd_var_run_t, apmd_t)
  126. ')
  127. ########################################
  128. ## <summary>
  129. ## All of the rules required to
  130. ## administrate an apm environment.
  131. ## </summary>
  132. ## <param name="domain">
  133. ## <summary>
  134. ## Domain allowed access.
  135. ## </summary>
  136. ## </param>
  137. ## <param name="role">
  138. ## <summary>
  139. ## Role allowed access.
  140. ## </summary>
  141. ## </param>
  142. ## <rolecap/>
  143. #
  144. interface(`apm_admin',`
  145. gen_require(`
  146. type apmd_t, apmd_initrc_exec_t, apmd_log_t;
  147. type apmd_lock_t, apmd_var_run_t, apmd_var_lib_t;
  148. type apmd_tmp_t;
  149. ')
  150. allow $1 apmd_t:process { ptrace signal_perms };
  151. ps_process_pattern($1, apmd_t)
  152. init_labeled_script_domtrans($1, apmd_initrc_exec_t)
  153. domain_system_change_exemption($1)
  154. role_transition $2 apmd_initrc_exec_t system_r;
  155. allow $2 system_r;
  156. logging_search_logs($1)
  157. admin_pattern($1, apmd_log_t)
  158. files_search_locks($1)
  159. admin_pattern($1, apmd_lock_t)
  160. files_search_pids($1)
  161. admin_pattern($1, apmd_var_run_t)
  162. files_search_var_lib($1)
  163. admin_pattern($1, apmd_var_lib_t)
  164. files_search_tmp($1)
  165. admin_pattern($1, apmd_tmp_t)
  166. apm_run_client($1, $2)
  167. ')