configuring-file-realm.asciidoc 4.3 KB

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