Xpack集成LDAP


支持兩種配置方式:

The ldap realm supports two modes of operation, a user search mode and a mode with specific templates for user DNs.

a、User Search Mode
b、User DN Templates Mode

這里我用的是第二種,因為不需要明文配置LDAP的admin密碼。

1、修改ES配置文件,添加LDAP配置

 # vim /etc/elasticsearch/elasticsearch.yml

 xpack:
  security:
    authc:
      realms:
        ldap1:
          type: ldap
          order: 0
          url: "ldap://192.168.2.164:389"
          user_dn_templates:
            - "uid={0},ou=Users,dc=beijing,dc=op"
          group_search:
            base_dn: "dc=beijing,dc=op"
          files:
            role_mapping: "/etc/elasticsearch/x-pack/role_mapping.yml"
          unmapped_groups_as_roles: false

url 中,ldap協議表示使用普通連接,端口為389。ldaps 表示使用 ssl 安全連接,端口為636.

為了避免單點故障,這里支持負載均衡和故障轉移,實現多個LDAP節點高可用。

Load Balancing and Failover

The load_balance.type setting can be used at the realm level to configure how X-Pack security should interact with multiple LDAP servers.
X-Pack security supports both failover and load balancing modes of operation.

配置格式:

2、修改role_mapping文件,給用戶指定權限

# vim /etc/elasticsearch/x-pack/role_mapping.yml

superuser:
  - "uid=shengyongp,ou=Users,dc=beijing,dc=op"

默認 xpack 每五秒會檢查一次 role_mapping 文件的變化,也就是修改用戶權限之后不用重載ES。

By default, X-Pack security checks role mapping files for changes every 5 seconds.

其他細節請參考官網文檔。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM