Commit Graph

45 Commits

Author SHA1 Message Date
Matthew Holt
8d308414fb
Mention ARI in readme 2024-05-07 09:51:34 -06:00
Matthew Holt
f7ea6fb698
Enhancements to make ZeroSSL issuer more usable in Caddy 2024-04-11 12:23:53 -06:00
Matthew Holt
74862ff45a
Upgrade acmez to v2 beta
Adds support for customizing NotBefore/NotAfter times of certs
2024-04-08 14:05:43 -06:00
Matt Holt
6095ab8069
Initial implementation of ZeroSSL API issuer (#279)
* Initial implementation of ZeroSSL API issuer

Still needs CA support for CommonName-less certs

* Accommodate ZeroSSL CSR requirements; fix DNS prop check

* Fix README example

* Fix comment
2024-04-08 10:59:55 -06:00
Goksan
c61a4feb39
Update readme examples to use TLS-ALPN const from ACMEz (#277) 2024-03-20 20:43:30 -06:00
Matthew Holt
7a2236bee7
Bump minimum Go version to 1.21 2024-03-06 12:26:33 -07:00
oliverpool
4fbb049d3b
README: Add hint about NextProtos for certmagic.TLS (#251) 2023-08-22 11:56:44 -06:00
Conrad Hoffmann
d8e706f9b5
README: fix typo in sample code and update (#243) 2023-06-28 10:59:06 -06:00
Matt Holt
65d3af6938
Issuer policies that can randomize issuer used (#238) 2023-06-13 22:05:29 -06:00
Matt Holt
232fade720
Generate new private keys for new certificates (#237)
* Always generate new private keys by default

* Update readme
2023-06-13 19:01:17 -06:00
Sebastian Mæland Pedersen
d37847a6d4
Fix advanced cache initialization in README (#198)
* Fix advanced cache initialization in README

As per the documentation of GetConfigForCert:
> The returned Config MUST be associated with the same Cache as the caller.
A valid Config cannot be constructed with &certmagic.Config{} as the certCache field is unexported.
The only way to construct a Config with a non-nil Cache is to use either NewDefault or New.

* Make it an error for GetConfigForCert to return Config w/ nil cache

This prevents an invalid Config from slipping through and causing a hard to
debug nil pointer dereference at some later point.
2023-06-05 16:33:38 -06:00
Matthew Holt
3f145a93b7
readme: Document events 2022-09-05 12:58:01 -06:00
Matthew Holt
a48e34ff31
docs: Clarify readme
DefaultStorage -> Default.Storage
2022-04-25 15:04:47 -06:00
Matthew Holt
55be6d8695
Rename ACMEManager -> ACMEIssuer, CertificateManager -> Manager
This is necessary to eliminate confusing naming conventions, since now
we have Manager types, having an issuer called ACMEManager was
confusing.

CertificateManager is a redundant name as this package is called
CertMagic, so that a Manager manages certificates should be obvious.
It's also more succinct. Plus, it's consistent with Issuer which is not
named CertificateIssuer.
2022-03-24 11:34:31 -06:00
Matthew Holt
6b2f5f9b1b
Update readme
And keep two similar methods next to each other
2021-09-30 13:20:39 -06:00
Matthew Holt
d9f599a2f7
Clarify NextProtos usage (#145) 2021-09-20 13:49:38 -06:00
Matthew Holt
d7578507c8
go.mod: acmez 1.0 (also minor tweaks to readme) 2021-08-26 14:51:56 -06:00
Marco Argentieri
e4f02628f4
Fix code examples (#123) 2021-03-19 11:51:34 -06:00
Cameron Elliott
2ce0f6de55
readme: fix dns solver example code (#114)
Co-authored-by: Cameron Elliott <cameron-elliott@users.noreply.github.com>
2020-12-31 11:50:57 -07:00
Matthew Holt
6b7487bac2
readme: Update CI badge 2020-09-14 13:50:48 -06:00
Matthew Holt
3a209e20b0
Update readme related to DNS provider improvements 2020-07-31 15:45:06 -06:00
Matt Holt
b76b76abfc
Replace lego with ACMEz (close #71) (#78) 2020-07-27 16:50:41 -06:00
AJ ONeal
d43c0e34fd
fix typo in example (#72)
* fix typo in example

needed to move the closing paren one level down

* fix the fix
2020-05-04 21:45:57 -06:00
Matthew Holt
6b19f48596
Update features list 2020-03-14 10:14:50 -06:00
Matthew Holt
b9edcb838b
mholt/certmagic -> caddyserver/certmagic
And update dependencies
2020-03-06 18:05:05 -07:00
Billo Park
9d4a61fd32
readme: Change godoc to pkg.go.dev (#61) 2020-02-24 23:51:02 -07:00
Matthew Holt
37e754b40c
Major refactor to improve performance, correctness, and extensibility
Breaking changes; thank goodness we're not 1.0 yet 😅 - read on!

This change completely separates ACME-specific code from the rest of the
certificate management process, allowing pluggable sources for certs
that aren't ACME.

Notably, most of Config was spliced into ACMEManager. Similarly, there's
now Default and DefaultACME.

Storage structure had to be reconfigured. Certificates are no longer in
the acme/ subfolder since they can be obtained by ways other than ACME!
Certificates moved to a new certificates/ subfolder. The subfolders in
that folder use the path of the ACME endpoint instead of just the host,
so that also changed. Be aware that unless you move your certs over,
CertMagic will not find them and will attempt to get new ones. That is
usually fine for most users, but for extremely large deployments, you
will want to move them over first.

Old certs path:
  acme/acme-staging-v02.api.letsencrypt.org/...

New certs path:
  certificates/acme-staging-v02.api.letsencrypt.org-directory/...

That's all for significant storage changes!

But this refactor also vastly improves performance, especially at scale,
and makes CertMagic way more resilient to errors. Retries are done on
the staging endpoint by default, so they won't count against your rate
limit. If your hardware can handle it, I'm now pretty confident that you
can give CertMagic a million domain names and it will gracefully manage
them, as fast as it can within internal and external rate limits, even
in the presence of errors. Errors will of course slow some things down,
but you should be good to go if you're monitoring logs and can fix any
misconfigurations or other external errors!

Several other mostly-minor enhancements fix bugs, especially at scale.
For example, duplicated renewal tasks (that continuously fail) will not
pile up on each other: only one will operate, under exponential backoff.

Closes #50 and fixes #55
2020-02-21 14:32:57 -07:00
Matthew Holt
6666db6352
Update rate limits
I've decided that the purpose of the internal rate limiter is not to
enforce the CA's rate limits, which only the CA can really do properly.
Instead, they are to avoid hammering the CA endpoint with excessive
requests.
2019-12-17 09:26:54 -07:00
Matthew Holt
c52848a21d
Background cert operations; ManageSync() and ManageAsync()
Split Manage() into ManageSync() and ManageAsync().

In accordance with developing best practices, ACME operations should be
allowed to happen in the background and not block server startup in
non-interactive environments.

We also no longer return an error during batch cert renewals, because
we always treat it as a background operation. (The ManageSync() method
can perform foreground renewal if that is desired.)
2019-10-16 00:19:57 -06:00
Matthew Holt
925f85ac0e
go.mod: Update to lego v3.0.2 2019-09-12 16:18:25 -06:00
Matthew Holt
be4f86a2eb Refactor, simplify, and correct on-demand config; update README
The MaxObtain and other checks such as rate limiting were crippling to
some use cases at scale and incorrect if configs are short-lived; these
changes allow the user to implement their own rate limiting (and simply
limiting the number of certificates to obtain is a bad idea and
shouldn't be done) and to better enforce hostname whitelists for
on-demand config when the high-level functions are used
2019-06-20 18:48:07 -06:00
Matt Holt
8f7a1caa59
Significant refactoring to improve correctness and flexibility (#39)
* Significant refactor

This refactoring expands the capabilities of the library for advanced
use cases, as well as improving the overall architecture, including
possible memory leak fixes if used over a long period with many certs
loaded into memory. This refactor enables using different configs
depending on the certificate.

The public API has changed slightly, however, and arguably it is
slightly less convenient/elegant. I have never quite found the perfect
design for this package, and this certainly isn't it, but I think it's
better than what we had before.

There is still work to be done, but this is a good step forward. I've
decoupled Storage from Cache, and made it easier and more correct for
Configs (and Storage values) to be short-lived. Cache is the only value
that should be long-lived.

Note that CertMagic no longer automatically takes care of storage (i.e.
it used to delete old OCSP staples, but now it doesn't). The functions
to do this are still there and even exported, and now we expect the
application to call the cleanup functions when it wants to.

* Fix little oopsies

* Create Manager abstraction so obtain/renew isn't limited to ACME
2019-04-20 10:44:55 -06:00
seph
1f532f6355 readme: Update storage comment to point to wiki (#36) 2019-03-30 10:43:05 -06:00
David Schwartz
ee1543e2f2 use go-acme/lego (#31)
* use go-acme/lego

* Use master branch of go-lego/acme since v2.3.0 still has a dependency on xenolf/lego

* Use golangci-lint since gometalinter is depricated

* different way of installing golangci-lint for appveyor

* Removing golangci-lint from Appveyor because of https://github.com/client9/shlib/issues/13
2019-03-19 12:38:00 -06:00
Matthew Holt
d9ab603e9b
Use underscores instead of colons in lock key names
Also update readme to match recent lego refactor
2019-01-28 17:53:40 -07:00
Matt Holt
a3b276a1b4
storage: Replace TryLock and Wait with Lock; simplify FileStorage
* Replace TryLock and Wait with Lock, and check for idempotency (issue #5)

* Fix logic of lock waiter creation in FileStorage (+ improve client log)

* Return from Wait() if lock file becomes stale

* Remove racy deletion of empty lock folder

* move all (FileStorage) methods to (*FileStorage) so assignments to fields like fileStorageNameLocks aren't lost

* rework lock acquisition

* Create lockDir just before lock file creation to reduce the chance that another process calls Unlock() and removes lockDir while we were waiting, preventing us from creating the lock file.
* Use the same strategy that Wait() uses to avoid depending on internal state.

* fix unlock of unlocked mutex

* Move fileStorageNameLocksMu into FileStorage struct

* implement new lockfile removal strategy and simplify the lock acquisition loop.

* readme: Add link to full examples

* Rework file lock obtaining and waiting logic

* Remove not-useful optimization to simplify file-locking logic
2018-12-19 14:25:11 -07:00
Jesse Donat
fd326512c1 Removes unpleasant language (#8) 2018-12-14 11:36:19 -07:00
DisposaBoy
02ea7591eb Fix typo: XDG_CACHE_HOME -> XDG_DATA_HOME (#6) 2018-12-13 06:02:39 -07:00
Matthew Holt
3a46a745d3
readme: Explain challenges more, add link to video 2018-12-13 00:11:41 -07:00
Chase Hutchins
9645f8e0e4 readme: use string slice in first readme example (#2) 2018-12-11 21:42:04 -07:00
Matthew Holt
d2f9fba738
Combine Locker interface into Storage; improve docs 2018-12-11 11:46:55 -07:00
Matthew Holt
f4d0f78032
Move some tests over
Tests originally from Caddy's caddytls package

Also fix a few bugs: sorting most recent emails, and nil Config in
HTTP challenge handler
2018-12-10 09:59:03 -07:00
Matthew Holt
69cab9d3a1
Add CI scripts 2018-12-10 00:46:23 -07:00
Matthew Holt
1f94da1ed1
Compatibility with refactored lego core
lego commit: 42941ccea6b431ebff203d4cb520991fb7b47951
2018-12-10 00:26:09 -07:00
Matthew Holt
bea13a36c8
Initial commit 2018-12-09 20:15:26 -07:00