get-service-accounts.asciidoc 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. [role="xpack"]
  2. [[security-api-get-service-accounts]]
  3. === Get service accounts API
  4. ++++
  5. <titleabbrev>Get service accounts</titleabbrev>
  6. ++++
  7. Retrieves information about <<service-accounts,service accounts>>.
  8. NOTE: Currently, only the `elastic/fleet-server` service account is available.
  9. [[security-api-get-service-accounts-request]]
  10. ==== {api-request-title}
  11. `GET /_security/service`
  12. `GET /_security/service/<namespace>`
  13. `GET /_security/service/<namespace>/<service>`
  14. [[security-api-get-service-accounts-prereqs]]
  15. ==== {api-prereq-title}
  16. * To use this API, you must have at least the `manage_service_account`
  17. <<privileges-list-cluster,cluster privilege>>.
  18. [[security-api-get-service-accounts-desc]]
  19. ==== {api-description-title}
  20. This API returns a list of service accounts that match the provided path parameter(s).
  21. [[security-api-get-service-accounts-path-params]]
  22. ==== {api-path-parms-title}
  23. `namespace`::
  24. (Optional, string) Name of the namespace. Omit this parameter to retrieve information about all service accounts. If you omit this parameter, you must also omit the `service` parameter.
  25. `service`::
  26. (Optional, string) Name of the service name. Omit this parameter to
  27. retrieve information about all service accounts that belong to the specified
  28. `namespace`.
  29. [[security-api-get-service-accounts-response-body]]
  30. ==== {api-response-body-title}
  31. A successful call returns a JSON object of service accounts. The API returns an
  32. empty object if no service account is found.
  33. [[security-api-get-service-accounts-example]]
  34. ==== {api-examples-title}
  35. To following request retrieves a service account for the `elastic/fleet-server`
  36. service account:
  37. [source,console]
  38. ----
  39. GET /_security/service/elastic/fleet-server
  40. ----
  41. [source,console-result]
  42. ----
  43. {
  44. "elastic/fleet-server": {
  45. "role_descriptor": {
  46. "cluster": [
  47. "monitor",
  48. "manage_own_api_key",
  49. "read_fleet_secrets"
  50. ],
  51. "indices": [
  52. {
  53. "names": [
  54. "logs-*",
  55. "metrics-*",
  56. "traces-*",
  57. ".logs-endpoint.diagnostic.collection-*",
  58. ".logs-endpoint.action.responses-*",
  59. ".logs-endpoint.heartbeat-*"
  60. ],
  61. "privileges": [
  62. "write",
  63. "create_index",
  64. "auto_configure"
  65. ],
  66. "allow_restricted_indices": false
  67. },
  68. {
  69. "names": [
  70. "profiling-*"
  71. ],
  72. "privileges": [
  73. "read",
  74. "write"
  75. ],
  76. "allow_restricted_indices": false
  77. },
  78. {
  79. "names": [
  80. "traces-apm.sampled-*"
  81. ],
  82. "privileges": [
  83. "read",
  84. "monitor",
  85. "maintenance"
  86. ],
  87. "allow_restricted_indices": false
  88. },
  89. {
  90. "names": [
  91. ".fleet-secrets*"
  92. ],
  93. "privileges": [
  94. "read"
  95. ],
  96. "allow_restricted_indices": true
  97. },
  98. {
  99. "names": [
  100. ".fleet-actions*"
  101. ],
  102. "privileges": [
  103. "read",
  104. "write",
  105. "monitor",
  106. "create_index",
  107. "auto_configure",
  108. "maintenance"
  109. ],
  110. "allow_restricted_indices": true
  111. },
  112. {
  113. "names": [
  114. ".fleet-agents*"
  115. ],
  116. "privileges": [
  117. "read",
  118. "write",
  119. "monitor",
  120. "create_index",
  121. "auto_configure",
  122. "maintenance"
  123. ],
  124. "allow_restricted_indices": true
  125. },
  126. {
  127. "names": [
  128. ".fleet-artifacts*"
  129. ],
  130. "privileges": [
  131. "read",
  132. "write",
  133. "monitor",
  134. "create_index",
  135. "auto_configure",
  136. "maintenance"
  137. ],
  138. "allow_restricted_indices": true
  139. },
  140. {
  141. "names": [
  142. ".fleet-enrollment-api-keys*"
  143. ],
  144. "privileges": [
  145. "read",
  146. "write",
  147. "monitor",
  148. "create_index",
  149. "auto_configure",
  150. "maintenance"
  151. ],
  152. "allow_restricted_indices": true
  153. },
  154. {
  155. "names": [
  156. ".fleet-policies*"
  157. ],
  158. "privileges": [
  159. "read",
  160. "write",
  161. "monitor",
  162. "create_index",
  163. "auto_configure",
  164. "maintenance"
  165. ],
  166. "allow_restricted_indices": true
  167. },
  168. {
  169. "names": [
  170. ".fleet-policies-leader*"
  171. ],
  172. "privileges": [
  173. "read",
  174. "write",
  175. "monitor",
  176. "create_index",
  177. "auto_configure",
  178. "maintenance"
  179. ],
  180. "allow_restricted_indices": true
  181. },
  182. {
  183. "names": [
  184. ".fleet-servers*"
  185. ],
  186. "privileges": [
  187. "read",
  188. "write",
  189. "monitor",
  190. "create_index",
  191. "auto_configure",
  192. "maintenance"
  193. ],
  194. "allow_restricted_indices": true
  195. },
  196. {
  197. "names": [
  198. ".fleet-fileds*"
  199. ],
  200. "privileges": [
  201. "read",
  202. "write",
  203. "monitor",
  204. "create_index",
  205. "auto_configure",
  206. "maintenance"
  207. ],
  208. "allow_restricted_indices": true
  209. },
  210. {
  211. "names": [
  212. "synthetics-*"
  213. ],
  214. "privileges": [
  215. "read",
  216. "write",
  217. "create_index",
  218. "auto_configure"
  219. ],
  220. "allow_restricted_indices": false
  221. }
  222. ],
  223. "applications": [
  224. {
  225. "application": "kibana-*",
  226. "privileges": [
  227. "reserved_fleet-setup"
  228. ],
  229. "resources": [
  230. "*"
  231. ]
  232. }
  233. ],
  234. "run_as": [],
  235. "metadata": {},
  236. "transient_metadata": {
  237. "enabled": true
  238. }
  239. }
  240. }
  241. }
  242. ----
  243. Omit the `namespace` and `service` to retrieve all service accounts:
  244. [source,console]
  245. ----
  246. GET /_security/service
  247. ----