I'm just getting started with securing Elastic Stack. My setup is a cloud VM where both Elasticsearch and Kibana are running. It is a one node setup right now.
I generated a CA with certutil, and then generated a pkcs12 key for my Elasticsearch node using this CA.
bin/elasticsearch-certutil cert --ca elastic-stack-ca.p12 --name my-server01 --ip 192.168.0.1 (placeholder) --dns my-server01.vpc.com
I'v got Elasticsearch running with full host verification. Now I'm adding Kibana to the mix by converting the pkcs12 key from the CA to a pem file and it's working fine with elasticsearch.ssl.verificationMode: certificate. However once I set verificationMode to full Kibana can't discover Elasticsearch anymore.
Isn't it possible to use full verification mode with a self generated CA or am I doing something wrong here?
depending on what you see in the previous command.
You can, unfortunately, only use PEM files for kibana, so setting the PKCS#12 store wouldn't work.
That error ( if it;s the only one ) seems to indicate that Elasticsearch is not up and running. What are the content of the elasticsearch logs. Any errors there? Can you verify that Elasticsearch does indeed start ?
I think I've got both. However there's an unsupported tag 6, maybe that's a problem?
Bag Attributes
friendlyName: my-server01
localKeyID: 123456789
subject=CN = my-server01
issuer=CN = Elastic Certificate Tool Autogenerated CA
-----BEGIN CERTIFICATE-----
XYZ
-----END CERTIFICATE-----
Bag Attributes
friendlyName: ca
2.16.840.1.113894.746875.1.1: <Unsupported tag 6>
subject=CN = Elastic Certificate Tool Autogenerated CA
issuer=CN = Elastic Certificate Tool Autogenerated CA
-----BEGIN CERTIFICATE-----
XYZ
-----END CERTIFICATE-----
You can, unfortunately, only use PEM files for kibana, so setting the PKCS#12 store wouldn't work.
Sorry, I meant I tried to use the converted PEM of the elastic-stack-ca.pkcs12, but as that is missing the server information this won't work in full verification mode I guess.
That error ( if it;s the only one ) seems to indicate that Elasticsearch is not up and running. What are the content of the elasticsearch logs. Any errors there? Can you verify that Elasticsearch does indeed start ?
Elasticsearch is definitely running, I get correct responses to curl commands.
that's all you need. If this doesn't solve your problem, then I'd need to see more of your kibana logs. there should be something more apart from the line you shared.
Jul 30 13:49:38 my-server01 kibana[21691]: {"type":"log","@timestamp":"2019-07-30T13:49:38Z","tags":
["status","plugin:ui_metric@7.2.0","info"],"pid":21691,"state":"green",
"message":"Status changed from uninitialized to green - Ready","prevState":"uninitialized","prevMsg":"uninitialized"}
Jul 30 13:49:39 my-server01 kibana[21691]: {"type":"log","@timestamp":"2019-07-30T13:49:39Z",
"tags":["error","elasticsearch","admin"],"pid":21691,"message":"Request error,
retrying\nGET https://my-server01:9200/_nodes?filter_path=nodes.*.version%2Cnodes.*.http.publish_address%2Cnodes.*.ip
=> Hostname/IP does not match certificate's altnames: Host: my-server01. is not in the cert's altnames:
IP Address:[replaced host ip address], DNS:my-server01.privatecloud.com"}
It seems I made an error when generating the server certificate.
What is the curl command you are running ?
I'm just running a GET on Elasticsearch's Port with basic authentication with elastic user. I'm actually using Postman and am converting the curl commands as documented.
because your curl command checks with a different user, without validating the certificate the server presents and using the IP address to connect to the Elasticsearch server instead of the IP address ( that latter might also affect the certificate validation ). It's always better if you can share the exact command and the exact output/error/log , rather than a description of them.
You don't have to. The other two possibilities would be to
a. Add the IP address as a SAN in the certificate
b. Disable the hostname verification ( not actually suggesting it as a good idea )
Same goes for beats or other stack products talking to Elasticsearch (or any other external system talking to any server over TLS with hostname verification on). Either add the IP Address of the server as a SAN in the the certificate and connect to the IP address, or connect to the FQDN (which I assume is already a SAN in the server certificate )
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.