get-service-accounts.asciidoc 6.6 KB

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