I'm trying to get user management and authentication in Kibana. For that it is required to enable the security module, and since we're running a 3 node cluster, SSL security must be enabled as well.
I tried to use Dockerfile to create my own elasticsearch image with built in ssl certificate file. But it outputs the following error message:
Caused by: java.security.UnrecoverableKeyException: failed to decrypt safe contents entry: javax.crypto.BadPaddingException: Given final block not properly padded. Such issues can arise if a bad key is used during decryption.
Dockerfile:
FROM docker.elastic.co/elasticsearch/elasticsearch:6.8.9
RUN bin/elasticsearch-certutil ca --out config/elastic-stack-ca.p12 --pass "password"
RUN bin/elasticsearch-certutil cert --ca-pass "password" config/elastic-stack-ca.p12 --out config/elastic-certificates.p12 --pass "password"
RUN chgrp -R 0 config/elastic-certificates.p12
RUN chmod +rw /usr/share/elasticsearch/config/elastic-certificates.p12
EXPOSE 9200
This is my service definition, here is as 2 nodes example that I've been using for proof of concept work:
I don't see anywhere where you configure Elasticsearch with this password.
You need to set xpack.security.transport.ssl.keystore.secure_password and xpack.security.transport.ssl.truststore.secure_password in the ES keystore.
Thanks for your help. The ES nodes are now with security and ssl enabled. This is what I've ended up defining:
Dockerfile
FROM docker.elastic.co/elasticsearch/elasticsearch:6.8.9
RUN bin/elasticsearch-certutil ca --out config/elastic-stack-ca.p12 --pass "password"
RUN bin/elasticsearch-certutil cert --ca-pass "password" config/elastic-stack-ca.p12 --out config/elastic-certificates.p12 --pass "password"
RUN chgrp -R 0 config/elastic-certificates.p12
RUN chmod +rw /usr/share/elasticsearch/config/elastic-certificates.p12
EXPOSE 9200
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.