caddyserver/certmagic

Feature request: exported variable for the "no OCSP server specified in certificate" error

kenjenkins opened this issue · 3 comments

What would you like to have changed?

Could certmagic define an exported error value for the "no OCSP server specified in certificate" error returned here?

return nil, nil, fmt.Errorf("no OCSP server specified in certificate")

For example:

var ErrNoOCSPServerSpecified = errors.New("no OCSP server specified in certificate")

Why is this feature a useful, necessary, and/or important addition to this project?

When using a mix of certificates (some managed by certmagic, and some not), we can end up with some spurious "no OCSP stapling for [domain]" errors, for those certificates not managed by certmagic. I'd like to selectively ignore this specific error, while still logging any other errors from the OCSP code.

If the certmagic API included an exported error value for this case, then we could use errors.Is() to check for this specific error. This feels more "correct" to me than matching against the error message text.

I expect the maintenance burden for the exported error value to be minimal.

What alternatives are there, or what are you doing in the meantime to work around the lack of this feature?

In the meantime, we can do a strings.Contains() check on the error message, looking for the substring "no OCSP server specified in certificate".

Please link to any relevant issues, pull requests, or other discussions.

n/a

Seems reasonable. You could open a PR!

Thanks @francislavoie, I've opened a PR. I skimmed the contributing guidelines, but please let me know if there are any steps I've missed.

mholt commented

Thank you for the request and the contribution!