配置elasticsearch用windows account(AD)登录
创始人
2024-02-18 05:07:52
0

配置elasticsearch用windows account(AD)登录

  • 编辑es的配置文件
  • 创建role mapping文件
  • 添加windows account的密码
  • 给role mapping和cacert文件正确的权限
  • 重启kibana和elasticsearch
  • 在kibana页面登陆elasticsearch

参考文章:
• https://www.elastic.co/guide/en/elasticsearch/reference/current/active-directory-realm.html
• https://www.elastic.co/guide/en/elasticsearch/reference/current/security-settings.html#ref-ad-settings
• https://www.elastic.co/guide/en/elasticsearch/reference/current/elasticsearch-keystore.html

编辑es的配置文件

sudo vi /etc/eleicsearch/elasticsearch.yml

添加下面配置

xpack.security.authc.realms:native:native1:order: 1active_directory:my_ad:order: 0domain_name: domainurl: ldaps://domain:portload_balance:type: "round_robin"bind_dn: "username@domain"ssl:certificate_authorities: [ "/etc/elasticsearch/certs/cacert.crt" ]user_search:base_dn: "DC=your_dc,DC=your_dc"filter: "(&(objectClass=user)(sAMAccountName={0}))"files:role_mapping: "/etc/elasticsearch/my_ad_role_mapping.yml"metadata:- cn- mail- displayName

替换domain成你的domain name
替换ldaps://domain:port成你的ldap服务器地址和端口
cacert.crt 替换成服务器的cacert
your_dc替换成你的DC

创建role mapping文件

Within a mapping definition, you specify groups using their distinguished names. For example, the following mapping configuration maps the Active Directory admins group to both the monitoring and user roles, maps the users group to the user role and maps the John Doe user to the user role.

monitoring: - "cn=admins,dc=example,dc=com" 
user:- "cn=users,dc=example,dc=com" - "cn=admins,dc=example,dc=com"- "cn=John Doe,cn=contractors,dc=example,dc=com" 

The name of the role.

The Active Directory distinguished name (DN) of the admins group.

The Active Directory distinguished name (DN) of the users group.

The Active Directory distinguished name (DN) of the user John Doe.

添加windows account的密码

sudo /usr/share/elasticsearch/bin/elasticsearch-keystore add xpack.security.authc.realms.active_directory.my_ad.secure_bind_password

然后输入密码,回车
输入下面的命令去查看刚刚的密码是否正确。

sudo /usr/share/elasticsearch/bin/elasticsearch-keystore show xpack.security.authc.realms.active_directory.my_ad.secure_bind_password

给role mapping和cacert文件正确的权限

sduo chmod 755 
sudo chowm elastinsearch /etc/elasticsearch/certs/cacert.crt
sduo chmod 755 /etc/elasticsearch/my_ad_role_mapping.yml
sudo chowm elastinsearch /etc/elasticsearch/my_ad_role_mapping.yml

重启kibana和elasticsearch

sudo systemctl restart kibana
sudo systemctl restart elasticseatch

在kibana页面登陆elasticsearch

在这里插入图片描述
可以看到成功登录了。

相关内容

热门资讯

北京律师行业年均免费为群众提供... 12月19日,北京市律师协会发布《北京市律师行业社会责任报告》,展示“十四五”时期北京律师行业在履行...
分居期间男子与公司女员工不正当... 公司股东李某乙在与妻子李某甲分居期间,与公司女员工马某某存在不正当交往并育有子女,还向其大额转账。李...
男子带作弊设备考科目一,被考官... 花钱就能够通过科目一考试,前不久,一名男子轻信朋友考试“包过”承诺,带着隐蔽的作弊设备进入考场,没想...
一个月内收两封监管函,瑞茂通怎... 12月19日,瑞茂通(600180)公告,于2025年12月19日收到监管工作函,监管机构就公司信息...
律师的作用 我以前自己打官司都是当被告,想办法不让对方讹诈就行,感觉律师没啥用,只是在法庭替你发言而已,孩子谢浩...
120多万卡宴只卖60万!海南... 12月20日,话题#海南封关120多万卡宴只要60万#冲上热搜,引发公众热议。 据媒体报道,12月1...
女子醉驾找人“摆平”被骗7万后... 因醉酒驾驶轻信他人“可摆平”的谎言被骗,女子葛某乙不堪压力自杀身亡。在实施诈骗的苏某被判刑并赔偿后,...
政策护航,智能建造企业“出海”... 长沙晚报掌上长沙12月21日讯(全媒体记者 刘嘉)近日,长沙市智能建造产业链推进办公室印发了《关于推...