Граф коммитов

84 Коммитов

Автор SHA1 Сообщение Дата
Filippo Valsorda 5cd40a374b acme/autocert: surface details of acme.AuthorizationError
Fixes golang/go#19800

Change-Id: If915a70f4dee78e71dcfc487726cdf83d45b4d50
Reviewed-on: https://go-review.googlesource.com/115938
Reviewed-by: Alex Vaghin <ddos@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-14 20:24:12 +00:00
Roland Shoemaker e6b1200d11 acme: fix encoding of the TLS-ALPN challenge extension
To comply with the specification the value of the extension should be a ASN.1
OCTET STRING rather than a raw SHA 256 hash. This change uses asn1.Marshal to
wrap the hash before putting it in the extension.

Change-Id: I4ebe88a00238c6f928555d605e4b5dd98aad8128
Reviewed-on: https://go-review.googlesource.com/118696
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-06-13 20:22:54 +00:00
Maciej Dębski 8ac0e0d97c acme: add support for TLS-ALPN
This adds support for the new challenge type, as described in
https://tools.ietf.org/html/draft-ietf-acme-tls-alpn-01

Updates golang/go#25013

Change-Id: I81b335ff4b4e89e705a70e7d38dd21c3d5f5c25f
Reviewed-on: https://go-review.googlesource.com/116995
Reviewed-by: Alex Vaghin <ddos@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-08 09:28:29 +00:00
Brad Fitzpatrick b47b158736 acme/autocert: change a var to a const
A var isn't needed and a const is what the upstream (Go 1.10+) version
it's copying is.

Change-Id: I335270be3b3d09ac3c22cf6fb889a74ac39b8f1d
Reviewed-on: https://go-review.googlesource.com/116379
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2018-06-06 01:55:41 +00:00
Filippo Valsorda d16218638d acme/autocert: fix build in Go 1.9
Updates golang/go#22066

Change-Id: I7eb6a60deb6680003245815760e2ce6a8f7d8b15
Reviewed-on: https://go-review.googlesource.com/116496
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-06-06 00:54:49 +00:00
Filippo Valsorda 78e79280f6 acme/autocert: update Manager.Client and Cache docs
Fixes golang/go#22064

Change-Id: Icb3f5b2c1967630a3dcbd9661b3492f5d3acc654
Reviewed-on: https://go-review.googlesource.com/115937
Reviewed-by: Alex Vaghin <ddos@google.com>
2018-06-06 00:37:54 +00:00
Filippo Valsorda 8f8078c97f acme/autocert: support both RSA and ECDSA clients on the fly
GetCertificate has all the information it needs to know if a client
supports ECDSA in ClientHelloInfo. Deprecate and ignore ForceRSA, and
just obtain a RSA certificate on the fly when a client that doesn't
support ECDSA connects.

This changes the cache key format to have a "+rsa" suffix for RSA
certificates. The default (ForceRSA = false) cache key is unchanged,
so most DirCache instances will still be valid. Caches created with
ForceRSA set will be silently ignored and certificates reissued.

The cache keys for HTTP tokens and the account key are changed to be
guaranteed not to overlap with valid domain names as well.

Note that ECDSA support detection is more strict in following RFC 5246
than crypto/tls, which ignores signature_algorithms.

Fixes golang/go#22066

Change-Id: I70227747b563d6849cb693f83a950d57040b3f39
Reviewed-on: https://go-review.googlesource.com/114501
Reviewed-by: Adam Langley <agl@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-06 00:31:03 +00:00
Alex Vaghin df8d4716b3 acme: clarify retries and backoff algorithm
There's been some confusion about failed request retries.
Rightfully so: some requests are retried, others are not.

This change attempts to clarify the issue and unify backoff
usage in all Client's methods by introducing a new exported
optional field RetryBackoff and adding retry logic where missing.

Also, updates golang/go#22457.

Change-Id: Ied434edf998d52925a48b6b3b2407d45a6e9d2ee
Reviewed-on: https://go-review.googlesource.com/109615
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-02 22:01:24 +00:00
Alex Vaghin ab813273cd acme/autocert: improve authorizations cleanup
Fixes a bug introduced in golang.org/cl/100078 where incorrect
ACME client was used, causing nil pointer dereference.

The change also improves related tests,
removing code paths diverging in testing.

Fixes golang/go#25581

Change-Id: I8c5531fcc5814a5a64f14911c0ad86c476a76d2f
Reviewed-on: https://go-review.googlesource.com/114817
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2018-05-27 07:24:34 +00:00
Alex Vaghin a3beeb7486 acme/autocert: support configurable CSR extensions
Package users can now provide extra CSR extensions
to serve certificates with desired properties.

Fixes golang/go#17801.
Change-Id: Iac1010f41391c865f6e318bad2e0dafc2ffef6b1
Reviewed-on: https://go-review.googlesource.com/42470
Reviewed-by: Adam Langley <agl@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-05-25 16:01:59 +00:00
Leo Antunes 75e913eb8a acme/autocert: revoke dangling pending authzs
We now keep track of pending authorization requests during verify() and
defer the asynchronous revocation of the ones that failed.
This should help avoid letsencrypt's "too many currently pending
authorizations" error.

Fixes golang/go#23426

Change-Id: Ibffb10f59733962d45e43b67fc42a2ec7c5faf51
Reviewed-on: https://go-review.googlesource.com/100078
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Leo Antunes <costela@gmail.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2018-05-23 19:40:57 +00:00
Brad Morgan c3a3ad6d03 acme/autocert: use valid certificates from the cache during renewal
Currently, the renewal flow will check the cache before renewing to make
sure it is actually necessary. This change modifies this flow to update
the local state so the cached cert is actually used by the manager.

Fixes golang/go#22960

Change-Id: I16668e8098616190938ee52858294b59bc1a5160
Reviewed-on: https://go-review.googlesource.com/89995
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-03-19 06:17:31 +00:00
Jake Burkhead 0b6b69c7d2 acme/autocert: return error from cachePut
Fixes https://github.com/golang/go/issues/23569

Change-Id: I0f3ffab74acd2b69da0bbec2e0e90e42c2618071
GitHub-Last-Rev: e66a888d64
GitHub-Pull-Request: golang/crypto#35
Reviewed-on: https://go-review.googlesource.com/98756
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-03-06 22:18:58 +00:00
Alex Vaghin 91a49db82a acme: stop polling authz on 4xx client errors
"At Let's Encrypt, we are seeing clients in the wild that continue
polling their challenges long after those challenges have expired and
started serving 404."

The 4xx response code errors are client errors and should not be
retried.

Fixes golang/go#24145

Change-Id: I012c584fc4defd3a0d64a653860c35705c5c6653
Reviewed-on: https://go-review.googlesource.com/97695
Run-TryBot: Alex Vaghin <ddos@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-02-28 16:13:26 +00:00
Ingo Gottwald 9de5f2eaf7 acme/autocert: Remove unused retryAfter func
Change-Id: I607d3d2c28aa5a125bddc3fea4f9508942bc1365
Reviewed-on: https://go-review.googlesource.com/93315
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-02-11 21:16:03 +00:00
Alex Vaghin 13931e22f9 acme/autocert: support http-01 challenge type
The Manager now loops through known challenge types,
trying to fulfill one at a time until it succeeds or runs out
of supported challenges.

The provisioning of "http-01" challenges can be done
using the new Manager.HTTPHandler method.
It requires listening on unencrypted port 80.

Fixes golang/go#21890

Change-Id: I55de9501f0069a9f460fedd8b5b0a09b94f9ef05
Reviewed-on: https://go-review.googlesource.com/87201
Run-TryBot: Alex Vaghin <ddos@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-01-12 20:08:14 +00:00
Kevin Burke 94eea52f7b all: run gofmt -s on source code
Per the description, the "-s" file issues slight simplifications to
the source code.

Change-Id: I77395d763f5eafb48653902dcedfa56b150b2d67
Reviewed-on: https://go-review.googlesource.com/80138
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-28 19:40:09 +00:00
Kevin Burke 541b9d50ad acme, acme/autocert: add missing articles
Some sentences are missing the word "the" and others have it too
often.

Change-Id: I01a631e8f2655dea4433a73e75cbc94e0c8959c2
Reviewed-on: https://go-review.googlesource.com/71870
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-10-19 17:23:25 +00:00
Alex Vaghin 959b3afb35 acme: fill Subject CN field in the tls-sni challenge certs
This is purely for debugging purposes, where an external system
may have a lookup mechanism based on Common Name.

Change-Id: I50b64ccf82e67fe8a0074a6f9b57e8cf102f1bb3
Reviewed-on: https://go-review.googlesource.com/71130
Run-TryBot: Alex Vaghin <ddos@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
2017-10-19 14:22:11 +00:00
Russ Cox 76eec36fa1 acme/autocert: add Cache to Manager example
If you don't use a cache you're just begging for Let's Encrypt
to ban you for a week due to duplicate certificate requests.
Don't encourage users to get banned.

Change-Id: Icf999c7f28817990bb45931d30692d4040c0ed71
Reviewed-on: https://go-review.googlesource.com/66550
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Vaghin <ddos@google.com>
2017-09-28 14:24:50 +00:00
namusyaka 7d9177d700 acme: reword the godoc to be more human readable
Updates #21902

Change-Id: I2988ba001450339d196da3a0f0687897e807e886
Reviewed-on: https://go-review.googlesource.com/64090
Reviewed-by: JBD <jbd@google.com>
2017-09-16 19:02:15 +00:00
Joe Kyo 27b9897dfc acme: clarify the purpose of CertOption interface
This change also moves CertOption and its relevant types and
functions from acme.go to types.go.

Change-Id: I575c2eb39c137a304111883c275c2a2fb1d0bcd2
Reviewed-on: https://go-review.googlesource.com/51650
Run-TryBot: Alex Vaghin <ddos@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Vaghin <ddos@google.com>
2017-07-28 08:04:30 +00:00
Joe Kyo 51714a8c4a acme, acme/autocert: use canonical http header keys
Change-Id: I6aebbd0c351c1dcc27504f5a6fe02bfe7ebe805b
Reviewed-on: https://go-review.googlesource.com/47361
Run-TryBot: Alex Vaghin <ddos@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Vaghin <ddos@google.com>
2017-07-04 13:58:51 +00:00
Joe Kyo 5746f0a2e2 acme: fix mismatched format arguments in acme_test.go
Change-Id: I4d685309e375fd0bb50d1d32c60ac48a7f2515fc
Reviewed-on: https://go-review.googlesource.com/47358
Run-TryBot: Alex Vaghin <ddos@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Vaghin <ddos@google.com>
2017-07-03 13:47:28 +00:00
Joe Kyo 368a6044bc acme/autocert: clean up temporary directories in TestDirCache()
Change-Id: I5de781adf4071158404da6252d06e4c2c33f298b
Reviewed-on: https://go-review.googlesource.com/47356
Reviewed-by: Alex Vaghin <ddos@google.com>
2017-07-03 08:48:21 +00:00
Johan Brandhorst 850760c427 acme/autocert: enable HTTP/2 on listener
Enables HTTP/2 on any servers used with the autocert listener
by setting "h2" in NextProtos of the listener *tls.Config.
Also adds a warning to the listener documentation that it
enables HTTP/2.

Fixes golang/go#20572

Change-Id: If7c0f5722f0b1781789219fc4e84da3f19a89ab7
Reviewed-on: https://go-review.googlesource.com/45630
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-06-13 21:03:32 +00:00
Brad Fitzpatrick 5a033cc77e acme/autocert: validate SNI value even more
Follow-up to https://golang.org/cl/42497

Change-Id: I638e7ba5e924a74ce5318e4b50fb18082fd1a43f
Reviewed-on: https://go-review.googlesource.com/42499
Reviewed-by: Alex Vaghin <ddos@google.com>
2017-05-04 15:16:30 +00:00
Brad Fitzpatrick 04eae0b62f autocert: validate SNI values more, add tests
Change-Id: I810c8dcc90c056d7fa66bba59c0936f54aabdfc7
Reviewed-on: https://go-review.googlesource.com/42497
Run-TryBot: Alex Vaghin <ddos@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Vaghin <ddos@google.com>
2017-05-03 14:58:23 +00:00
Alex Vaghin 8e03fc1ab6 acme/autocert: remove failed state entries
This change makes the Manager try creating a certificate
again, after a previously unsuccessful attempt.

The implementation is based on a timer, to prevent hitting
an ACME CA with too high QPS when under a heavy load.
The timer is hardcoded to 1 minute.

Fixes golang/go#17740.
Change-Id: I46a49201cf423be3360633a89209d7b2bccc1d76
Reviewed-on: https://go-review.googlesource.com/41694
Run-TryBot: Alex Vaghin <ddos@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-05-02 15:15:34 +00:00
Alex Vaghin c7af5bf263 acme: add missing err assignment check
Spotted it thanks to a proposal in
https://github.com/golang/go/issues/19727.

Change-Id: I389a3fc0db3cf64fba41c3ecd70a236917ea8fa3
Reviewed-on: https://go-review.googlesource.com/41698
Run-TryBot: Sam Whited <sam@samwhited.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Sam Whited <sam@samwhited.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-04-25 19:37:31 +00:00
Alex Vaghin 5f995c0d1c acme: add function to check rate limits
This change exposes a function to extract rate limit duration
from a client error using Retry-After response header.
Author: David Calavera <david.calavera@gmail.com>.

Fixes golang/go#19304.
Change-Id: Iec9cfab398b84c6f216b95d3265ffad1ce2f29a7
Reviewed-on: https://go-review.googlesource.com/37463
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-04-25 18:26:15 +00:00
Alex Vaghin 141c762c16 acme: replace ErrAuthorizationFailed with a type
This provides acme users with more insights into authorization failures.

Updates golang/go#19800.

Change-Id: I821298a6c8bd21fc517b2ab9128dd3d32be90249
Reviewed-on: https://go-review.googlesource.com/40450
Run-TryBot: Alex Vaghin <ddos@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-04-25 15:40:58 +00:00
Alex Vaghin 0e4becf93e acme/autocert: treat invalid cert as a cache miss
A cached cert data may be corrupted or simply contain an expired
certificate, which results in GetCertificate returning an error.

This change makes the Manager ignore those invalid and expired
cache entries, treating them as nonexistent.

Fixes golang/go#20035.

Change-Id: I5345291ecb1aab1cf19671cf0a383135c7102038
Reviewed-on: https://go-review.googlesource.com/41690
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-04-25 15:40:03 +00:00
Alex Vaghin 2b0eeecfe7 acme: generate correct ES512 signatures
The correct curve name for ES512 signatures is P-521, not P-512.
Author: Matthew Endsley <mendsley@gmail.com>.

Fixes golang/go#18357.

Change-Id: I8d9ba046780921a9e1a5eaa947b9bcbd12e60e34
Reviewed-on: https://go-review.googlesource.com/34555
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-04-25 15:34:59 +00:00
Ross Light 3543873453 acme/autocert: return error if Prompt not set
Without this, autocert will panic with an unhelpful nil pointer inside
the acme client.

Reorganized the test suite's ACME server stub creation, as I needed to
be able to stand up a test where GetCertificate was expected to fail.

Change-Id: Ie5e19c6e7766b4578c9b3c16789d7b27bd3be163
Reviewed-on: https://go-review.googlesource.com/40951
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-04-24 14:16:24 +00:00
Alex Vaghin 0242f07995 acme/autocert: extend default value of RenewBefore
This change amends the default renewal to 30 days before cert expiration,
as recommended by various guides and the official LE documentation:
https://letsencrypt.readthedocs.io/en/latest/using.html#renewal

Fixes golang/go#19616.

Change-Id: I9cfadff936871794e2938304e9e5ab1b0e0353d6
Reviewed-on: https://go-review.googlesource.com/38358
Run-TryBot: Alex Vaghin <ddos@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-04-20 16:35:13 +00:00
Ross Light 12c985af85 acme/autocert: extract Manager example from comments
Ensures that it compiles and makes it more discoverable in godoc.

Change-Id: I50a3deb23110017d0eb16b1da0ac729a96ff2602
Reviewed-on: https://go-review.googlesource.com/40952
Run-TryBot: Alex Vaghin <ddos@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-04-18 21:11:11 +00:00
James Hartig cbc3d0884e acme: automatically retry on badNonce errors
After receiving a badNonce error, the call can be safely retried. Nonce
errors can happen unexpectedly based on an unknown expiration date or
server-side changes. Rather than force the caller handle these errors,
retryPostJWS will keep retrying until success or a different error.

According to the spec, the error returned should be
"urn:ietf:params:acme:error:badNonce", but the error that Let's Encrypt
returns is "urn:acme:error:badNonce" so we just check the suffix.

Fixes golang/go#19703

Change-Id: Id15012dff91e51d28ed8bc54f13a6212186cb7df
Reviewed-on: https://go-review.googlesource.com/40130
Run-TryBot: Alex Vaghin <ddos@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Vaghin <ddos@google.com>
2017-04-13 18:22:23 +00:00
Brad Fitzpatrick 9b9c1afcb0 acme/autocert: fix context usage
Context.Err() is not valid before Context.Done().

Updates golang/go#19856

Change-Id: I7605bb227bfc4cb542ef3db49870d4928ce704d1
Reviewed-on: https://go-review.googlesource.com/40396
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Vaghin <ddos@google.com>
2017-04-12 07:03:28 +00:00
Brad Fitzpatrick 6022e334c1 acme: stop using ctxhttp
The ctxhttp package used to be big and gross before net/http supported
contexts natively. Nowadays it barely does anything. Stop using it,
because it just pulls in the old context package anyway. (We can't
really clean up the ctxhttp package until Go 1.9)

Change-Id: I48b11f2f483783a32cbaa75e244301148a304c08
Reviewed-on: https://go-review.googlesource.com/40110
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Vaghin <ddos@google.com>
2017-04-09 15:26:35 +00:00
Filippo Valsorda 420870623a acme: set correct KeyUsage and ExtKeyUsage
A certificate must have the Server Auth Extended Key Usage to be used
for TLS, and an ECDSA certificate must have the Digital Signature Key
Usage to be used at all (you can't encrypt to an ECDSA key).

crypto/tls ignores (E)KUs when serving certificates, and most browsers
do as well, so it works, but OpenSSL would refuse to serve these
certificates, and clients would be allowed to reject them.

Change-Id: I699e58e613f01077e6b67fdb9e789d46e1672112
Reviewed-on: https://go-review.googlesource.com/39913
Run-TryBot: Alex Vaghin <ddos@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Vaghin <ddos@google.com>
2017-04-07 06:32:52 +00:00
Brad Fitzpatrick b020702ab2 acme/autocert: add Listener
Now users can do 1-line LetsEncrypt HTTPS servers:

    log.Fatal(http.Serve(autocert.NewListener("example.com"), handler))

Updates golang/go#17053

Change-Id: I13fcd3985ebf6bc97a7524cceeb7641cf1b66b22
Reviewed-on: https://go-review.googlesource.com/39207
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Vaghin <ddos@google.com>
2017-04-05 14:22:33 +00:00
Brad Fitzpatrick 88915ccf7a acme, acme/autocert: switch to Go 1.7+ context package
The standard library context package has been available since Go 1.7,
and the Go build dashboard (build.golang.org) only tests master and
the past two releases.

Also, the acme package makes no backwards compatibility guarantees,
not that I expect this to influence many people.

Change-Id: Ia1a294212e1e531f28f53cd954d4743a64611cab
Reviewed-on: https://go-review.googlesource.com/39272
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Alex Vaghin <ddos@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-04-02 21:05:33 +00:00
Brad Fitzpatrick b5cf4d8d48 acme/autocert: context propagation and doc tweaks
Change-Id: I061b797d46097e37880bea1911475e2b2f1a0378
Reviewed-on: https://go-review.googlesource.com/39270
Reviewed-by: Alex Vaghin <ddos@google.com>
2017-04-02 20:13:55 +00:00
Alex Vaghin 92783773f0 acme: reduce the number of network round trips
Before this change, every JWS-signed request was preceded
by a HEAD request to fetch a fresh nonce.

The Client is now able to collect nonce values
from server responses and use them for future requests.
Additionally, this change also makes sure the client propagates
any error encountered during a fresh nonce fetch.

Fixes golang/go#18428.

Change-Id: I33d21b450351cf4d98e72ee6c8fa654e9554bf92
Reviewed-on: https://go-review.googlesource.com/36514
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-02-08 23:57:13 +00:00
Heschi Kreinick 22ddb68ecc acme/autocert: fix racy tests
memCache used an unsynchronized map, which failed go test -race. Add a
mutex and constructor function to fix it.

Change-Id: Iddaa492ea1e3d7747965c6423368baa6556402ed
Reviewed-on: https://go-review.googlesource.com/36545
Run-TryBot: Heschi Kreinick <heschi@google.com>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-07 22:59:19 +00:00
Andrew Gerrand 1d77d5bd47 acme/autocert: fix typo in Cache doc comment
Change-Id: I13dc3119cb46f0649147959c05c6c62624c43690
Reviewed-on: https://go-review.googlesource.com/35070
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-01-10 02:19:11 +00:00
Alex Vaghin 9b1a210a06 acme/autocert: add an option for RSA-based certs
Currently, autocert.Manager always generates EC-based certificates.
This change adds an optional field forcing the Manager to use RSA
instead.

An alternative idea, a "double" certificate, where the Manager
presents either RSA or EC certificate based on client's compatibility,
doesn't seem to be worth the implementation time given the constant
increase in Elliptic Curve cryptography.

Fixes golang/go#17744

Change-Id: Idc68abfc698bcff4aad99715baefc06f8fae50ad
Reviewed-on: https://go-review.googlesource.com/34570
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-12-16 17:19:27 +00:00
Brad Fitzpatrick 21853a76e0 acme/autocert: remove trailing dot from domain before requesting cert
Browsers can send an SNI name of "example.com." for
https://example.com./ but LetsEncrypt rejects the trailing dot.

Fixes golang/go#18114

Change-Id: Ie38e355e5b5566a7eb18f77a2449660e22e21b4c
Reviewed-on: https://go-review.googlesource.com/33711
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-11-30 19:27:24 +00:00
Alex Vaghin ca7e7f10cb acme: add v3 implementation to RevokeAuthorization
Let's Encrypt apparently implements authorization revocation as specified
in the v3 of the spec:
https://tools.ietf.org/html/draft-ietf-acme-acme-03#section-6.4.2.

See the relevant boulder source code here:
be01ca17d3/wfe/wfe.go (L1177-L1213)

This change makes RevokeAuthorization compatible with both v2 and v3
versions of the spec, as well as Let's Encrypt staging/production
actual implementation.

Change-Id: I7e860944005a55b156a45d96e1b8eb41126ce6bb
Reviewed-on: https://go-review.googlesource.com/31990
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-10-25 16:12:29 +00:00