add searchguard
[clamp.git] / src / main / docker / elasticsearch / config / sg / sg_roles.yml
1 #<sg_role_name>:
2 #  cluster:
3 #    - '<permission>'
4 #  indices:
5 #    '<indexname or alias>':
6 #      '<type>':  
7 #        - '<permission>'
8 #      _dls_: '<dls query>'
9 #      _fls_:
10 #        - '<field>'
11 #        - '<field>'
12
13 # When a user make a request to Elasticsearch then the following roles will be evaluated to see if the user has
14 # permissions for the request. A request is always associated with an action and is executed against and index (or alias)
15 # and a type. If a request is executed against all indices (or all types) then the asterix ('*') is needed.
16 # Every role a user has will be examined if it allows the action against an index (or type). At least one role must match
17 # for the request to be successful. If no role match then the request will be denied. Currently a match must happen within
18 # one single role - that means that permissions can not span multiple roles. 
19
20 # For <permission>, <indexname or alias> and <type> simple wildcards and regular expressions are possible. 
21 # A asterix (*) will match any character sequence (or an empty sequence)
22 # A question mark (?) will match any single character (but NOT empty character)
23 # Example: '*my*index' will match 'my_first_index' as well as 'myindex' but not 'myindex1'
24 # Example: '?kibana' will match '.kibana' but not 'kibana'
25
26 # To use a full blown regex you have to pre- and apend a '/' to use regex instead of simple wildcards
27 # '/<java regex>/'
28 # Example: '/\S*/' will match any non whitespace characters
29
30 # Important: 
31 # Index, alias or type names can not contain dots (.) in the <indexname or alias> or <type> expression.
32 # Reason is that we currently parse the config file into a elasticsearch settings object which cannot cope with dots in keys.
33 # Workaround: Just configure something like '?kibana' instead of '.kibana' or 'my?index' instead of 'my.index'
34 # This limitation will likely removed with Search Guard 6
35
36 # DLS (Document level security) - NOT FREE FOR COMMERCIAL
37 # http://docs.search-guard.com/v6/document-level-security
38
39 # FLS (Field level security) - NOT FREE FOR COMMERCIAL
40 # http://docs.search-guard.com/v6/field-level-security
41
42 # Kibana multitenancy - NOT FREE FOR COMMERCIAL
43 # http://docs.search-guard.com/v6/kibana-multi-tenancy
44
45 # Allows everything, but no changes to searchguard configuration index
46 sg_all_access:
47   readonly: true
48   cluster:
49     - UNLIMITED
50   indices:
51     '*':
52       '*':
53         - UNLIMITED
54   tenants:
55     admin_tenant: RW
56
57 # Read all, but no write permissions
58 sg_readall:
59   readonly: true
60   cluster:
61     - CLUSTER_COMPOSITE_OPS_RO
62   indices:
63     '*':
64       '*':
65         - READ
66
67 # Read all and monitor, but no write permissions 
68 sg_readall_and_monitor:
69   cluster:
70     - CLUSTER_MONITOR
71     - CLUSTER_COMPOSITE_OPS_RO
72   indices:
73     '*':
74       '*':
75         - READ
76
77 # For users which use kibana, access to indices must be granted separately
78 sg_kibana_user:
79   readonly: true
80   cluster:
81     - INDICES_MONITOR
82     - CLUSTER_COMPOSITE_OPS
83   indices:
84     '?kibana':
85       '*':
86         - MANAGE
87         - INDEX
88         - READ
89         - DELETE
90     '?kibana-6':
91       '*':
92         - MANAGE
93         - INDEX
94         - READ
95         - DELETE
96     '?kibana_*':
97       '*':
98         - MANAGE
99         - INDEX
100         - READ
101         - DELETE
102     '?tasks':
103       '*':
104         - INDICES_ALL
105     '?management-beats':
106       '*':
107         - INDICES_ALL        
108     '*':
109       '*':
110         - indices:data/read/field_caps*
111         - indices:data/read/xpack/rollup*
112         - indices:admin/mappings/get*
113         - indices:admin/get
114
115 # For the kibana server
116 sg_kibana_server:
117   readonly: true
118   cluster:
119       - CLUSTER_MONITOR
120       - CLUSTER_COMPOSITE_OPS
121       - cluster:admin/xpack/monitoring*
122       - indices:admin/template*
123       - indices:data/read/scroll*
124   indices:
125     '?kibana':
126       '*':
127         - INDICES_ALL
128     '?kibana-6':
129       '*':
130         - INDICES_ALL
131     '?kibana_*':
132       '*':
133         - INDICES_ALL
134     '?reporting*':
135       '*':
136         - INDICES_ALL
137     '?monitoring*':
138       '*':
139         - INDICES_ALL
140     '?tasks':
141       '*':
142         - INDICES_ALL
143     '?management-beats*':
144       '*':
145         - INDICES_ALL
146     '*':
147       '*':
148         - "indices:admin/aliases*"
149
150 # For logstash and beats
151 sg_logstash:  
152   cluster:
153     - ES_INPUT
154     - CLUSTER_MONITOR
155     - CLUSTER_COMPOSITE_OPS
156     - indices:admin/template/get
157     - indices:admin/template/put
158   indices:
159     'logstash-*':
160       '*':
161         - INDEX_OWNER
162     '*beat*':
163       '*':
164         - INDEX_OWNER
165     'dmaap*':
166       '*':
167         - INDEX_OWNER
168     'events*':
169       '*':
170         - INDEX_OWNER
171     'errors*':
172       '*':
173         - INDEX_OWNER
174
175 # Allows adding and modifying repositories and creating and restoring snapshots
176 sg_manage_snapshots:
177   cluster:
178     - MANAGE_SNAPSHOTS
179   indices:
180     '*':
181       '*':
182         - "indices:data/write/index"
183         - "indices:admin/create"
184
185 # Allows each user to access own named index
186 sg_own_index:
187   cluster:
188     - CLUSTER_COMPOSITE_OPS
189   indices:
190     '${user_name}':
191       '*':
192         - INDICES_ALL
193
194 ### X-Pack COMPATIBILITY
195 sg_xp_monitoring:
196   readonly: true
197   cluster:
198     - cluster:monitor/xpack/info
199     - cluster:monitor/main
200     - cluster:admin/xpack/monitoring/bulk
201   indices:
202     '?monitor*':
203       '*':
204         - INDICES_ALL
205
206 sg_xp_alerting:
207   readonly: true
208   cluster:
209     - indices:data/read/scroll
210     - cluster:admin/xpack/watcher*
211     - cluster:monitor/xpack/watcher*
212   indices:
213     '?watches*':
214       '*':
215         - INDICES_ALL
216     '?watcher-history-*':
217       '*':
218         - INDICES_ALL
219     '?triggered_watches':
220       '*':
221         - INDICES_ALL
222     '*':
223       '*':
224         - READ
225         - indices:admin/aliases/get
226
227 sg_xp_machine_learning:
228   readonly: true
229   cluster:
230     - cluster:admin/persistent*
231     - cluster:internal/xpack/ml*
232     - indices:data/read/scroll*
233     - cluster:admin/xpack/ml*
234     - cluster:monitor/xpack/ml*
235   indices:
236     '*':
237       '*':
238         - READ
239         - indices:admin/get*
240     '?ml-*':
241       '*':
242         - "*"
243
244
245 ### LEGACY ROLES, FOR COMPATIBILITY ONLY
246 ### WILL BE REMOVED IN SG7, DO NOT USE ANYMORE
247
248 sg_readonly_and_monitor:
249   cluster:
250     - CLUSTER_MONITOR
251     - CLUSTER_COMPOSITE_OPS_RO
252   indices:
253     '*':
254       '*':
255         - READ
256
257 # Make xpack monitoring work
258 sg_monitor:
259   cluster:
260     - cluster:admin/xpack/monitoring/*
261     - cluster:admin/ingest/pipeline/put       
262     - cluster:admin/ingest/pipeline/get
263     - indices:admin/template/get
264     - indices:admin/template/put
265     - CLUSTER_MONITOR
266     - CLUSTER_COMPOSITE_OPS
267   indices:
268     '?monitor*':
269       '*':
270         - INDICES_ALL
271     '?marvel*':
272       '*':
273         - INDICES_ALL
274     '?kibana*':
275       '*':
276         - READ
277     '*':
278       '*':
279         - indices:data/read/field_caps
280
281 # Make xpack alerting work
282 sg_alerting:
283   cluster:
284     - indices:data/read/scroll
285     - cluster:admin/xpack/watcher/watch/put
286     - cluster:admin/xpack/watcher*
287     - CLUSTER_MONITOR
288     - CLUSTER_COMPOSITE_OPS
289   indices:
290     '?kibana*':
291       '*':
292         - READ
293     '?watches*':
294       '*':
295         - INDICES_ALL
296     '?watcher-history-*':
297       '*':
298         - INDICES_ALL
299     '?triggered_watches':
300       '*':
301         - INDICES_ALL
302     '*':
303       '*':
304         - READ