# Cannot read configured pem certificate

**URL:** <https://discuss.elastic.co/t/cannot-read-configured-pem-certificate/299545>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-security\
**Created:** [March 12, 2022, 9:01pm UTC](https://discuss.elastic.co/t/cannot-read-configured-pem-certificate/299545 "2022-03-12T21:01:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tehfcae](https://avatars.discourse-cdn.com/v4/letter/t/f9ae1b/32.png) [@tehfcae](https://discuss.elastic.co/u/tehfcae)\
**Post date:** [March 12, 2022, 9:01pm UTC](https://discuss.elastic.co/t/cannot-read-configured-pem-certificate/299545/1 "2022-03-12T21:01:29Z")

</div>

I generated a PEM certificate for my Elasticsearch however, I am getting an error that it cannot read configured PEM certificate due to a permissions issue, however, I verified the permissions and it should have read/write/execute access.

Here is the error in journalctl that happens when I attempt to start Elasticsearch & the permissions assigned to the file.

```auto
[root@elastichost elasticsearch]# journalctl --unit elasticsearch | tail -n 100 | grep "failed to load SSL"
Mar 12 20:12:04 elastichost.internal systemd-entrypoint[27881]: org.elasticsearch.ElasticsearchSecurityException: failed to load SSL configuration [xpack.security.transport.ssl] - cannot read configured PEM certificate [/etc/elasticesearch/elastic.<removed-domain>.cer] because access to read the file is blocked; SSL resources should be placed in the [/etc/elasticsearch] directory
Mar 12 20:28:54 elastichost.internal systemd-entrypoint[28299]: org.elasticsearch.ElasticsearchSecurityException: failed to load SSL configuration [xpack.security.transport.ssl] - cannot read configured PEM certificate [/etc/elasticesearch/elastic.<removed-domain>.cer] because access to read the file is blocked; SSL resources should be placed in the [/etc/elasticsearch] directory
[root@elastichost elasticsearch]# ls -ld $PWD/* | grep 'elastic\.'
-rwxrwxrwx 1 root elasticsearch 2289 Mar 12 20:05 /etc/elasticsearch/elastic.<removed-domain>.cer
-rwxrwxrwx 1 root elasticsearch 1675 Mar 12 20:05 /etc/elasticsearch/elastic.<removed-domain>.key

```

I have validated the certificate is in PEM format and not locked. Is there anything else I need to validate?  
I have also attempted re-generating the certificate through my CA, and generating a new self-signed certificate via openSSL to verify the issue is not with the certificate itself.

---

<div class="post-metadata">

**Author:** ![TimV](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timv/32/13162_2.png) [@TimV](https://discuss.elastic.co/u/TimV)\
**Post date:** [March 14, 2022, 12:42am UTC](https://discuss.elastic.co/t/cannot-read-configured-pem-certificate/299545/2 "2022-03-14T00:42:33Z")

</div>

The solution is right in the error message:

> [@tehfcae](#):
>
> ```auto
> SSL resources should be placed in the [/etc/elasticsearch] directory
> 
> ```

This is nothing to do with filesystem permissions - you have to put the files into that directory.

---

<div class="post-metadata">

**Author:** ![tehfcae](https://avatars.discourse-cdn.com/v4/letter/t/f9ae1b/32.png) [@tehfcae](https://discuss.elastic.co/u/tehfcae)\
**Post date:** [March 14, 2022, 3:52pm UTC](https://discuss.elastic.co/t/cannot-read-configured-pem-certificate/299545/3 "2022-03-14T15:52:21Z")

</div>

They are in the /etc/Elasticsearch/ directory.

And that would still be a permissions issue as that recommendation is to resolve potential permissions issues as files should inherit permissions from the directory in most scenarios.

---

<div class="post-metadata">

**Author:** ![TimV](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timv/32/13162_2.png) [@TimV](https://discuss.elastic.co/u/TimV)\
**Post date:** [March 15, 2022, 12:23am UTC](https://discuss.elastic.co/t/cannot-read-configured-pem-certificate/299545/4 "2022-03-15T00:23:04Z")

</div>

> [@tehfcae](#):
>
> `/etc/elasticesearch`

Your configuration has a typo.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 12, 2022, 12:23am UTC](https://discuss.elastic.co/t/cannot-read-configured-pem-certificate/299545/5 "2022-04-12T00:23:05Z")

</div>

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