Enable X-Pack Secure Elasticsearch cluster
1) Enable Elasticsearch security features
stop every node
open xpack.security.enabled
vim /etc/elasticsearch/elasticsearch.yml (all node)
xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true
xpack.security.transport.ssl.verification_mode: certificate
xpack.security.transport.ssl.client_authentication: required
xpack.security.transport.ssl.keystore.path: elastic-certificates.p12
xpack.security.transport.ssl.truststore.path: elastic-certificates.p12
2) on master node 1 แนะนำให้ตั้ง pass เดียวกันหมด
cd /usr/share/elasticsearch
./bin/elasticsearch-certutil ca
#set password
./bin/elasticsearch-certutil cert --ca elastic-stack-ca.p12
#set password
3) copy elastic-stack-ca.p12 and elastic-certificates.p12 to all node path /etc/elasticsearch/
copy elastic-certificates.p12 ไปไว้ที่ /etc/elasticsearch/ ของทุกโหนด
4) chown -R elasticsearch:elasticsearch /etc/elasticsearch/
5) ใส่ password ที่ตั้งก่อนหน้า
cd /usr/share/elasticsearch/
./bin/elasticsearch-keystore add xpack.security.transport.ssl.keystore.secure_password
./bin/elasticsearch-keystore add xpack.security.transport.ssl.truststore.secure_password
6) start elasticsearch cluster
7) set password elasticsearch cluster
create pass on master-node
cd /usr/share/elasticsearch/
./bin/elasticsearch-setup-passwords auto