|
1 | 1 | [role="xpack"]
|
2 | 2 | [[securing-aliases]]
|
3 |
| -=== Granting privileges for data streams and index aliases |
| 3 | +=== Granting privileges for data streams and aliases |
4 | 4 |
|
5 | 5 | {es} {security-features} allow you to secure operations executed against
|
6 | 6 | <<data-streams,data streams>> and <<alias,aliases>>.
|
|
9 | 9 | ==== Data stream privileges
|
10 | 10 |
|
11 | 11 | // tag::data-stream-security[]
|
12 |
| - |
13 |
| -Use <<privileges-list-indices,indices privileges>> to control access to |
14 |
| -a data stream. Any role or user granted privileges to a data |
15 |
| -stream are automatically granted the same privileges to its backing indices. |
| 12 | +Use <<privileges-list-indices,index privileges>> to control access to a data |
| 13 | +stream. Granting privileges on a data stream grants the same privileges on its |
| 14 | +backing indices. |
16 | 15 | // end::data-stream-security[]
|
17 | 16 |
|
18 | 17 | For example, `my-data-stream` consists of two backing indices:
|
@@ -64,100 +63,45 @@ GET .ds-my-data-stream-2099.03.09-000003/_doc/2
|
64 | 63 | // TEST[s/.ds-my-data-stream-2099.03.09-000003/my-index/]
|
65 | 64 |
|
66 | 65 | [[index-alias-privileges]]
|
67 |
| -==== Index alias privileges |
| 66 | +==== Alias privileges |
| 67 | + |
| 68 | +Use <<privileges-list-indices,index privileges>> to control access to an |
| 69 | +<<alias,alias>>. Privileges on an index or data stream do not grant privileges |
| 70 | +on its aliases. For information about managing aliases, see <<alias>>. |
68 | 71 |
|
69 |
| -An index alias points to one or more indices, |
70 |
| -holds metadata and potentially a filter. The {es} {security-features} treat |
71 |
| -aliases and indices |
72 |
| -the same. Privileges for indices actions are granted on specific indices or |
73 |
| -aliases. In order for an indices action to be authorized, the user that executes |
74 |
| -it needs to have permissions for that action on all the specific indices or |
75 |
| -aliases that the request relates to. |
| 72 | +IMPORTANT: Don't use <<filter-alias,filtered aliases>> in place of |
| 73 | +<<document-level-security,document level security>>. {es} doesn't always apply |
| 74 | +alias filters. |
76 | 75 |
|
77 |
| -Let's look at an example. Assuming we have an index called `2015`, an alias that |
78 |
| -points to it called `current_year`, and a user with the following role: |
| 76 | +For example, the `current_year` alias points only to the `2015` index. A user is |
| 77 | +granted the `read` privilege for the `2015` index. |
79 | 78 |
|
80 | 79 | [source,js]
|
81 |
| --------------------------------------------------- |
| 80 | +---- |
82 | 81 | {
|
83 | 82 | "names" : [ "2015" ],
|
84 | 83 | "privileges" : [ "read" ]
|
85 | 84 | }
|
86 |
| --------------------------------------------------- |
| 85 | +---- |
87 | 86 | // NOTCONSOLE
|
88 | 87 |
|
89 |
| -The user attempts to retrieve a document from `current_year`: |
| 88 | +When the user attempts to retrieve a document from the `current_year` alias, |
| 89 | +{es} rejects the request. |
90 | 90 |
|
91 | 91 | [source,console]
|
92 |
| -------------------------------------------------------------------------------- |
93 |
| -GET /current_year/_doc/1 |
94 |
| -------------------------------------------------------------------------------- |
| 92 | +---- |
| 93 | +GET current_year/_doc/1 |
| 94 | +---- |
95 | 95 | // TEST[s/^/PUT 2015\n{"aliases": {"current_year": {}}}\nPUT 2015\/_doc\/1\n{}\n/]
|
96 | 96 |
|
97 |
| -The above request gets rejected, although the user has `read` privilege on the |
98 |
| -concrete index that the `current_year` alias points to. The correct permission |
99 |
| -would be as follows: |
| 97 | +To retrieve documents from `current_year`, the user must have the `read` index |
| 98 | +privilege for the alias. |
100 | 99 |
|
101 | 100 | [source,js]
|
102 |
| --------------------------------------------------- |
| 101 | +---- |
103 | 102 | {
|
104 | 103 | "names" : [ "current_year" ],
|
105 | 104 | "privileges" : [ "read" ]
|
106 | 105 | }
|
107 |
| --------------------------------------------------- |
108 |
| -// NOTCONSOLE |
109 |
| - |
110 |
| -[discrete] |
111 |
| -==== Managing aliases |
112 |
| - |
113 |
| -Unlike creating indices, which requires the `create_index` privilege, adding, |
114 |
| -removing and retrieving aliases requires the `manage` permission. Aliases can be |
115 |
| -added to an index directly as part of the index creation: |
116 |
| - |
117 |
| -[source,console] |
118 |
| -------------------------------------------------------------------------------- |
119 |
| -PUT /2015 |
120 |
| -{ |
121 |
| - "aliases": { |
122 |
| - "current_year": {} |
123 |
| - } |
124 |
| -} |
125 |
| -------------------------------------------------------------------------------- |
126 |
| - |
127 |
| -or via the dedicated aliases api if the index already exists: |
128 |
| - |
129 |
| -[source,console] |
130 |
| -------------------------------------------------------------------------------- |
131 |
| -POST /_aliases |
132 |
| -{ |
133 |
| - "actions" : [ |
134 |
| - { "add" : { "index" : "2015", "alias" : "current_year" } } |
135 |
| - ] |
136 |
| -} |
137 |
| -------------------------------------------------------------------------------- |
138 |
| -// TEST[s/^/PUT 2015\n/] |
139 |
| - |
140 |
| -The above requests both require the `manage` privilege on the alias name as well |
141 |
| -as the targeted index, as follows: |
142 |
| - |
143 |
| -[source,js] |
144 |
| --------------------------------------------------- |
145 |
| -{ |
146 |
| - "names" : [ "20*", "current_year" ], |
147 |
| - "privileges" : [ "manage" ] |
148 |
| -} |
149 |
| --------------------------------------------------- |
| 106 | +---- |
150 | 107 | // NOTCONSOLE
|
151 |
| - |
152 |
| -The index aliases api also allows also to delete aliases from existing indices. |
153 |
| -The privileges required for such a request are the same as above. Both index and |
154 |
| -alias need the `manage` permission. |
155 |
| - |
156 |
| - |
157 |
| -[discrete] |
158 |
| -==== Filtered aliases |
159 |
| - |
160 |
| -Aliases can hold a filter, which allows to select a subset of documents that can |
161 |
| -be accessed out of all the documents that the physical index contains. These |
162 |
| -filters are not always applied and should not be used in place of |
163 |
| -<<document-level-security,document level security>>. |
0 commit comments