remote-clusters-privileges-api-key.asciidoc 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. [[remote-clusters-privileges-api-key]]
  2. === Configure roles and users
  3. To use a remote cluster for {ccr} or {ccs}, you need to create user roles with
  4. <<roles-remote-indices-priv,remote indices privileges>> or
  5. <<roles-remote-cluster-priv, remote cluster privileges>> on the local cluster.
  6. You can manage users and roles from Stack Management in {kib} by selecting
  7. *Security > Roles* from the side navigation. You can also use the
  8. <<security-role-apis,role management APIs>> to add, update, remove, and retrieve
  9. roles dynamically.
  10. The following examples use the <<security-api-put-role>> API. You must have at
  11. least the `manage_security` cluster privilege to use this API.
  12. NOTE: The cross-cluster API key used by the local cluster to connect the remote
  13. cluster must have sufficient privileges to cover all remote indices privileges
  14. required by individual users.
  15. ==== Configure privileges for {ccr}
  16. Assuming the remote cluster is connected under the name of `my_remote_cluster`,
  17. the following request creates a role called `remote-replication` on the local
  18. cluster that allows replicating the remote `leader-index` index:
  19. [source,console]
  20. ----
  21. POST /_security/role/remote-replication
  22. {
  23. "cluster": [
  24. "manage_ccr"
  25. ],
  26. "remote_indices": [
  27. {
  28. "clusters": [ "my_remote_cluster" ],
  29. "names": [
  30. "leader-index"
  31. ],
  32. "privileges": [
  33. "cross_cluster_replication"
  34. ]
  35. }
  36. ]
  37. }
  38. ----
  39. // TEST[skip:TODO]
  40. After creating the local `remote-replication` role, use the
  41. <<security-api-put-user>> API to create a user on the local cluster cluster and
  42. assign the `remote-replication` role. For example, the following request assigns
  43. the `remote-replication` role to a user named `cross-cluster-user`:
  44. [source,console]
  45. ----
  46. POST /_security/user/cross-cluster-user
  47. {
  48. "password" : "l0ng-r4nd0m-p@ssw0rd",
  49. "roles" : [ "remote-replication" ]
  50. }
  51. ----
  52. // TEST[skip:TODO]
  53. Note that you only need to create this user on the local cluster.
  54. ==== Configure privileges for {ccs}
  55. Assuming the remote cluster is connected under the name of `my_remote_cluster`,
  56. the following request creates a `remote-search` role on the local cluster that
  57. allows searching the remote `target-index` index:
  58. [source,console]
  59. ----
  60. POST /_security/role/remote-search
  61. {
  62. "remote_indices": [
  63. {
  64. "clusters": [ "my_remote_cluster" ],
  65. "names": [
  66. "target-index"
  67. ],
  68. "privileges": [
  69. "read",
  70. "read_cross_cluster",
  71. "view_index_metadata"
  72. ]
  73. }
  74. ]
  75. }
  76. ----
  77. // TEST[skip:TODO]
  78. After creating the `remote-search` role, use the <<security-api-put-user>> API
  79. to create a user on the local cluster and assign the `remote-search` role. For
  80. example, the following request assigns the `remote-search` role to a user named
  81. `cross-search-user`:
  82. [source,console]
  83. ----
  84. POST /_security/user/cross-search-user
  85. {
  86. "password" : "l0ng-r4nd0m-p@ssw0rd",
  87. "roles" : [ "remote-search" ]
  88. }
  89. ----
  90. // TEST[skip:TODO]
  91. Note that you only need to create this user on the local cluster.