点击上方“IT那活儿”,关注后了解更多精彩内容!!




版本信息
Elasticsearch 7.5.1、java version 1.8.0_101、Red Hat 7.5

漏洞名称
Elasticsearch 未授权访问

漏洞描述
通常情况下Elasticsearch 未对敏感信息进行过滤,通过curl IP:PORT的方式导致任意用户可读取敏感信息。






修复方案
添加用户认证,提高信息安全性。



修复步骤



cd /home/shsnc/snc_product/elasticsearch
./bin/elasticsearch-certutil ca./bin/elasticsearch-certutil cert --ca elastic-stack-ca.p12
elastic-certificates.p12 elastic-stack-ca.p12mv elastic-* config/certs
scp -r config/certs xxx.xxx.xxx.106:/home/shsnc/snc_product/elasticsearch/configscp -r config/certs xxx.xxx.xxx.107:/home/shsnc/snc_product/elasticsearch/config
2. 开启X-pack验证
http.cors.allow-headers: Authorizationxpack.security.enabled: truexpack.security.transport.ssl.enabled: truexpack.security.transport.ssl.verification_mode: certificatexpack.security.transport.ssl.keystore.path: certs/elastic-certificates.p12xpack.security.transport.ssl.truststore.path: certs/elastic-certificates.p12
cd /home/shsnc/snc_product/elasticsearch/sh elasticsearch.sh restart
/home/shsnc/snc_product/elasticsearch/bin/elasticsearch-setup-passwords interactiveInitiating the setup of passwords for reserved users elastic,kibana,logstash_system,beats_system.You will be prompted to enter passwords as the process progresses.Please confirm that you would like to continue [y/N]yEnter password for [elastic]:Reenter password for [elastic]:Enter password for [kibana]:Reenter password for [kibana]:Enter password for [logstash_system]:Reenter password for [logstash_system]:Enter password for [beats_system]:Reenter password for [beats_system]:
cd /home/shsnc/snc_product/product/base-resource-center/config
# 编辑配置文件application.properties,修改下面的密码行即可:
resource.elasticsearch.username=elastic #认证用户名resource.elasticsearch.password=123456 #用户密码
cd /home/shsnc/snc_product/product/sh jar.sh -restart base-resource-center
{"error":{"root_cause":[{"type":"security_exception","reason":"missing authentication credentials for REST request [/]","header":{"WWW-Authenticate":"Basic realm=\"security\" charset=\"UTF-8\""}}],"type":"security_exception","reason":"missing authentication credentials for REST request [/]","header":{"WWW-Authenticate":"Basic realm=\"security\" charset=\"UTF-8\""}},"status":401}
#curl --user 用户:密码 IP:端口curl --user elastic:123456 xxx.xxx.xxx.106:9200{"name" : "es_node0","cluster_name" : "xxxxx","cluster_uuid" : "RZXFBcnYSSe9lF5Wc-J2bB","version" : {"number" : "7.5.1","build_flavor" : "default","build_type" : "tar","build_hash" : "3ad9ty3a93c95vb0cdc024651cf95d67e1e18d36","build_date" : "2020-12-16T22:57:37.835892Z","build_snapshot" : false,"lucene_version" : "8.3.0","minimum_wire_compatibility_version" : "6.8.0","minimum_index_compatibility_version" : "6.0.0-beta1"},"tagline" : "You Know, for Search"}

结 语




END
本 文 原 创 来 源:IT那活儿微信公众号(上海新炬王翦团队)
文章转载自IT那活儿,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。