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

Initial implementation of ZeroSSL API issuer #279

Merged
merged 5 commits into from
Apr 8, 2024
Merged

Initial implementation of ZeroSSL API issuer #279

merged 5 commits into from
Apr 8, 2024

Conversation

mholt
Copy link
Member

@mholt mholt commented Mar 21, 2024

This change brings ZeroSSL API support to CertMagic.

The ZeroSSL API is a paid CA service that can issue IP certs and does not have rate limits like Let's Encrypt and has stronger availability guarantees than their free ACME endpoint. The ZeroSSLIssuer requires a ZeroSSL API key from your account and may be subject to payment terms.

Currently, ZeroSSL requires a CommonName on the CSR (deprecated for 25+ years), which is a bit hacky to work around so I hope to remove that code in the future. At first I thought their service was not compliant with the BRs, but the BRs talk about the final issued certificates, not the CSRs... so the restrictions are just added friction that are asymmetric with the issued cert. I wonder if we can get that cleaned up.

Otherwise, this works nicely with a slight breaking change. I refactored the DNS01Solver into a DNSManager type. The DNSManager is a more general type that manipulates DNS records, waits for them to propagate, then cleans them up. The DNS01Solver uses the DNSManager specifically for ACME's TXT records. ZeroSSL has its own DNS verification method that uses CNAME, hence the refactor; I also had to adjust dnsutil.go to accommodate that. This is good though because it allows us to do more with DNS across different issuers generally.

This implementation supports HTTP and CNAME verification methods through ZeroSSL's API.

Closes #262

@mholt mholt marked this pull request as ready for review March 29, 2024 17:10
@mholt mholt merged commit 6095ab8 into master Apr 8, 2024
6 checks passed
@mholt mholt deleted the zerossl branch April 8, 2024 16:59
DennisRasey pushed a commit to DennisRasey/forgejo that referenced this pull request May 12, 2024
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [github.com/caddyserver/certmagic](https://github.com/caddyserver/certmagic) | require | minor | `v0.20.0` -> `v0.21.0` |

---

### Release Notes

<details>
<summary>caddyserver/certmagic (github.com/caddyserver/certmagic)</summary>

### [`v0.21.0`](https://github.com/caddyserver/certmagic/releases/tag/v0.21.0)

[Compare Source](caddyserver/certmagic@v0.20.0...v0.21.0)

CertMagic v0.21 introduces some big changes:

-   Draft support for draft-03 of [ACME Renewal Information (ARI)](https://datatracker.ietf.org/doc/draft-ietf-acme-ari/) which assists with deciding when to renew certificates. This augments CertMagic's already-advanced logic using cert lifetime and OCSP/revocation status.
-   New [`ZeroSSLIssuer`](https://pkg.go.dev/github.com/caddyserver/[email protected]#ZeroSSLIssuer) uses the [ZeroSSL API](https://zerossl.com/documentation/api/) to get certificates. ZeroSSL also has an ACME endpoint, which can still be accesed using the existing ACMEIssuer, as always. Their proprietary API is paid, but has extra features like IP certificates, better reliability, and support.
-   DNS challenges should be smoother in some cases as we've improved propagation checking.
-   In the odd case your ACME account disappears from the ACME server, CertMagic will automatically retry with a new account. (This happens in some test/dev environments.)
-   ACME accounts are identified only by their public keys, but CertMagic maps accounts by CA+email for practical/storage reasons. So now you can "pin" an account key to use by specifying your email and the account public key in your config, which is useful if you need to absolutely be sure to use a specific account (like if you get rate limit exemptions from a CA).

Please try it out and report any issues!

Thanks to [@&#8203;Framer](https://github.com/Framer) for their contributions to this release!

#### What's Changed

-   Bump golang.org/x/crypto from 0.14.0 to 0.17.0 by [@&#8203;dependabot](https://github.com/dependabot) in caddyserver/certmagic#264
-   Demote "storage cleaning happened too recently" from WARN to INFO by [@&#8203;francislavoie](https://github.com/francislavoie) in caddyserver/certmagic#270
-   Check DNS propagation at authoritative nameservers only with default resolvers by [@&#8203;pgeh](https://github.com/pgeh) in caddyserver/certmagic#274
-   Retry with new account if account disappeared remotely by [@&#8203;mholt](https://github.com/mholt) in caddyserver/certmagic#269
-   Update readme examples to use TLS-ALPN const from ACMEz by [@&#8203;goksan](https://github.com/goksan) in caddyserver/certmagic#277
-   Initial implementation of ZeroSSL API issuer by [@&#8203;mholt](https://github.com/mholt) in caddyserver/certmagic#279
-   Allow deleting directories via FileStorage by [@&#8203;goksan](https://github.com/goksan) in caddyserver/certmagic#282
-   Use the `email` configuration in the ACME issuer to "pin" an account to a key by [@&#8203;ankon](https://github.com/ankon) in caddyserver/certmagic#283
-   Initial implementation of ARI by [@&#8203;mholt](https://github.com/mholt) in caddyserver/certmagic#286

#### New Contributors

-   [@&#8203;pgeh](https://github.com/pgeh) made their first contribution in caddyserver/certmagic#274
-   [@&#8203;goksan](https://github.com/goksan) made their first contribution in caddyserver/certmagic#277

**Full Changelog**: caddyserver/certmagic@v0.20.0...v0.21.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am" (UTC), Automerge - "before 4am" (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zNTEuMiIsInVwZGF0ZWRJblZlciI6IjM3LjM1MS4yIiwidGFyZ2V0QnJhbmNoIjoiZm9yZ2VqbyIsImxhYmVscyI6W119-->

Co-authored-by: Earl Warren <[email protected]>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3724
Reviewed-by: Earl Warren <[email protected]>
Co-authored-by: Renovate Bot <[email protected]>
Co-committed-by: Renovate Bot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support zerossl IP cert
1 participant