Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authorization object is missing "wildcard" field when issuing wildcard certificates #76

Closed
sipe90 opened this issue Nov 11, 2021 · 8 comments
Labels
bug Something isn't working completed

Comments

@sipe90
Copy link

sipe90 commented Nov 11, 2021

I'm having issues with cert-manager when issuing wildcard certificates using DNS01 challenges. Cert-manager presents the challenge incorrectly because the authorization object does not contain the wildcard field with value true.

According to the ACME spec:

wildcard (optional, boolean):  This field MUST be present and true
      for authorizations created as a result of a newOrder request
      containing a DNS identifier with a value that was a wildcard
      domain name.  For other authorizations, it MUST be absent.

So when trying to issue a wildcard certificate for *.example.com, cert-manager sees that the wildcard-field is missing from the authorization object and so assumes that the certificate is NOT a wildcard certificate. This results in cert-manager creating a TXT record of _acme-challenge.*.example.com instead of _acme-challenge.example.com and so the challenge validation never succeeds.

@grindsa grindsa added the bug Something isn't working label Nov 11, 2021
@grindsa
Copy link
Owner

grindsa commented Nov 11, 2021

Thx for spotting this. Seems cert-manager is the first acme-client make use of this field. Creating a fix should not be a big issue. Will look into this later this week...

@grindsa
Copy link
Owner

grindsa commented Nov 14, 2021

A fix got already included in the devel branch and a docker image based on apache2-wsgi got uploaded to docker-hub. Can you please give it a try (docker pull grindsa/acme2certifier:devel) and check if it works for you? I am sorry but I cannot test enrolment of wildcard-certificates via cert-manager as I am missing the environment to do so.

@sipe90
Copy link
Author

sipe90 commented Nov 15, 2021

I'm getting a deserialization error from cert-manager: E1115 07:03:09.340176 1 controller.go:163] cert-manager/controller/orders "msg"="re-queuing item due to error processing" "error"="acme: invalid response: json: cannot unmarshal string into Go struct field wireAuthz.Wildcard of type bool" "key"="cert-manager/xxxxxxxxx". The wildcard field value seems to be returned as a string while it is expected to be boolean.

@grindsa
Copy link
Owner

grindsa commented Nov 15, 2021

New devel build got uploaded to dockerhub. Pls try again...

@sipe90
Copy link
Author

sipe90 commented Nov 15, 2021

Okay, now the parsing succeeds, but the created TXT record is still incorrect: _acme-challenge.*.example.com. The spec.wildcard field value is now true in the Challenge resource, but now I noticed this documentation about field spec.dnsName:

dnsName is the identifier that this challenge is for, e.g. example.com. If the requested DNSName is a 'wildcard', this field MUST be set to the non-wildcard domain, e.g. for `*.example.com`, it must be `example.com`.

Somehow the value still ended up being set to *.example.com.

Found this from the ACME spec:

An authorization returned by the server for a wildcard domain name identifier MUST NOT include the asterisk and full stop ("*.") prefix in the authorization identifier value.  The returned authorization MUST include the optional "wildcard" field, with a value of true.

@grindsa
Copy link
Owner

grindsa commented Nov 15, 2021

Ok. this explains why regression failed last night as the tests using acme.sh did fail as well. The fix is already in devel. I will upload a new image during next hour...

@sipe90
Copy link
Author

sipe90 commented Nov 16, 2021

I tested with the latest version and now the certificate was issued successfully. Seems to be working as expected by cert-manager. Thank you!

@grindsa
Copy link
Owner

grindsa commented Nov 29, 2021

Fixes got included in v0.19. Thus, I am closing the issue.

@grindsa grindsa closed this as completed Nov 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working completed
Projects
None yet
Development

No branches or pull requests

2 participants