Hi Team,
I was going through with this training on "Fundamentals of Securing Elastic"
So, in this I have done the setup of inter-node SSL communication using:
/usr/share/elasticsearch/bin/elasticsearch-certutil ca
/usr/share/elasticsearch/bin/elasticsearch-certutil cert --ca elastic-stack-ca.p12
By doing so I got an error as below:
Error: Caused by: java.security.AccessControlException: access denied ("java.io.FilePermission" "/usr/share/elasticsearch/elastic-certificates.p12" "read"
But this I managed to resolve as somewhere I read that we need to place the certs in /etc/elasticsearch by putting the same as below in elasticsearch.yml:
xpack.security.transport.ssl.enabled: true
xpack.security.transport.ssl.verification_mode: certificate
xpack.security.transport.ssl.keystore.path: /etc/elasticsearch/elastic-certificates.p12
xpack.security.transport.ssl.truststore.path: /etc/elasticsearch/elastic-certificates.p12
xpack.security.http.ssl.enabled: true
xpack.security.http.ssl.keystore.path: /etc/elasticsearch/elastic-certificates.p12
xpack.security.http.ssl.truststore.path: /etc/elasticsearch/elastic-certificates.p12
Now if I run
curl -XGET https://localhost:9200
I get an error as below:
curl: (60) SSL certificate problem: self signed certificate in certificate chain
More details here: curl - SSL CA Certificates
curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.
But running the same on browser works fine.. So, anyways I can get the curl working by doing something.
++++++++++++
Next I installed kibana and tried to setup the Kibana with https of elastic. For that I ran the command below to generate crt based certificate as .p12 does not works. For that I generated the same using same ca with PEM format:
/usr/share/elasticsearch/bin/elasticsearch-certutil cert --ca elastic-stack-ca.p12 --pem
Next I modified the kibana.yml to have the certs and url as:
elasticsearch.hosts: ["https://localhost:9200"]
elasticsearch.ssl.certificateAuthorities: /etc/kibana/instance.crt
Now while restarting I am getting the error in kibana as "No Living Connection":
May 22 11:03:34 ip-172-31-28-36 kibana: {"type":"log","@timestamp":"2019-05-22T11:03:34Z","tags":["warning","elasticsearch","admin"],"pid":21957,"message":"Unable to revive connection: https://localhost:9200/"} May 22 11:03:34 ip-172-31-28-36 kibana: {"type":"log","@timestamp":"2019-05-22T11:03:34Z","tags":["warning","elasticsearch","admin"],"pid":21957,"message":"No living connections"}
Below is my consolidated elasticsearch.yml and kibana.yml
Elasticsearch.yml:
cluster.name: elk
network.host: localhost
http.port: 9200
path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch
xpack.security.transport.ssl.enabled: true
xpack.security.transport.ssl.verification_mode: certificate
xpack.security.transport.ssl.keystore.path: /etc/elasticsearch/elastic-certificates.p12
xpack.security.transport.ssl.truststore.path: /etc/elasticsearch/elastic-certificates.p12
xpack.security.http.ssl.enabled: true
xpack.security.http.ssl.keystore.path: /etc/elasticsearch/elastic-certificates.p12
xpack.security.http.ssl.truststore.path: /etc/elasticsearch/elastic-certificates.p12
Kibana.yml:
server.port: 5601
server.host: "0.0.0.0"
elasticsearch.hosts: ["https://localhost:9200"]
elasticsearch.ssl.certificateAuthorities: /etc/kibana/instance.crt
elasticsearch.ssl.key: /etc/kibana/instance.key
Any idea what else I am missing here? As running https://localhost:9200 in browser works fine but kibana does not start.