@@ -23,113 +23,7 @@ To define users, the {security-features} provide the
23
23
<<users-command,users>> command-line tool. This tool enables you to add
24
24
and remove users, assign user roles, and manage user passwords.
25
25
26
- [discrete]
27
26
[[file-realm-configuration]]
28
27
==== Configuring a file realm
29
28
30
- You can manage and authenticate users with the built-in `file` internal realm.
31
- All the data about the users for the `file` realm is stored in two files on each
32
- node in the cluster: `users` and `users_roles`. Both files are located in
33
- `ES_PATH_CONF` and are read on startup.
34
-
35
- [IMPORTANT]
36
- ==============================
37
- The `users` and `users_roles` files are managed locally by the node and are
38
- **not** managed globally by the cluster. This means that with a typical
39
- multi-node cluster, the exact same changes need to be applied on each and every
40
- node in the cluster.
41
-
42
- A safer approach would be to apply the change on one of the nodes and have the
43
- files distributed or copied to all other nodes in the cluster (either manually
44
- or using a configuration management system such as Puppet or Chef).
45
- ==============================
46
-
47
- The `file` realm is added to the realm chain by default. You don't need to
48
- explicitly configure a `file` realm.
49
-
50
- For more information about file realms, see <<file-realm>>.
51
-
52
- . (Optional) Add a realm configuration to `elasticsearch.yml` under the
53
- `xpack.security.authc.realms.file` namespace. At a minimum, you must set
54
- the realm's `order` attribute.
55
- +
56
- --
57
- //See <<ref-users-settings>> for all of the options you can set for a `file` realm.
58
-
59
- For example, the following snippet shows a `file` realm configuration that sets
60
- the `order` to zero so the realm is checked first:
61
-
62
- [source, yaml]
63
- ------------------------------------------------------------
64
- xpack:
65
- security:
66
- authc:
67
- realms:
68
- file:
69
- file1:
70
- order: 0
71
- ------------------------------------------------------------
72
- --
73
-
74
- . Restart {es}.
75
-
76
- . Add user information to the `ES_PATH_CONF/users` file on each node in the
77
- cluster.
78
- +
79
- --
80
- The `users` file stores all the users and their passwords. Each line in the file
81
- represents a single user entry consisting of the username and **hashed** and **salted** password.
82
-
83
- [source,bash]
84
- ----------------------------------------------------------------------
85
- rdeniro:$2a$10$BBJ/ILiyJ1eBTYoRKxkqbuDEdYECplvxnqQ47uiowE7yGqvCEgj9W
86
- alpacino:$2a$10$cNwHnElYiMYZ/T3K4PvzGeJ1KbpXZp2PfoQD.gfaVdImnHOwIuBKS
87
- jacknich:{PBKDF2}50000$z1CLJt0MEFjkIK5iEfgvfnA6xq7lF25uasspsTKSo5Q=$XxCVLbaKDimOdyWgLCLJiyoiWpA/XDMe/xtVgn1r5Sg=
88
- ----------------------------------------------------------------------
89
-
90
- NOTE: To limit exposure to credential theft and mitigate credential compromise,
91
- the file realm stores passwords and caches user credentials according to
92
- security best practices. By default, a hashed version of user credentials
93
- is stored in memory, using a salted `sha-256` hash algorithm and a hashed
94
- version of passwords is stored on disk salted and hashed with the `bcrypt`
95
- hash algorithm. To use different hash algorithms, see <<hashing-settings>>.
96
-
97
- While it is possible to modify the `users` files directly using any standard text
98
- editor, we strongly recommend using the <<users-command>> tool to apply the
99
- required changes.
100
-
101
- IMPORTANT: As the administrator of the cluster, it is your responsibility to
102
- ensure the same users are defined on every node in the cluster.
103
- The {es} {security-features} do not deliver any mechanisms to
104
- guarantee this.
105
-
106
- --
107
-
108
- . Add role information to the `ES_PATH_CONF/users_roles` file on each node
109
- in the cluster.
110
- +
111
- --
112
- The `users_roles` file stores the roles associated with the users. For example:
113
-
114
- [source,shell]
115
- --------------------------------------------------
116
- admin:rdeniro
117
- power_user:alpacino,jacknich
118
- user:jacknich
119
- --------------------------------------------------
120
-
121
- Each row maps a role to a comma-separated list of all the users that are
122
- associated with that role.
123
-
124
- You can use the <<users-command>> tool to update this file. You must ensure that
125
- the same changes are made on every node in the cluster.
126
- --
127
-
128
- . (Optional) Change how often the `users` and `users_roles` files are checked.
129
- +
130
- --
131
- By default, {es} checks these files for changes every 5 seconds. You can
132
- change this default behavior by changing the `resource.reload.interval.high`
133
- setting in the `elasticsearch.yml` file (as this is a common setting in {es},
134
- changing its value may effect other schedules in the system).
135
- --
29
+ include::configuring-file-realm.asciidoc[]
0 commit comments