本次实验版本Elasticsearch7.5,适用版本7.x
1. ES开启认证
#1. 为Elasticsearch集群中的节点生成证书
bin/elasticsearch-certutil ca
#提示输入密码,可以直接回车到底
bin/elasticsearch-certutil cert --ca elastic-stack-ca.p12
mkdir config/certs/ && mv elastic-certificates.p12 elastic-stack-ca.p12 config/certs/
#2. 修改配置文件 config/elasticsearch.yml
xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true
xpack.security.transport.ssl.verification_mode: certificate
xpack.security.transport.ssl.keystore.path: certs/elastic-certificates.p12
xpack.security.transport.ssl.truststore.path: certs/elastic-certificates.p12
#3. 设置密码
bin/elasticsearch-setup-passwords interactive
#密码会按照次序一次输入。
elastic/admin123
apm_system/user123
kibana/user123
logstash_system/user123
beats_system/user123
remote_monitoring_user/user123
2. Kibana开启认证
#4. 设置kibana config/kiba