configuring-file-realm.asciidoc 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. All the data about the users for the `file` realm is stored in two files on each
  2. node in the cluster: `users` and `users_roles`. Both files are located in
  3. `ES_PATH_CONF` and are read on startup.
  4. [IMPORTANT]
  5. ==============================
  6. The `users` and `users_roles` files are managed locally by the node and are
  7. **not** managed globally by the cluster. This means that with a typical
  8. multi-node cluster, the exact same changes need to be applied on each and every
  9. node in the cluster.
  10. A safer approach would be to apply the change on one of the nodes and have the
  11. files distributed or copied to all other nodes in the cluster (either manually
  12. or using a configuration management system such as Puppet or Chef).
  13. ==============================
  14. The `file` realm is added to the realm chain by default. You don't need to
  15. explicitly configure a `file` realm.
  16. . (Optional) Add a realm configuration to `elasticsearch.yml` under the
  17. `xpack.security.authc.realms.file` namespace. At a minimum, you must set
  18. the realm's `order` attribute.
  19. +
  20. --
  21. //See <<ref-users-settings>> for all of the options you can set for a `file` realm.
  22. For example, the following snippet shows a `file` realm configuration that sets
  23. the `order` to zero so the realm is checked first:
  24. [source, yaml]
  25. ------------------------------------------------------------
  26. xpack:
  27. security:
  28. authc:
  29. realms:
  30. file:
  31. file1:
  32. order: 0
  33. ------------------------------------------------------------
  34. --
  35. . Restart {es}.
  36. . Add user information to the `ES_PATH_CONF/users` file on each node in the
  37. cluster.
  38. +
  39. --
  40. The `users` file stores all the users and their passwords. Each line in the file
  41. represents a single user entry consisting of the username and **hashed** and **salted** password.
  42. [source,bash]
  43. ----------------------------------------------------------------------
  44. rdeniro:$2a$10$BBJ/ILiyJ1eBTYoRKxkqbuDEdYECplvxnqQ47uiowE7yGqvCEgj9W
  45. alpacino:$2a$10$cNwHnElYiMYZ/T3K4PvzGeJ1KbpXZp2PfoQD.gfaVdImnHOwIuBKS
  46. jacknich:{PBKDF2}50000$z1CLJt0MEFjkIK5iEfgvfnA6xq7lF25uasspsTKSo5Q=$XxCVLbaKDimOdyWgLCLJiyoiWpA/XDMe/xtVgn1r5Sg=
  47. ----------------------------------------------------------------------
  48. NOTE: To limit exposure to credential theft and mitigate credential compromise,
  49. the file realm stores passwords and caches user credentials according to
  50. security best practices. By default, a hashed version of user credentials
  51. is stored in memory, using a salted `sha-256` hash algorithm and a hashed
  52. version of passwords is stored on disk salted and hashed with the `bcrypt`
  53. hash algorithm. To use different hash algorithms, see <<hashing-settings>>.
  54. While it is possible to modify the `users` files directly using any standard text
  55. editor, we strongly recommend using the <<users-command>> tool to apply the
  56. required changes.
  57. IMPORTANT: As the administrator of the cluster, it is your responsibility to
  58. ensure the same users are defined on every node in the cluster.
  59. The {es} {security-features} do not deliver any mechanisms to
  60. guarantee this.
  61. --
  62. . Add role information to the `ES_PATH_CONF/users_roles` file on each node
  63. in the cluster.
  64. +
  65. --
  66. The `users_roles` file stores the roles associated with the users. For example:
  67. [source,shell]
  68. --------------------------------------------------
  69. admin:rdeniro
  70. power_user:alpacino,jacknich
  71. user:jacknich
  72. --------------------------------------------------
  73. Each row maps a role to a comma-separated list of all the users that are
  74. associated with that role.
  75. You can use the <<users-command>> tool to update this file. You must ensure that
  76. the same changes are made on every node in the cluster.
  77. --
  78. . (Optional) Change how often the `users` and `users_roles` files are checked.
  79. +
  80. --
  81. By default, {es} checks these files for changes every 5 seconds. You can
  82. change this default behavior by changing the `resource.reload.interval.high`
  83. setting in the `elasticsearch.yml` file (as this is a common setting in {es},
  84. changing its value may effect other schedules in the system).
  85. --