elasticsearch安全认证

最简单的安全认证

参考 https://www.elastic.co/guide/en/elasticsearch/reference/7.17/security-minimal-setup.html

在elasticsearch.yml中开启认证配置

plain 复制代码
xpack.security.enabled: true

为内建用户创建密码

plain 复制代码
./bin/elasticsearch-setup-passwords interactive

基础的安全认证

集群内通过TLS通信。

参考 https://www.elastic.co/guide/en/elasticsearch/reference/7.17/security-basic-setup.html

修改elasticsearch.yml配置文件

plain 复制代码
xpack.security.transport.ssl.enabled: true
xpack.security.transport.ssl.verification_mode: certificate 
xpack.security.transport.ssl.client_authentication: required
xpack.security.transport.ssl.keystore.path: elastic-certificates.p12
xpack.security.transport.ssl.truststore.path: elastic-certificates.p12

名词解析

User authentication: 用户身份验证

User authorization: 用户授权。

用户认证

参考 https://www.elastic.co/guide/en/elasticsearch/reference/7.17/setting-up-authentication.html

用户认证方案有很多,包括内建账号,服务账号,基于文件的用户认证等,这里介绍基于文件的用户认证。

基于文件的用户认证

参考 https://www.elastic.co/guide/en/elasticsearch/reference/7.17/file-realm.html

把users文件、users_roles文件放在config目录下。

如何产生users文件和users_roles文件?

参考https://www.elastic.co/guide/en/elasticsearch/reference/7.17/users-command.html#_synopsis_11

plain 复制代码
bin/elasticsearch-users
([useradd <username>] [-p <password>] [-r <roles>]) |
([list] <username>) |
([passwd <username>] [-p <password>]) |
([roles <username>] [-a <roles>] [-r <roles>]) |
([userdel <username>])

例如:

plain 复制代码
bin/elasticsearch-users useradd jacknich -p theshining -r network,monitoring

或者:

plain 复制代码
bin/elasticsearch-users useradd jacknich -p theshining -r superuser

有哪些角色参考https://www.elastic.co/guide/en/elasticsearch/reference/7.17/built-in-roles.html

plain 复制代码
superuser角色

超级用户
授予对集群的完全访问权限,包括所有索引和数据。具有超级用户角色的用户还可以管理用户和角色,
并模拟系统中的任何其他用户。由于此角色的许可性质,在将其分配给用户时要格外小心。

常见命令

plain 复制代码
删除用户jacknich:
bin/elasticsearch-users userdel jacknich 
相关推荐
洛森唛1 天前
ElasticSearch查询语句Query String详解:从入门到精通
后端·elasticsearch
用户962377954482 天前
DVWA 靶场实验报告 (High Level)
安全
洛森唛2 天前
Elasticsearch DSL 查询语法大全:从入门到精通
后端·elasticsearch
数据智能老司机2 天前
用于进攻性网络安全的智能体 AI——在 n8n 中构建你的第一个 AI 工作流
人工智能·安全·agent
数据智能老司机2 天前
用于进攻性网络安全的智能体 AI——智能体 AI 入门
人工智能·安全·agent
用户962377954482 天前
DVWA 靶场实验报告 (Medium Level)
安全
red1giant_star2 天前
S2-067 漏洞复现:Struts2 S2-067 文件上传路径穿越漏洞
安全
用户962377954482 天前
DVWA Weak Session IDs High 的 Cookie dvwaSession 为什么刷新不出来?
安全
cipher4 天前
ERC-4626 通胀攻击:DeFi 金库的"捐款陷阱"
前端·后端·安全
Elasticsearch4 天前
如何使用 Agent Builder 排查 Kubernetes Pod 重启和 OOMKilled 事件
elasticsearch