Commit Graph
23 Commits
Author SHA1 Message Date
Alex Vaghin 351dc6a5bf acme: add client.DNS01ChallengeRecord
This change adds implementation for dns-01 challenge responses.

Change-Id: I22b2b304ca4a2caeec2980feff19a6c2bc277d8c
Reviewed-on: https://go-review.googlesource.com/27613
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-08-24 17:30:33 +00:00
Alex Vaghin b35ccbc95a acme: add Client.WaitAuthorization for polling
It is quite often the case users need to poll an authorization until it
reaches a final state.

This change adds a handy method to do exactly that,
as well as updating autocert.Manager to use the new method.

Change-Id: I4d25e4ee751731815b77980caab6da98d3440b5d
Reviewed-on: https://go-review.googlesource.com/27431
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-08-22 20:33:07 +00:00
Alex Vaghin 1ba5ec0bf2 acme: add StatusValid to expected values for Authorize
Let's Encrypt may respond with the "valid" value in status
field to authorization requests:
https://github.com/letsencrypt/boulder/blob/0543691d9e2cbcc1b94baf3b9fab4e64ca2750ef/ra/ra.go#L373-L402

The spec isn't clear on this:
https://tools.ietf.org/html/draft-ietf-acme-acme-02#section-6.4

Either way, this change follows common sense and should not produce
unexpected results.

Change-Id: Iac55aa1fb17d458f6d62e8da875ed86e3e4afbc3
Reviewed-on: https://go-review.googlesource.com/27432
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-08-22 17:42:09 +00:00
Alex Vaghin 7e016f1856 acme: use EC keys where possible
This change improves tests speed further by switching to EC keys where
possible.

We are also switching to EC-based token certs for TLS-SNI-x challenges
in this change. I've confirmed it works with Let's Encrypt production
servers as well, by fulfilling TLS-SNI-01 challenge for a test domain
using autocert.Manager.

Change-Id: I07c532d535ba413af97463dd97cca3d650dfccee
Reviewed-on: https://go-review.googlesource.com/27439
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-08-22 17:01:11 +00:00
Alex Vaghin 3461a682e1 acme: add support for ECDSA-based signatures
A previous change, https://go-review.googlesource.com/25462, added
support only for encoding JWK with a public ECDSA key.
Client users weren't actually able to make any request
using a EC key because of invalid JWS header and signature.

This change adds EC-based header and signature, which makes the Client
to have full support for ECDSA keys now.

Change-Id: Ia88f08465ce941f72d2001019f5aa47441a17d6e
Reviewed-on: https://go-review.googlesource.com/27438
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-08-22 15:57:48 +00:00
Alex Vaghin b3cc731755 acme/autocert: replace DNSNames with HostPolicy
Sanjay came up with this idea of a more flexible way
to place restrictions on the Manager using a HostPolicy hook
instead of the static DNSNames field.

HostPolicy allows for user-made custom policies,
as well as makes it possible to change the set of host names
dynamically, without restarting the Manager.

Change-Id: Ib7c6b047469edc6856b59c5e8365690e66f2a3a4
Reviewed-on: https://go-review.googlesource.com/27251
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-08-21 12:25:19 +00:00
Alex Vaghin 9fbab14f90 acme: add Client.RevokeCert for certificate revocation
This change adds RevokeCert method to Client, implemented as described
in https://tools.ietf.org/html/draft-ietf-acme-acme-02#section-6.6
and https://tools.ietf.org/html/draft-ietf-acme-acme-03#section-6.5.

Change-Id: Ib0defbc299b46268c0f36dbe0f29f0081a3598d5
Reviewed-on: https://go-review.googlesource.com/27092
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-08-17 14:31:42 +00:00
Alex Vaghin a8a4eedf8c acme/autocert: improve test speed on 386
This change makes the tests run considerably faster on GOARCH=386
by reducing test RSA keys to 512-bit size.

It also increases GetCertificate test timeout to allow for slower
computations.

Change-Id: I7a27ffa5130f9ba08ee2069dad29aed74fa8c521
Reviewed-on: https://go-review.googlesource.com/27094
Run-TryBot: Alex Vaghin <ddos@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-08-16 21:05:27 +00:00
Alex Vaghin 1f83de14df acme: improve http-01 challenge API
This makes http-01 handling more consistent with tls-sni-* methods
and, hopefully, future implementation such as dns-01 and oob-01.

Change-Id: If1a4a47ee8528ef19960fee4e6860392c1813fe6
Reviewed-on: https://go-review.googlesource.com/27011
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-08-16 19:51:47 +00:00
Alex Vaghin f0e11a3ccc acme/autocert: new high-level package for automatic cert management
Package autocert provides automatic access to certificates
from Let's Encrypt and any other ACME-based CA.

It is heavily based on the ideas from rsc.io/letsencrypt.

Change-Id: I62021452a918cd49093162f3d6c74e9d7f452fb8
Reviewed-on: https://go-review.googlesource.com/23970
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-08-16 18:52:56 +00:00
Alex Vaghin 807ffeae6d acme: context-aware Client methods
This change adds a context to all exported methods of Client
which may perform network requests, to allow for easier control
over request timeouts and cancellation.

Change-Id: I635a4d7ad39a63ed9e6823b1af12fbb201c19647
Reviewed-on: https://go-review.googlesource.com/27091
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-08-16 16:58:05 +00:00
Alex Vaghin 6575f7ea32 acme: build up full chain certs when requested
The latest ACME spec (v3) changed the wording to:

    ... the server MUST send one or more link relation header
    fields [RFC5988] with relation "up", each indicating a single
    certificate resource for the issuer of this certificate.  The server
    MAY also include the "up" links from these resources to enable the
    client to build a full certificate chain.

See https://tools.ietf.org/html/draft-ietf-acme-acme-03#section-6.3.1.

Before this change, Client was fetching only the first "up" link, but never
checked to follow the chain further. To my knowledge, Let's Encrypt never
provided a chain longer than 1, this is just to make the Client future proof.

Also fixes google/acme#26.

Change-Id: I35cf5f1997b21a0b2a2d0a732043a7e04b7f1c45
Reviewed-on: https://go-review.googlesource.com/26693
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-08-15 19:30:22 +00:00
Alex Vaghin a548aac93e acme: format Client and errors
- move required fields before optional in the Client struct
- prefix all errors with "acme: "
- rename tos to tosURL (Terms of Service)

Change-Id: I6914b7e75d1e0559ff8303d390238c2a27145c8e
Reviewed-on: https://go-review.googlesource.com/27010
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-08-13 21:12:40 +00:00
Alex Vaghin 6c932297e1 acme: preserve account URI on get and update
Let's Encrypt has always provided Account URI in a response
to any registration request (new, get and update) in the Location
header, up until recently (?).

Today, LE's servers provide Account URI only for new-reg requests.
In fact, the spec does not say anything about Account URI and Location
header for "get" and "update" requests.

This change preserves Account URI in return values for "get" and "update"
requests, which is already provided by the caller anyway.

Change-Id: I8b1112d7443935715e9184a511b5e30a27008e8c
Reviewed-on: https://go-review.googlesource.com/26931
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-08-12 21:42:43 +00:00
Alex Vaghin 595bbbd7f5 acme: improve TLSSNI{01,02}ChallengeCert methods
This is a split of https://go-review.googlesource.com/23970 (patch set 8)
to address only Client changes:

1. Expose expected server name value of TLS SNI ClientHello message
2. Fix a bug where returned error value was nil.

Change-Id: I21f571652e9bbef80a2222dc34fce767270b7c48
Reviewed-on: https://go-review.googlesource.com/26852
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-08-11 15:23:48 +00:00
Alex Vaghin 5f961cd492 acme: simplify TLS-SNI challenge cert
There's no need to PEM-encode key/cert pair to create a tls.Certificate.

All tls.X509KeyPair does is decode back to DER and verify that the
key corresponds to the cert. But we already know it does.

Change-Id: Icccdaf7fd86317147476fb03cbc71ee7b4a06edb
Reviewed-on: https://go-review.googlesource.com/26694
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-08-10 14:59:58 +00:00
Anmol Sethi e0d166c33c acme: support for ECDSA keys
Change-Id: I4956b8277969718e70bb4f5f9893213b58e159fc
Reviewed-on: https://go-review.googlesource.com/25462
Reviewed-by: Alex Vaghin <ddos@google.com>
2016-08-05 15:12:09 +00:00
Alex Vaghin 7a1054f3ac acme: TLS-SNI challenges implementation
Current and N-1 versions of the spec adopted TLS-SNI-02, but Let's
Encrypt seems to support TLS-SNI-01, devised in v1 of the spec.

This change implements both, older 01 and current 02 versions of TLS-SNI
challenges.

Change-Id: I2bb76ad852e105098f703cb6113d3996c0e0b118
Reviewed-on: https://go-review.googlesource.com/25450
Reviewed-by: Alex Vaghin <ddos@google.com>
2016-08-04 08:26:12 +00:00
Alex Vaghin 611beeb3d5 acme: specify which version exactly is implemented
The WG has recently published v3 of the spec.
The package implementation is still at v2. So is Let's Encrypt, to be
honest.

Regardless, I think it makes sense to point to the exact version
the package is compatible with.

Change-Id: Ibb3fc51aae363d72f67f7e876ef46c4f51c8da0b
Reviewed-on: https://go-review.googlesource.com/25451
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-08-03 21:26:26 +00:00
Alex Vaghin 1da79bda50 acme: prompt for terms agreement
Allow Client.Register callers to report CA terms agreement,
simplifying the registration usage.

Change-Id: Ia2c237f31c8375b5ae669bbd07d9294c329f59b8
Reviewed-on: https://go-review.googlesource.com/23973
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-07-14 16:03:19 +00:00
Alex Vaghin c2f4947f41 acme: default values and discovery
Add Directory to the Client fields. This removes ACME resource URL
argument from almost all of the Client methods and makes it easier to
use.

Change-Id: I245c975fda914d50fe62ebbec55a4fcf34cb57f2
Reviewed-on: https://go-review.googlesource.com/23972
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-07-09 14:46:51 +00:00
Alex Vaghin 47ff8dfbc5 acme: format test data
A test RSA private key was missing "-" in the END delimiter.
While working fine with encoding/pem, other tools like openssl
seem to have more strict requirements.

See
https://github.com/golang/crypto/commit/1777f3ba8c1fed80fcaec3317e3aaa4f627764d2#commitcomment-17343818
for more details.

Change-Id: I5153bb9cf405755d6621f69c1329da8290695eed
Reviewed-on: https://go-review.googlesource.com/22871
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-06 18:11:22 +00:00
Alex Vaghin 1777f3ba8c acme: initial import of ACME implementation
Originated from github.com/google/goacme.

This does not include goacme command line program
github.com/google/goacme/cmd/goacme. It will probably live somewhere
else.

Change-Id: I852d55c1a3673fab208e6e2aa19d22be42b8719f
Reviewed-on: https://go-review.googlesource.com/20837
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-13 17:25:35 +00:00