Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4791 pages
Databases and Redis

Elasticsearch cannot load the reindex.ssl truststore for reindex from remote

Your error

cannot read configured [PKCS12] keystore (as a truststore) [/home/es/remote-ca.p12] because access to read the file is blocked; SSL resources should be placed in the [/etc/elasticsearch] directory3 more lines it can show

Fix it fast

Most common cause, 1 of 3

The truststore file sits outside the Elasticsearch config directory

Copy the file into a folder under the config directory and give a path relative to it.

Fix
sudo mkdir -p /etc/elasticsearch/certs
sudo cp /home/es/remote-ca.p12 /etc/elasticsearch/certs/

# /etc/elasticsearch/elasticsearch.yml
reindex.remote.whitelist: "old-cluster.example.com:9200"
reindex.ssl.truststore.path: certs/remote-ca.p12

sudo systemctl restart elasticsearch.service
Did this fix it?
Full steps for this cause: check, fix, verify

Short answer

cannot read configured [PKCS12] keystore (as a truststore) means Elasticsearch could not load the file in reindex.ssl.truststore.path. Elasticsearch 9.5 reads SSL files only inside its config directory, resolves relative paths there, and expects the store password as a secure setting. Move the file under /etc/elasticsearch, add reindex.ssl.truststore.secure_password, or trust a PEM CA instead.

  • Applies to Elasticsearch 9.5, Ubuntu 24.04
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Which cause do you have?

The reindex module builds its SSL context from the reindex.ssl lines in elasticsearch.yml, so look for the error in the Elasticsearch log as well as in the reindex response. Read the log line, then compare the configured path with the config directory.

Run this first
sudo journalctl --unit elasticsearch | grep -E "cannot read configured|truststore" | tail -n 5
grep -n "^reindex\." /etc/elasticsearch/elasticsearch.yml
sudo ls -l /etc/elasticsearch/certs/

Then find the line you see in this list and open its fix:

  1. 1The truststore file sits outside the Elasticsearch config directorybecause access to read the file is blocked; SSL resources should be placed in the [/etc/elasticsearch] directory
  2. 2The truststore password is missing or wrongthis is usually caused by an incorrect password, often with (no password was provided)
  3. 3The file holds a key pair, not a trusted CA certificatethe truststore [...] does not contain any trusted certificate entries

What does the error look like?

  • cannot read configured [PKCS12] keystore (as a truststore) [/home/es/remote-ca.p12] because access to read the file is blocked; SSL resources should be placed in the [/etc/elasticsearch] directory
  • cannot read configured [jks] keystore (as a truststore) [/etc/elasticsearch/remote.jks] because the file does not exist
  • this is usually caused by an incorrect password
  • the truststore [/etc/elasticsearch/certs/node.p12] does not contain any trusted certificate entries

Cause 1 of 3

The truststore file sits outside the Elasticsearch config directory

You seebecause access to read the file is blocked; SSL resources should be placed in the [/etc/elasticsearch] directory

Check

cannot read configured keystore (as a truststore) with access to read the file is blocked means the reindex truststore lies outside the config directory, where Elasticsearch does not allow SSL files to be read. The error text itself names the directory to use, and relative paths in reindex.ssl.* are resolved against that same directory.

Check
grep -n "reindex.ssl" /etc/elasticsearch/elasticsearch.yml

Fix

Copy the file into a folder under the config directory and give a path relative to it. Remote hosts must also be allowed in reindex.remote.whitelist, which is set in the same file.

Fix
sudo mkdir -p /etc/elasticsearch/certs
sudo cp /home/es/remote-ca.p12 /etc/elasticsearch/certs/

# /etc/elasticsearch/elasticsearch.yml
reindex.remote.whitelist: "old-cluster.example.com:9200"
reindex.ssl.truststore.path: certs/remote-ca.p12

sudo systemctl restart elasticsearch.service

Verify

The node starts without the error, and the reindex request reaches the remote cluster.

Verify
sudo journalctl --unit elasticsearch --since "10 min ago" | grep -c "cannot read configured"

Confirmed by raw.githubusercontent.com

Did this fix it?

Cause 2 of 3

The truststore password is missing or wrong

You seethis is usually caused by an incorrect password, often with (no password was provided)

Check

cannot read configured keystore with this is usually caused by an incorrect password means Elasticsearch opened the file but could not decrypt it with the password it was given, or with none. The reindex docs say SSL settings go in elasticsearch.yml except the secure ones, which belong in the Elasticsearch keystore; reindex.ssl.truststore.secure_password is that secure setting, and the plain truststore.password is deprecated since 7.17.

Check
sudo /usr/share/elasticsearch/bin/elasticsearch-keystore list | grep reindex

Fix

Store the truststore password in the Elasticsearch keystore under the secure name, remove any plain reindex.ssl.truststore.password line, and restart; keystore changes apply at restart.

Fix
sudo /usr/share/elasticsearch/bin/elasticsearch-keystore add reindex.ssl.truststore.secure_password
sudo systemctl restart elasticsearch.service

Verify

keystore list shows the setting, and the startup log no longer mentions the truststore.

Verify
sudo /usr/share/elasticsearch/bin/elasticsearch-keystore list

Confirmed by elastic.co

Did this fix it?

Cause 3 of 3

The file holds a key pair, not a trusted CA certificate

You seethe truststore [...] does not contain any trusted certificate entries

Check

does not contain any trusted certificate entries means reindex.ssl.truststore.path points at a store with no CA certificate in it, usually a node's own key and certificate file. For reindex from remote the truststore must hold the CA that signed the remote cluster's HTTP certificate.

Check
keytool -list -keystore /etc/elasticsearch/certs/node.p12 -storetype PKCS12

Fix

Point reindex.ssl.certificate_authorities at the remote cluster's CA in PEM form instead; it cannot be combined with truststore.path, so remove that line and its password. A store built with keytool -importcert from the CA file works too.

Fix
# /etc/elasticsearch/elasticsearch.yml
reindex.remote.whitelist: "old-cluster.example.com:9200"
reindex.ssl.certificate_authorities: [ "/etc/elasticsearch/certs/remote-ca.crt" ]
reindex.ssl.verification_mode: full

Verify

After a restart, run the reindex from remote and check that it reports created documents.

Verify
sudo systemctl restart elasticsearch.service

Confirmed by elastic.co

Did this fix it?

How do I stop it coming back?

  • Keep every reindex.ssl file under /etc/elasticsearch/certs and reference it by a relative path.
  • Put SSL passwords only in the Elasticsearch keystore, using the secure_ setting names.
  • Prefer reindex.ssl.certificate_authorities with the remote CA's PEM file; there is no store password to lose.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.