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

Looking for cause and solution to "config returned for certificate is not nil and points to different cache" error returned in cache.go #292

Closed
bbct opened this issue May 31, 2024 · 3 comments
Labels
question Further information is requested

Comments

@bbct
Copy link

bbct commented May 31, 2024

What is your question?

I've built and installed the acme-dns product, which utilizes your library. I did run it first using sudo (as root) from its original build location, but then followed the instructions to create a systemctl service (perhaps this has something to do with the issue).

When I run it as a service, I get the following in the log file: unable to get configuration to manage certificate; unable to renew
with the reason being
"config returned for certificate [] is not nil and points to different cache; got 0xc0000b1b20, expected 0xc0000b1c00 (this one)"

I see this error is generated at line 372 of certmagic/cache.go
However it is unclear to me what exactly might be the cause of this (why would it be expecting one value but get the other).

What have you already tried?

I have not reviewed the acme-dns code yet. I'm hoping any response explaining what this error means will lead me in the right direction to discovering the cause/solution to this problem.

Include any other information or discussion.

Bonus: What do you use this package for, and does it help you?

acme-dns has an https based API, and it needs to be secured with a valid cert. One option is to use LetsEncrypt, and when selected, it appears to be using your certmagic library to maintain it. It created the cert no problem the first time I ran it, and the cert is in use. But it seems that maintaining it could be an issue given this error.
Thanks.

@bbct bbct added the question Further information is requested label May 31, 2024
@mholt
Copy link
Member

mholt commented May 31, 2024

When the cache is maintaining its certificates, it has to get the config for the certificate it is maintaining. The cache has to be provided with a "GetConfigForCert" function that that can do this. The reason it's a function instead of a static field is because the way a certificate is managed can change over time, since certs can be loaded long-term into memory, and the way it is to be managed can be changed from the time it loads to when it is maintained, potentially months later.

Anyway, if that loaded config doesn't reference the same cache, then there's a problem. The caller is probably creating multiple caches and confusing/conflating configs across them.

Sounds like a bug that acme-dns will need to address, or whatever is calling CertMagic.

Closing, since there's nothing actionable here, but we can reopen if there's shown to be a bug in CM.

@bbct
Copy link
Author

bbct commented May 31, 2024

I'm closing this issue - sorry to bother you. I found that the issue is known in acme-dns (see joohoi/acme-dns#337)

There is a fix available there, not committed to the master yet, but working on it.

@bbct bbct closed this as completed May 31, 2024
@mholt
Copy link
Member

mholt commented May 31, 2024

Okay, excellent. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants