elasticsearch的安全配置记录

1.设置帐号和密码

elasticsearch-http-basic和其他ES插件一样,在config/elasticsearch.yml中统一配置:

配置名 默认值 说明
http.basic.enabled true 开关,开启会接管全部HTTP连接
http.basic.user "admin" 账号
http.basic.password "admin_pw" 密码
http.basic.ipwhitelist ["localhost", "127.0.0.1"] 白名单内的ip访问不需要通过账号和密码,支持ip和主机名,不支持ip区间或正则
http.basic.trusted_proxy_chains [] 信任代理列表
http.basic.log false 把无授权的访问事件添加到ES的日志
http.basic.xforward "" 记载代理路径的header字段名

这个需要安装一个http.basic的插件。

插件的安装步骤如下:

  • 从elasticsearch-http-basic的发布版下载对应版本的jar包

  • mkdir -p plugins/http-basic; mv elasticsearch-http-basic-x.x.x.jar plugins/http-basic注意文件夹的名称

  • 重启ES进程

  • 验证插件是否生效:curl localhost:9200/_nodes/[your-node-name]/plugins?pretty=true(如果看到plugins列表包含有http-basic-server-plugin就说明插件生效了)
    发现es并不能正常启动,报错

  • Caused by: org.elasticsearch.bootstrap.BootstrapException: java.nio.file.NoSuchFileException: /usr/share/elasticsearch/plugins/http-basic/plugin-descriptor.properties
    at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:170) ~[elasticsearch-5.6.2.jar:5.6.2]
    at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:342) ~[elasticsearch-5.6.2.jar:5.6.2]
    at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:132) ~[elasticsearch-5.6.2.jar:5.6.2]
    ... 6 more

    Caused by: java.nio.file.NoSuchFileException: /usr/share/elasticsearch/plugins/http-basic/plugin-descriptor.properties

    但并没有找到plugin-descriptor.properties的相关文件

  • 也有可以与插件版本有关,git上最新的插修的版本只支持es1.5

    http.basic的方式暂时(失败)

2.看es的自身的配置,es6.5有,而本系统es5.6并没有 用户和用户组 的配置。不行

3.使用x-pack

x-pack6.5官网有权限的使用:

es5.6使用x-pack:

bin/elasticsearch-plugins install x-pack

相关推荐
用户9623779544826 分钟前
DVWA 靶场实验报告 (Medium Level)
安全
red1giant_star29 分钟前
S2-067 漏洞复现:Struts2 S2-067 文件上传路径穿越漏洞
安全
用户962377954484 小时前
DVWA Weak Session IDs High 的 Cookie dvwaSession 为什么刷新不出来?
安全
cipher2 天前
ERC-4626 通胀攻击:DeFi 金库的"捐款陷阱"
前端·后端·安全
Elasticsearch2 天前
如何使用 Agent Builder 排查 Kubernetes Pod 重启和 OOMKilled 事件
elasticsearch
Elasticsearch3 天前
通用表达式语言 ( CEL ): CEL 输入如何改进 Elastic Agent 集成中的数据收集
elasticsearch
一次旅行5 天前
网络安全总结
安全·web安全
red1giant_star5 天前
手把手教你用Vulhub复现ecshop collection_list-sqli漏洞(附完整POC)
安全
ZeroNews内网穿透5 天前
谷歌封杀OpenClaw背后:本地部署或是出路
运维·服务器·数据库·安全