# Does the '--ca-sha256' command line option for Elastic Agent actually work?

**URL:** <https://discuss.elastic.co/t/does-the-ca-sha256-command-line-option-for-elastic-agent-actually-work/351397>\
**Category:** Elastic Agent\
**Tags:** fleet\
**Created:** [January 19, 2024, 4:40am UTC](https://discuss.elastic.co/t/does-the-ca-sha256-command-line-option-for-elastic-agent-actually-work/351397 "2024-01-19T04:40:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![digital-thought](https://avatars.discourse-cdn.com/v4/letter/d/f14d63/32.png) [@digital-thought](https://discuss.elastic.co/u/digital-thought)\
**Post date:** [January 19, 2024, 4:40am UTC](https://discuss.elastic.co/t/does-the-ca-sha256-command-line-option-for-elastic-agent-actually-work/351397/1 "2024-01-19T04:40:07Z")

</div>

I have a self-managed fleet server that has a self-signed certificate on it.

I can successfully enrol an agent if I use the following command line options:

```auto
--certificate-authorities=elasticsearch-ca.pem --fleet-server-cert=fleet-server.crt --fleet-server-cert-key=fleet-server.key

```

However, it needs me to place the certs onto each computer from which I want to install the agent.

According to the user documentation ([Elastic Agent command reference | Fleet and Elastic Agent Guide [8.11] | Elastic](https://www.elastic.co/guide/en/fleet/8.11/elastic-agent-cmd-options.html#elastic-agent-install-command)) there is a command line option named "--ca-sha256" which states the following:

"Comma-separated list of certificate authority hash pins used for certificate verification."

So using openssl I obtained the x509 CA certificate sha256 fingerprint from the "elasticsearch-ca.pem" cert - it comes out in the format of XX:XX:XX:...

I place that into the command line using the argument "--ca-sha256" and then remove the --certificate-authorities, --fleet-server-cert and --fleet-server-cert-key options.

The install of the elastic agent then fails with the error:

```auto
Error: fail to enroll: fail to execute request to fleet-server: x509: certificate signed by unknown authority

```

Can anyone assist on this or see if I am doing something wrong?

---

<div class="post-metadata">

**Author:** ![MichelLaterman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michellaterman/32/110221_2.png) [@MichelLaterman](https://discuss.elastic.co/u/MichelLaterman)\
**Post date:** [January 22, 2024, 4:41pm UTC](https://discuss.elastic.co/t/does-the-ca-sha256-command-line-option-for-elastic-agent-actually-work/351397/2 "2024-01-22T16:41:07Z")

</div>

Hi, the `--ca-sha256` flag is used to pin a specific CA specified by the `--certificate-authorities` option, not to automatically trust a CA.

The `--fleet-server-es-ca-trusted-fingerprint` flag is used to by fleet-server to automatically trust a CA that matches the fingerprint (when connecting to Elasticsearch).

We do not have a trusted finger CA for agent-\>fleet-server connections.

---

<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:** [February 19, 2024, 4:41pm UTC](https://discuss.elastic.co/t/does-the-ca-sha256-command-line-option-for-elastic-agent-actually-work/351397/3 "2024-02-19T16:41:16Z")

</div>

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