Elasticsearch 基于字段值的访问控制

Elasticsearch access control based on field value

我目前正在研究用于集中式日志文件分析的 ELK(Elasticsearch、Logstash、Kibana)堆栈。

计划使用 logstash 和基于天的索引将多个应用程序的日志存储在同一个 Elasticsearch 集群中。

所有文档都包含一个名为应用程序的字段,例如"application":"superapp"。

现在我们正在寻找一种方法来实现这样的访问控制:

A) 超级用户: 能够查看所有应用程序的日志条目。

B) 开发人员: 只能查看他被允许查看的应用程序的日志条目。例如,应用程序 "superapp" 的开发团队应该只能看到此应用程序的条目。

总结一下:我们需要基于字段应用程序中的值的访问控制。

在阅读 Elastisearch 和 Shield 的文档时,我找不到明显的方法。

有什么想法可以让我们以同样适用于 Kibana 3 和 4 的方式实现这一点吗?

我的第一个想法是使用使用索引模板自动分配给文档的别名。我想知道这是否是正确的方向。

我在 elasticsearch Google 组上问了这个问题 here 并得到了这个回复:

"You can separate out the different types of logs into their own indices which would make things much easier, you could also setup an alias with a filter and then provide access to that alias to certain users. Currently KB isn't multi-tenanted but it is a feature that is going to be added, you'd have to setup multiple instances with each going to their own alias."

总结一下:多租户需要在前端 (Kibana) 和后端 (Elasticsearch) 解决。

前端:为 Kibana 使用代理
https://github.com/salyh/elastic-defender
https://github.com/fangli/kibana-authentication-proxy

后端:使用过滤别名和别名模板的几种方法
Limiting Indexes and Operations
Faking Index per User with Aliases -
http://engineering.aweber.com/using-elasticsearchs-aliases/
http://opennomad.com/content/controlling-access-elasticsearch-filtered-aliases-nginx-and-tokens