Skip to content

Certificates generated by ACMEBot are in a incorrect order #984

@FunLow

Description

@FunLow

Describe the bug
Certificates being fetched by the ACME Bot are provided to the keyvault in the Wrong order. Taking any certificate being generated using the ACME Bot and exporting the certificates shows that the certificates are ending up in the wrong order in the key vault.

While this is checked and fixed for different Implementations (e.g. Application Gateway, AKS Secrets Provider) this can lead to issues in a lot of places where this check is not done before injecting the certificate. Expecially if there there are various different kinds of processes utilizing the certificates from different origins. From my point of view this should be a validation of the acmebot and something the ACME Bot should check and fix due to suit the international defined standard. Thats also the reason im creating this as bug.
https://datatracker.ietf.org/doc/html/rfc4346#section-7.4.2

I noticed that there is the MitigateChainOrder Property in the configuration ( at least in the version we are using) but it seems to not handle / work properly or im missing something.
Appsetting used on the function app:
Acmebot:MitigateChainOrder=true

Actual Output

Bag Attributes: <Empty Attributes>
subject=C=US, O=Let's Encrypt, CN=R12
issuer=C=US, O=Internet Security Research Group, CN=ISRG Root X1
-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----
Bag Attributes
    localKeyID: <redacted>
subject=CN=my-domain.de
issuer=C=US, O=Let's Encrypt, CN=R12
-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----

Expected Output

-----END CERTIFICATE-----
Bag Attributes
    localKeyID: <redacted>
subject=CN=my-domain.de
issuer=C=US, O=Let's Encrypt, CN=R12
-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----
Bag Attributes: <Empty Attributes>
subject=C=US, O=Let's Encrypt, CN=R12
issuer=C=US, O=Internet Security Research Group, CN=ISRG Root X1
-----BEGIN CERTIFICATE-----
...

To Reproduce
Steps to reproduce the behavior:

  1. Generate a certificate
  2. Export the certificate from the Keyvault
  3. Export Certificate: openssl pkcs12 -in '.\my-cert.pfx' -nokeys -out cert.pem

Environment (please complete the following information):

  • Certificate Type: Zone Apex, Sub-domain
  • Certificate Deploy Target: Azure Kubernetes Cluster with App Configuration Provider to fetch certificates

Additional context
ACME Bot Version: 4.2.6.0

Thanks for the great work anyway!

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions