# Ziti edge enrol identity not inserting CA bundle

**URL:** <https://openziti.discourse.group/t/ziti-edge-enrol-identity-not-inserting-ca-bundle/814>\
**Category:** Ziti Overlay\
**Created:** [October 16, 2022, 8:04am UTC](https://openziti.discourse.group/t/ziti-edge-enrol-identity-not-inserting-ca-bundle/814 "2022-10-16T08:04:59Z")\
**Posts on this page:** 14\
**Page:** 2

<div class="post-metadata">

**Author:** ![markamind](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/markamind/32/157_2.png) [@markamind](https://openziti.discourse.group/u/markamind)\
**Post date:** [November 3, 2022, 8:13am UTC](https://openziti.discourse.group/t/ziti-edge-enrol-identity-not-inserting-ca-bundle/814/21 "2022-11-03T08:13:49Z")

</div>

> [@TheLumberjack](#):
>
> ```auto
> curl -sk https://"${ZITI_EDGE_CTRL_ADVERTISED_HOST_PORT}/.well-known/est/cacerts" \
> | openssl base64 -d \
> | openssl pkcs7 -inform DER -outform PEM -print_certs -text \
> | grep 'Subject:'
> 
> ```

Here are the results for the next test

```auto

        Subject: C=US, L=Charlotte, O=NetFoundry, OU=ADV-DEV, CN=instance-20220416-1603-signing-intermediate
        Subject: C=US, L=Charlotte, O=NetFoundry, OU=ADV-DEV, CN=instance-20220416-1603 server certificate
        Subject: C=US, L=Charlotte, O=NetFoundry, OU=ADV-DEV, CN=instance-20220416-1603-intermediate
        Subject: C=US, L=Charlotte, O=NetFoundry, OU=ADV-DEV, CN=instance-20220416-1603-signing-intermediate
        Subject: C=US, L=Charlotte, O=NetFoundry, OU=ADV-DEV, CN=168.138.10.79-intermediate
        Subject: C=US, L=Charlotte, O=NetFoundry, OU=ADV-DEV, CN=168.138.10.79-intermediate

```

---

<div class="post-metadata">

**Author:** ![markamind](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/markamind/32/157_2.png) [@markamind](https://openziti.discourse.group/u/markamind)\
**Post date:** [November 3, 2022, 8:22am UTC](https://openziti.discourse.group/t/ziti-edge-enrol-identity-not-inserting-ca-bundle/814/22 "2022-11-03T08:22:40Z")

</div>

Your assistance with this is greatly appreciated… it certainly helps with understanding how all of the certificates work.

For instance… I never really understood what the signing certificate was used for… then it clicked…as its what is used to enrol identities…

It would be great if there was a resource that you can point me to so that I can better understand the certificate hierarchy… and the purpose of each level… along with… the controls required for each layer

For instance… my understanding is that the root certificate unlocks everything… the intermediate certificates is used to delegate signing… and signing certificates to facilitate mutual trust.

Let me know if that makes any sense… or where I can go to better understand and fill in a few more gaps.

---

<div class="post-metadata">

**Author:** ![TheLumberjack](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/thelumberjack/32/113_2.png) [@TheLumberjack](https://openziti.discourse.group/u/TheLumberjack)\
**Post date:** [November 3, 2022, 10:12am UTC](https://openziti.discourse.group/t/ziti-edge-enrol-identity-not-inserting-ca-bundle/814/23 "2022-11-03T10:12:18Z")

</div>

> [@markamind](#):
>
> greatly appreciated

You're welcome. I'm personally annoyed that it's not working for you! This is a particularly difficult area to troubleshoot, your patience and tenacity is also appreciated.

> [@markamind](#):
>
> It would be great if there was a resource that you can point me to so that I can better understand the certificate hierarchy

Lol yeah, FOR SURE. it's another one of those things that just needs to get done, we don't have any lack for things to do, but a guide and explainer of ALL the things the quickstart does, and why, is an issue I filled last week  
[fully explain the quickstart · Issue #879 · openziti/ziti · GitHub](https://github.com/openziti/ziti/issues/879).

> [@markamind](#):
>
> my understanding is that the root certificate unlocks everything

Eh, kinda... You need "a root of trust", but that root doesn't have to be the same root for the three basic parts of a ziti solution: the network pki, the edge (controller api) pki, the edge (clients) pki. The current quickstart goes out of it's way to make these three different roots of trust... There's more to it but maybe that will help.

Here we are trying to figure out why you're not getting anything in your CA field. It's really odd. All our tests seem to indicate that things are working fine. I think we are at the point where I need an identity and I need to debug the code. Could you make me like, 10 identities and directly message them to me? I'll step through the debugger and see what that shows me? I'll need access to your controller from the debugger, would you be willing to open my ip to access your controller? I'll follow up in dm

---

<div class="post-metadata">

**Author:** ![PhilipGriffiths](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/philipgriffiths/32/341_2.png) [@PhilipGriffiths](https://openziti.discourse.group/u/PhilipGriffiths)\
**Post date:** [November 3, 2022, 10:21am UTC](https://openziti.discourse.group/t/ziti-edge-enrol-identity-not-inserting-ca-bundle/814/24 "2022-11-03T10:21:49Z")

</div>

If you haven’t seen some of Andrew’s latest content, it may be useful - [Integrate OpenZiti with JWTs, PKIs for seamless service authentication](https://openziti.io/openziti-authentication-api-integrations)

---

<div class="post-metadata">

**Author:** ![markamind](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/markamind/32/157_2.png) [@markamind](https://openziti.discourse.group/u/markamind)\
**Post date:** [November 3, 2022, 12:18pm UTC](https://openziti.discourse.group/t/ziti-edge-enrol-identity-not-inserting-ca-bundle/814/25 "2022-11-03T12:18:15Z")

</div>

That’s a great article… thanks for sharing

---

<div class="post-metadata">

**Author:** ![TheLumberjack](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/thelumberjack/32/113_2.png) [@TheLumberjack](https://openziti.discourse.group/u/TheLumberjack)\
**Post date:** [November 3, 2022, 6:00pm UTC](https://openziti.discourse.group/t/ziti-edge-enrol-identity-not-inserting-ca-bundle/814/26 "2022-11-03T18:00:58Z")

</div>

@markamind - there’s “definitely something strange” happening for you. For the others, I have access to @markamind’s controller and I’ve been making/deleting the same identity trying to figure out what/where/why something is going wrong. it seems to **ONLY** fail from the controller. Every other machine I’ve enrolled the identity on works.

I’ll keep at this, but probably not till tomorrow. I’d like to retain access to your controller to continue testing. I’ll let you know when I work through ‘the problem’

---

<div class="post-metadata">

**Author:** ![markamind](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/markamind/32/157_2.png) [@markamind](https://openziti.discourse.group/u/markamind)\
**Post date:** [November 3, 2022, 9:16pm UTC](https://openziti.discourse.group/t/ziti-edge-enrol-identity-not-inserting-ca-bundle/814/27 "2022-11-03T21:16:42Z")

</div>

> [@TheLumberjack](#):
>
> it seems to **ONLY** fail from the controller. Every other machine I’ve enrolled the identity on works.

Thanks for looking into this.. that is a very interesting observation.. I cannot think of anything specific that I did on that server that would cause this to happen..

I was thinking did I change a port.. modify something on the VCN.. I don't think so.. as otherwise.. it would not work at all

---

<div class="post-metadata">

**Author:** ![TheLumberjack](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/thelumberjack/32/113_2.png) [@TheLumberjack](https://openziti.discourse.group/u/TheLumberjack)\
**Post date:** [November 3, 2022, 9:18pm UTC](https://openziti.discourse.group/t/ziti-edge-enrol-identity-not-inserting-ca-bundle/814/28 "2022-11-03T21:18:03Z")

</div>

Would you try that test yourself? Could you create an identity for yourself then try to enroll it **anywhere** else? I tried it on 2 different machines but, maybe I’m doing it differently. If you confirm you can make the identity then move it off that controller and enroll it, it’d be useful.

---

<div class="post-metadata">

**Author:** ![markamind](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/markamind/32/157_2.png) [@markamind](https://openziti.discourse.group/u/markamind)\
**Post date:** [November 3, 2022, 9:22pm UTC](https://openziti.discourse.group/t/ziti-edge-enrol-identity-not-inserting-ca-bundle/814/29 "2022-11-03T21:22:25Z")

</div>

Will do… I will revert back later today…

---

<div class="post-metadata">

**Author:** ![TheLumberjack](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/thelumberjack/32/113_2.png) [@TheLumberjack](https://openziti.discourse.group/u/TheLumberjack)\
**Post date:** [November 4, 2022, 1:15am UTC](https://openziti.discourse.group/t/ziti-edge-enrol-identity-not-inserting-ca-bundle/814/30 "2022-11-04T01:15:32Z")

</div>

I've gotten down to the bottom of the issue. At some point you have added the CA for the controller into your OS's trust store. Looking at your /etc/ssl/certs folder, I can see that you have (somehow, not sure how) updated some symlinks in there:

```auto
ll /etc/ssl/certs/
total 0
lrwxrwxrwx. 1 root root 49 Sep 13 08:35 ca-bundle.crt -> /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
lrwxrwxrwx. 1 root root 55 Sep 13 08:35 ca-bundle.trust.crt -> /etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt

```

The proof is in a simple curl. Since ziti deploys a PKI of its own, a curl **without** the `-k` flag should fail, like it does from my local computer:

### curl from clint's computer:

```auto
curl https://168.138.10.79:8441/
curl: (60) SSL certificate problem: unable to get local issuer certificate
More details here: https://curl.haxx.se/docs/sslcerts.html

curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.

```

### curl from @markamind's controller:

```auto
curl https://168.138.10.79:8441/
{"data":{"apiVersions":{"edge":{"v1":{"apiBaseUrls":["https://168.138.10.79:8441/edge/client/v1"],"path":"/edge/client/v1"}},"edge-client":{"v1":{"apiBaseUrls":["https://168.138.10.79:8441/edge/client/v1"],"path":"/edge/client/v1"}},"edge-management":{"v1":{"apiBaseUrls":["https://localhost:18441/edge/management/v1"],"path":"/edge/management/v1"}}},"buildDate":"2022-10-13T15:31:04Z","revision":"72978b5aa932","runtimeVersion":"go1.19.1","version":"v0.26.10"},"meta":{}}

```

notice how the curl statement succeeds for you. So that explains why this is happening only on this machine. I'll add a bug to the `ziti edge enroll` function to figure out a better way to handle this particular situation.

Until then - 'fix/remove' the edge controller's CA from the OS and it will work as expected again.

bug filed [CA bundle isn't always fetched during enrollment · Issue #331 · openziti/sdk-golang · GitHub](https://github.com/openziti/sdk-golang/issues/331)

---

<div class="post-metadata">

**Author:** ![markamind](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/markamind/32/157_2.png) [@markamind](https://openziti.discourse.group/u/markamind)\
**Post date:** [November 4, 2022, 12:08pm UTC](https://openziti.discourse.group/t/ziti-edge-enrol-identity-not-inserting-ca-bundle/814/31 "2022-11-04T12:08:45Z")

</div>

Ahh… I do remember doing that for some reason.

Tricky one to uncover… thanks so much for working it through 🙂

I will definitely need to read up more on those certificates now

---

<div class="post-metadata">

**Author:** ![markamind](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/markamind/32/157_2.png) [@markamind](https://openziti.discourse.group/u/markamind)\
**Post date:** [November 4, 2022, 10:08pm UTC](https://openziti.discourse.group/t/ziti-edge-enrol-identity-not-inserting-ca-bundle/814/32 "2022-11-04T22:08:34Z")

</div>

> [@TheLumberjack](#):
>
> So that explains why this is happening only on this machine. I’ll add a bug to the `ziti edge enroll` function to figure out a better way to handle this particular situation

As a follow up to help my understanding.. it would be great if you can explain this in terms of what is happening between the OS trust store and the enrolment process..

When the CA is installed in the OS trust store.. does it bypass some test to determine where to source the CA bundle.. or something like that?

---

<div class="post-metadata">

**Author:** ![TheLumberjack](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/thelumberjack/32/113_2.png) [@TheLumberjack](https://openziti.discourse.group/u/TheLumberjack)\
**Post date:** [November 4, 2022, 10:38pm UTC](https://openziti.discourse.group/t/ziti-edge-enrol-identity-not-inserting-ca-bundle/814/33 "2022-11-04T22:38:56Z")

</div>

I filed a bug for this. It’s a flaw in how enrollment is working. [identity is not usable when the ctrl/edge PKI are not the same · Issue #331 · openziti/sdk-golang · GitHub](https://github.com/openziti/sdk-golang/issues/331)

But, it goes like this. When enrollment happens it makes a request to the controller API to decided if the ziti cli needs to pull the CA bundle, in order to successfully enroll. In your case - the first request succeeded (didn’t fail) due to the controller’s cert being considered trusted. Thus - there’s no need for the “ca” field to be populated (that’s the bug).

Now when your ziti-edge-tunnel (or whatever) would go to connect to the controller, things work fine, **BUT** when connecting to the edge router to establish the data plane, the quickstart uses a **different** PKI. Because of that, the router PKI is **NOT** trusted, and that leads the ziti-edge-tunnel to fail to connect.

If the quickstart used the same root CA, we’d never have seen this bug (that’s one of the reasons why the quickstart does it the way it does).

That enough details to make sense? If not, lemme know

---

<div class="post-metadata">

**Author:** ![markamind](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/markamind/32/157_2.png) [@markamind](https://openziti.discourse.group/u/markamind)\
**Post date:** [November 5, 2022, 7:33am UTC](https://openziti.discourse.group/t/ziti-edge-enrol-identity-not-inserting-ca-bundle/814/34 "2022-11-05T07:33:52Z")

</div>

Ahh… makes sense now… thanks heaps for filling in the gaps. 🙂

[Previous page](https://openziti.discourse.group/t/ziti-edge-enrol-identity-not-inserting-ca-bundle/814.md?page=1)
