get-service-accounts.asciidoc 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  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. "auto_configure"
  76. ],
  77. "allow_restricted_indices": false
  78. },
  79. {
  80. "names": [
  81. "traces-apm.sampled-*"
  82. ],
  83. "privileges": [
  84. "read",
  85. "monitor",
  86. "maintenance"
  87. ],
  88. "allow_restricted_indices": false
  89. },
  90. {
  91. "names": [
  92. ".fleet-secrets*"
  93. ],
  94. "privileges": [
  95. "read"
  96. ],
  97. "allow_restricted_indices": true
  98. },
  99. {
  100. "names": [
  101. ".fleet-actions*"
  102. ],
  103. "privileges": [
  104. "read",
  105. "write",
  106. "monitor",
  107. "create_index",
  108. "auto_configure",
  109. "maintenance"
  110. ],
  111. "allow_restricted_indices": true
  112. },
  113. {
  114. "names": [
  115. ".fleet-agents*"
  116. ],
  117. "privileges": [
  118. "read",
  119. "write",
  120. "monitor",
  121. "create_index",
  122. "auto_configure",
  123. "maintenance"
  124. ],
  125. "allow_restricted_indices": true
  126. },
  127. {
  128. "names": [
  129. ".fleet-artifacts*"
  130. ],
  131. "privileges": [
  132. "read",
  133. "write",
  134. "monitor",
  135. "create_index",
  136. "auto_configure",
  137. "maintenance"
  138. ],
  139. "allow_restricted_indices": true
  140. },
  141. {
  142. "names": [
  143. ".fleet-enrollment-api-keys*"
  144. ],
  145. "privileges": [
  146. "read",
  147. "write",
  148. "monitor",
  149. "create_index",
  150. "auto_configure",
  151. "maintenance"
  152. ],
  153. "allow_restricted_indices": true
  154. },
  155. {
  156. "names": [
  157. ".fleet-policies*"
  158. ],
  159. "privileges": [
  160. "read",
  161. "write",
  162. "monitor",
  163. "create_index",
  164. "auto_configure",
  165. "maintenance"
  166. ],
  167. "allow_restricted_indices": true
  168. },
  169. {
  170. "names": [
  171. ".fleet-policies-leader*"
  172. ],
  173. "privileges": [
  174. "read",
  175. "write",
  176. "monitor",
  177. "create_index",
  178. "auto_configure",
  179. "maintenance"
  180. ],
  181. "allow_restricted_indices": true
  182. },
  183. {
  184. "names": [
  185. ".fleet-servers*"
  186. ],
  187. "privileges": [
  188. "read",
  189. "write",
  190. "monitor",
  191. "create_index",
  192. "auto_configure",
  193. "maintenance"
  194. ],
  195. "allow_restricted_indices": true
  196. },
  197. {
  198. "names": [
  199. ".fleet-fileds*"
  200. ],
  201. "privileges": [
  202. "read",
  203. "write",
  204. "monitor",
  205. "create_index",
  206. "auto_configure",
  207. "maintenance"
  208. ],
  209. "allow_restricted_indices": true
  210. },
  211. {
  212. "names": [
  213. "synthetics-*"
  214. ],
  215. "privileges": [
  216. "read",
  217. "write",
  218. "create_index",
  219. "auto_configure"
  220. ],
  221. "allow_restricted_indices": false
  222. }
  223. ],
  224. "applications": [
  225. {
  226. "application": "kibana-*",
  227. "privileges": [
  228. "reserved_fleet-setup"
  229. ],
  230. "resources": [
  231. "*"
  232. ]
  233. }
  234. ],
  235. "run_as": [],
  236. "metadata": {},
  237. "transient_metadata": {
  238. "enabled": true
  239. }
  240. }
  241. }
  242. }
  243. ----
  244. Omit the `namespace` and `service` to retrieve all service accounts:
  245. [source,console]
  246. ----
  247. GET /_security/service
  248. ----