6、ELK安装之设置用户认证

1、在ES的配置文件elasticsearch.yml添加

http.cors.enabled: true

http.cors.allow-origin: "*"

http.cors.allow-headers: Authorization

xpack.security.enabled: true

xpack.security.transport.ssl.enabled: true

2、生成账号密码

/bin/elasticsearch-setup-passwords  auto  //自动生成密码,kibana、logstash、filebeat的密码自动生成

/bin/elasticsearch-setup-passwords  interactive  //交互式生成密码,每个密码自定义

3、在kibana配置文件中添加用户名和密码

在kibana.yml文件最后添加

elasticsearch.username: "elastic"    //默认账号,不能修改

elasticsearch.password: "hello12345"  //自定义密码

4、在logstash输出中配置用户名和密码

output {

  elasticsearch {

    hosts => ["127.0.0.1:9200"]

        index => "logstash-nginx"

        workers => 1

        template_overwrite => true

        user => "elastic"

        password => "Oracle1234!"

  }

stdout { codec => rubydebug }

}

https://www.yangxinghui.com/599.html

密码验证:

本地 验证 elastic 账户

curl -u elastic 'http://localhost:9200/_xpack/security/_authenticate?pretty'

重置 elastic 账户密码

curl -u elastic -XPUT 'http://localhost:9200/_xpack/security/user/elastic/_password?pretty' -H 'Content-Type: application/json' -d'{"password" : "elastic"}

参考:

https://www.cnblogs.com/sharesdk/p/12938981.html

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容