How to enable security on an existing 8.1 multi nodes docker cluster

I have an existing 5 nodes podman cluster. 4 nodes are on one VM, another node is on another VM.

Security is not enabled ( false).

I tried to setup security by calling: bin/Elasticsearch-setup-passwords interactive
but it tells me that I have to set to true

Well I changed to true to all the nodes.
Result: the nodes fail to start.
There is a warning: it is trying to open a file under .aws. I cannot see this file since it is in the container. I am not running under AWS. What should I do?

{"type": "server", "timestamp": "2022-03-09T22:26:13,479Z", "level": "WARN", "component": "c.a.a.p.i.BasicProfileConfigFileLoader", "": "es-docker-cluster", "": "es01", "message": "Unable to load config file null",
"stacktrace": [" access denied (\"\" \"/usr/share/elasticsearch/.aws/config\" \"read\")",

Error message is:

ERROR: [1] bootstrap checks failed. You must address the points described in the following [1] lines before starting Elasticsearch.
bootstrap check failure [1] of [1]: Transport SSL must be enabled if security is enabled. Please set [] to [true] or disable security by setting [] to [false]
ERROR: Elasticsearch did not exit normally - check the logs at /usr/share/elasticsearch/logs/es-docker-cluster.log

Good, then I tried to enable and restart the cluster.
This time it tells me that I need a key.

{"type": "server", "timestamp": "2022-03-09T22:26:42,675Z", "level": "ERROR", "component": "o.e.b.ElasticsearchUncaughtExceptionHandler", "": "es-docker-cluster", "": "es01", "message": "uncaught exception in thread [main]",
"stacktrace": ["org.elasticsearch.bootstrap.StartupException: org.elasticsearch.ElasticsearchSecurityException: invalid SSL configuration for - server ssl configuration requires a key and certificate, but these have not been configured; you must set either [], or both [] and []",
"at org.elasticsearch.bootstrap.Elasticsearch.init( ~[elasticsearch-8.1.0.jar:8.1.0]",
"at org.elasticsearch.bootstrap.Elasticsearch.execute( ~[elasticsearch-8.1.0.jar:8.1.0]",
"at org.elasticsearch.common.cli.EnvironmentAwareCommand.execute( ~[elasticsearch-8.1.0.jar:8.1.0]",
"at org.elasticsearch.cli.Command.mainWithoutErrorHandling( ~[elasticsearch-cli-8.1.0.jar:8.1.0]",
"at org.elasticsearch.cli.Command.main( ~[elasticsearch-cli-8.1.0.jar:8.1.0]",
"at org.elasticsearch.bootstrap.Elasticsearch.main( ~[elasticsearch-8.1.0.jar:8.1.0]",
"at org.elasticsearch.bootstrap.Elasticsearch.main( ~[elasticsearch-8.1.0.jar:8.1.0]",
"Caused by: org.elasticsearch.ElasticsearchSecurityException: invalid SSL configuration for - server ssl configuration requires a key and certificate, but these have not been configured; you must set either [], or both [] and []",
"at org.elasticsearch.xpack.core.ssl.SSLService.validateServerConfiguration( ~[?:?]",
"at org.elasticsearch.xpack.core.ssl.SSLService.loadSslConfigurations( ~[?:?]",
"at org.elasticsearch.xpack.core.ssl.SSLService.<init>( ~[?:?]",
"at org.elasticsearch.xpack.core.XPackPlugin.createSSLService( ~[?:?]",
"at org.elasticsearch.xpack.core.XPackPlugin.createComponents( ~[?:?]",
"at org.elasticsearch.node.Node.lambda$new$16( ~[elasticsearch-8.1.0.jar:8.1.0]",
"at$7$1.accept( ~[?:?]",
"at java.util.ArrayList$ArrayListSpliterator.forEachRemaining( ~[?:?]",
"at ~[?:?]",
"at ~[?:?]",
"at$ReduceOp.evaluateSequential( ~[?:?]",
"at ~[?:?]",
"at ~[?:?]",
"at org.elasticsearch.node.Node.<init>( ~[elasticsearch-8.1.0.jar:8.1.0]",
"at org.elasticsearch.node.Node.<init>( ~[elasticsearch-8.1.0.jar:8.1.0]",
"at org.elasticsearch.bootstrap.Bootstrap$5.<init>( ~[elasticsearch-8.1.0.jar:8.1.0]",
"at org.elasticsearch.bootstrap.Bootstrap.setup( ~[elasticsearch-8.1.0.jar:8.1.0]",
"at org.elasticsearch.bootstrap.Bootstrap.init( ~[elasticsearch-8.1.0.jar:8.1.0]",
"at org.elasticsearch.bootstrap.Elasticsearch.init( ~[elasticsearch-8.1.0.jar:8.1.0]",
"... 6 more"] }
uncaught exception in thread [main]
org.elasticsearch.ElasticsearchSecurityException: invalid SSL configuration for - server ssl configuration requires a key and certificate, but these have not been configured; you must set either [], or both [] and []
        at org.elasticsearch.xpack.core.ssl.SSLService.validateServerConfiguration(
        at org.elasticsearch.xpack.core.ssl.SSLService.loadSslConfigurations(
        at org.elasticsearch.xpack.core.ssl.SSLService.<init>(
        at org.elasticsearch.xpack.core.XPackPlugin.createSSLService(
        at org.elasticsearch.xpack.core.XPackPlugin.createComponents(
        at org.elasticsearch.node.Node.lambda$new$16(
        at java.base/$7$1.accept(
        at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(
        at java.base/
        at java.base/
        at java.base/$ReduceOp.evaluateSequential(
        at java.base/
        at java.base/
        at org.elasticsearch.node.Node.<init>(
        at org.elasticsearch.node.Node.<init>(
        at org.elasticsearch.bootstrap.Bootstrap$5.<init>(
        at org.elasticsearch.bootstrap.Bootstrap.setup(
        at org.elasticsearch.bootstrap.Bootstrap.init(
        at org.elasticsearch.bootstrap.Elasticsearch.init(
        at org.elasticsearch.bootstrap.Elasticsearch.execute(
        at org.elasticsearch.common.cli.EnvironmentAwareCommand.execute(
        at org.elasticsearch.cli.Command.mainWithoutErrorHandling(
        at org.elasticsearch.cli.Command.main(
        at org.elasticsearch.bootstrap.Elasticsearch.main(
        at org.elasticsearch.bootstrap.Elasticsearch.main(
For complete error details, refer to the log at /usr/share/elasticsearch/logs/es-docker-cluster.log

How do I generate this key?
The nodes are not running, I do not have access to any Elasticsearch bin folder.
How do I generate a key out of a cluster that is not running?

There must be a way to enable security on an existing multi-node docker cluster.
Please help.

Have you read the docs on this?

Sure I have read it.
But it is not clear to interpret the fundamental reasons of application behavior when running in a diff environment.
It is always a challenge to do it in a containerized world.
Mainly because if anything is wrong, the container fails and you do not have access to the bin folder to execute any command.
What I finally understood is that you have to start the containers WITHOUT any security (so they can run), then generate the certificates IN THE RUNNING CONTAINER, then copy the certificates to the config volumes on the host, then adjust the password on the keystore IN THE CONTAINER, then adjust Elasticsearch.yml to set values.
Then restart the container pod and services.

If the containers were not failing and just give warnings, it would be much easier and less confusing.

Nodes are now up with encrypted internode communication with SSL enabled.
Thank you

I followed carefully the instructions and the nodes are up.

I can verify by looking at logs (podman logf -f es01) or by curl to 9200

curl --cacert /var/elasticsearch/elasticsearch-config/es01/certs/kibana/elasticsearch-ca.pem -u elastic
Enter host password for user 'elastic':
  "name" : "es01",
  "cluster_name" : "es-docker-cluster",
  "cluster_uuid" : "doiewpWZT1CpyNuYRbK0Pw",
  "version" : {
    "number" : "8.1.0",
    "build_flavor" : "default",
    "build_type" : "docker",
    "build_hash" : "3700f7679f7d95e36da0b43762189bab189bc53a",
    "build_date" : "2022-03-03T14:20:00.690422633Z",
    "build_snapshot" : false,
    "lucene_version" : "9.0.0",
    "minimum_wire_compatibility_version" : "7.17.0",
    "minimum_index_compatibility_version" : "7.0.0"
  "tagline" : "You Know, for Search"

The problem is to load Kibana.

Despite having followed the instructions found in the zip file generated while creating certificates for nodes and for Kibana, it still fails with this error.

[2022-03-16T12:36:39.935+00:00][ERROR][Elasticsearch-service] Unable to retrieve version information from Elasticsearch nodes. security_exception: [security_exception] Reason: missing authentication credentials for REST request [/_nodes?filter_path=nodes..version%2Cnodes..http.publish_address%2Cnodes.*.ip]

Here is my kibana.yml. ""
server.shutdownTimeout: "5s"
elasticsearch.hosts: [ ""]
monitoring.ui.container.elasticsearch.enabled: false
xpack.reporting.enabled: false

elasticsearch.ssl.certificateAuthorities: [ "config/certs/kibana/elasticsearch-ca.pem" ]

Here is my Elasticsearch.yml es01 es-docker-cluster
node.roles: master,data_hot,data_content,ingest,transform
bootstrap.memory_lock: true
transport.port: 9301

discovery.seed_hosts: ["","",""]
cluster.initial_master_nodes: ["es01","es02","es03"] true true
# Enable encryption for HTTP API client connections, such as Kibana, Logstash, and Agents
  enabled: true
  keystore.path: certs/http.p12
  client_authentication: optional

# Enable encryption and mutual authentication between cluster nodes
  enabled: true
  verification_mode: certificate
  keystore.path: certs/transport.p12
  truststore.path: certs/transport.p12

I have tried numerous ways to overcome in the last 5 days and was never able to succeed.
Please help.

Sorry, we don't really have a step-by-step guide to enabling security from scratch on an existing cluster in 8.x

We had something like that in 7.x, but there have been changes introduced in 8.0 that mean those docs are no longer relevant, and the replacements are a bit scattered.

The issue here is that Kibana is not configured to authenticate to Elasticsearch.

What you can do is exec into one of the Elasticsearch containers, and run:

bin/elasticsearch-reset-password -u kibana_system

That will generate a password for Kibana to use (you can also use the Elasticsearch change password API for this if you prefer).

Then modify your kibana.yml to add:

elasticsearch.username: kibana_system
elasticsearch.password: <<the new password>>

If you create a new cluster with security enabled, then all of this is done for you. However, when enabling security on an existing cluster some manual steps are required.

It worked, Thank you.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.