ElasticSearch未授权访问漏洞

elasticsearch 9200端口如果不实现登录认证,可能会出现数据被盗,数据丢失的风险。会有Elasticsearch 未授权访问,漏洞

1.更改默认端口

2.更改配置 elasticsearch.yml

network.bind_host: '内网IP'  network.publish_host: '内网IP'  替换 network.host: 0.0.0.0

3.安装x-pack插件

在elasticsearch安装x-pack插件,在elasticsearch配置文件中添加 :
xpack.security.enabled: true
http.cors.enabled: true
http.cors.allow-origin: “*”

安装:./bin/elasticsearch-plugin install x-pack

默认用户密码:

用户名:elastic,密码:changeme

PHP 访问参数:

$params = [
    [
        'host' => 'ip地址',
        'port' => '端口号',
        'scheme' => 'http',
        'user' => '用户',
        'pass' => '密码'
    ],
];
原文地址:https://www.cnblogs.com/yimingwang/p/13384418.html