【问题标题】:How to set authentication in kibana如何在kibana中设置身份验证
【发布时间】:2015-07-20 06:16:21
【问题描述】:

是否可以在 Kibana 中启用身份验证以限制对仪表板的访问仅限特定用户访问?

【问题讨论】:

    标签: kibana kibana-4


    【解决方案1】:

    Kibana 本身不支持身份验证或限制对仪表板的访问。

    您可以在 Kibana 前面使用 nginx 作为代理 限制对 Kibana 4 的访问,如下所述:https://serverfault.com/a/345244。只需将 proxy_pass 设置为端口 5601 并在防火墙上为其他人禁用此端口。这将完全启用或禁用 Kibana。

    Elastic 还有一个名为 Shield 的工具,可让您管理 elasticsearch 的安全性。例如,使用 Shield,您可以允许某人以只读权限分析特定索引中的数据。 https://www.elastic.co/products/shield


    编辑:Elastic 在 github 上有一个 issue,他们建议使用 Shield

    1. these instructions 之后安装 Shield(用于 elasticsearch 的插件)
    2. Configure roles Kibana 用户
    3. Configure Kibana 与 Shield 合作

    Remember Shield 仅提供索引级访问控制。这意味着用户 A 将能够看到所有仪表板,但其中一些是空的(因为他无权访问所有索引)。

    【讨论】:

    • 我是否可以使用 nginx 作为代理来限制 kibana 中的仪表板。假设有 2 个用户用户 A 和用户 B。用户 A 在 Kibana 中只能看到 2 个仪表板中的一个,而用户 B 可以查看 kibana 中的所有仪表板。
    • 这里可能值得注意 - 虽然可以免费使用 elasticsearch,但 shield 是订阅,因此可以试用 30 天,但需要持续付费。
    • @Sobrique 试试这个:github.com/floragunncom/search-guard - 它应该是屏蔽的免费替代品。
    • 我不鼓励在 HTTP 级别应用访问控制(除非您只对单个 root 用户的 HTTP Basic Auth 感兴趣)。您可以拥有安全的只读 Kibana 仪表板 + 使用此插件仅显示一些索引:github.com/sscarduzio/elasticsearch-readonlyrest-plugin
    • 官方包现在称为“x-pack”(以前称为 shield,30 天免费试用,然后订阅)elastic.co/products/x-pack/security。另一种选择是使用 Elastic 的托管解决方案,称为“Cloud”,它内置了 x-pack。 (14 天免费试用,然后订阅)elastic.co/cloud/as-a-service
    【解决方案2】:

    检查这个名为elasticsearch-readonlyrest 的插件。 它允许通过身份验证或 ip/网络、x-forwarded-for 标头轻松控制访问,并允许在 kibana 中设置读写或只读访问,并限制每个用户的索引访问。它设置简单,应该为大多数人提供足够的控制。

    如果需要更多控制,您可以使用search-guard,这是一个免费的屏蔽替代品。

    【讨论】:

    • 我在 elasticsearch 数据库上使用它。这是否也支持 kibana 中的安全性?
    • 是的,这将在 elasticsearch 访问和 kibana 中请求身份验证(因为它也请求浏览器访问 elasticsearch)。付费版还有一个 kibana 插件,可以控制每个用户在 kibana 中显示的内容
    【解决方案3】:

    Kibana4 目前不支持这个。

    【讨论】:

      【解决方案4】:

      我已经通过安装haproxy实现了身份验证。

      1. 在本地限制 kibana

      $sudo nano /etc/kibana/kibana.yml

      server.host: "localhost"
      

      2.在安装了kibana的同一台机器上安装haproxy

      $ sudo apt update && sudo apt install haproxy

      $ sudo nano /etc/haproxy/haproxy.cfg

      global
      log /dev/log    local0
      log /dev/log    local1 notice
      chroot /var/lib/haproxy
      stats socket /run/haproxy/admin.sock mode 660 level admin
      stats timeout 30s
      user haproxy
      group haproxy
      daemon
      # Default SSL material locations
      ca-base /etc/ssl/certs
      crt-base /etc/ssl/private
      
      # Default ciphers to use on SSL-enabled listening sockets.
      # For more information, see ciphers(1SSL). This list is from:
      #  https://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/
      ssl-default-bind-ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS
      ssl-default-bind-options no-sslv3
      
      defaults
      log global
      mode    http
      option  httplog
      option  dontlognull
          timeout connect 10m
          timeout client  10m
          timeout server  10m
      errorfile 400 /etc/haproxy/errors/400.http
      errorfile 403 /etc/haproxy/errors/403.http
      errorfile 408 /etc/haproxy/errors/408.http
      errorfile 500 /etc/haproxy/errors/500.http
      errorfile 502 /etc/haproxy/errors/502.http
      errorfile 503 /etc/haproxy/errors/503.http
      errorfile 504 /etc/haproxy/errors/504.http
      
      userlist UsersFor_Kibana
          user kibana insecure-password myPASSWORD
      
      frontend localnodes
           bind *:80 
           mode http
           default_backend nodes
      
      backend nodes 
         acl AuthOkay_Kibana http_auth(UsersFor_Kibana) 
         http-request auth realm Kibana if !AuthOkay_Kibana
         mode http
         balance roundrobin
         option forwardfor
         http-request set-header X-Forwarded-Port %[dst_port]
         http-request add-header X-Forwarded-Proto https if { ssl_fc }
         option httpchk HEAD / HTTP/1.1\r\nHost:localhost
         server server1 127.0.0.1:5601 check
      

      用户名:-“kibana” 密码:-“我的密码”

      当您浏览http://IP:80 时,会弹出一个用于身份验证的窗口。

      【讨论】:

        【解决方案5】:

        老问题,但我想补充一点,aws 有一个开源版本的 elk。您也许可以使用 elastic.co 版本中的插件。 https://github.com/opendistro-for-elasticsearch/security

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2021-06-28
          • 1970-01-01
          • 2019-06-28
          • 1970-01-01
          • 1970-01-01
          • 2020-02-01
          • 2023-03-15
          • 2022-01-23
          相关资源
          最近更新 更多