Commit Graph

61 Commits

Author SHA1 Message Date
Jacob Hoffman-Andrews c0ffa3d5d1 Remove logging of Request/ResponseNonce. (#3421)
These take up a lot of space in the logs, and we almost never reference
them.
2018-02-06 10:17:12 -05:00
Jacob Hoffman-Andrews 97265c9184 Factor out context.go from wfe and wfe2. (#3086)
* Move probs.go to web.

* Move probs_test.go

* Factor out probs.go from wfe

* Move context.go

* Extract context.go into web package.

* Add a constructor for TopHandler.
2017-09-26 13:54:14 -04:00
Daniel 38b1c2620c
Merge remote-tracking branch 'le/master' into cpu-wfe2-revocation 2017-08-31 16:07:43 -04:00
Daniel 5ab10c6744
Review feedback 2017-08-31 15:23:17 -04:00
Daniel McCarney d9b0f98f75 Use "account" not "registration" throughout WFE2. (#3008)
The ACME specification no longer describes "registrations" since this is
a fairly overloaded term. Instead the term used is "account". This
commit updates the WFE2 & tests throughout to replace occurrences of
"reg" and "registration" to use "acct" and "account".

NOTE: This change is strictly limited to the wfe2 package. E.g. the
RA/SA and many core objects still refer to registrations.

Resolves #2986
2017-08-25 12:31:32 -07:00
Daniel b8916f176c
WFE2: Add Revocation support.
This commit implements certificate revocation for the WFE2. This
endpoint differs from others in that it supports *both* traditional key
ID based JWS request authentication in addition to embedded JWK based
JWS request authentication. The first is considered authenticated to
revoke a certificate if the signer account has valid authorizations for
all of the names in the certificate. The second is considered
authenticated if the embedded JWK that signs the request has the same
public key as the certificate being revoked.
2017-08-24 15:07:08 -04:00
Daniel McCarney d878510768 Migrate WFE2 to use Prometheus stats. (#3002)
Per #3001 we should not be adding new StatsD code for metrics anymore.
This commit updates all of the WFE2 to use 1st class Prometheus stats.
Unit tests are updated accordingly.

I have broken the error stats into two counts:

1. httpErrorCount for all of the http layer client request errors (e.g.
   no POST body, no content-length)
2. joseErrorCount, for all of the JOSE layer client request errors (e.g.
   malformed JWS, broken signature, invalid JWK)

This commit also removes the stubbed out `TestValidKeyRollover` function
from `wfe2/verify_test.go`. This was committed accidentally and the same
functionality is covered by the `wfe2/wfe_test.go` `TestKeyRollover`
function.
2017-08-23 15:05:41 -04:00
Daniel McCarney b6671edd6c WFE2: Add KeyChange support (#2997)
Implements Key Change for the V2 API.

Resolves #2953
2017-08-22 13:13:41 -04:00
Daniel McCarney b0e490ed3f Update WFE2 verify to reject multisig JWS before parsing. (#2979)
RFC 7515 section 7.2.1 "General JWS JSON Serialization Syntax" describes
an optional "signatures" field that contains an array of JSON objects,
each representing a signature or MAC. ACME only uses the mandatory
"signature" field that contains the BASE64URL of a signature.

We previously checked that the parsed JWS had only one signature and
rejected accordingly but in order to be safe and ensure that nothing is
read from this "signatures" array when we intended to be using the
"signature" field this commit updates the check to explicitly reject the
"signatures" field prior to parsing with go-jose similar to how the
unprotected header is handled.
2017-08-16 12:17:01 -07:00
Daniel McCarney 3c8742ffaa Implement ACMEv2 style request validation for WFEv2 (#2935)
This PR reworks the original WFE2 JWS post validation code (primarily
from `verifyPOST()` in WFE1) to use the new "ACME v2" style of JWS verification.
For most endpoints this means switching to a style where the JWS does
*not* contain an embedded JWK and instead contains a Key ID that is used
to lookup the JWK to verify the JWS from the database. For some special
endpoints (e.g. new-reg) there is a self-authenticated JWS style that
uses the old method of embedding a JWK instead of using a Key ID
(because no account to reference by ID exists yet).

The JWS validation now lives in `wfe2/verify.go` to keep the main WFEv2
code cleaner. Compared to `verifyPOST` there has been substantial work
done to create smaller easier to test functions instead of one big
validation function. The existing WFE unit tests that were copied to the
WFE2 are largely left as they were (e.g. cruddy) and updated as
minimally as possible to support the new request validation. All tests
for new code were written in a cleaner subtest style. Cleaning up the
existing tests will be follow-up work (See https://github.com/letsencrypt/boulder/issues/2928).

Since the POST validation for the key-change and revocation endpoints
requires special care they were left out of the WFE2 implementation for now
and will return a "not implemented" error if called.

_Note to reviewers_: this is a large diff to `wfe2/wfe.go` and `wfe2/verify.go` 
that Github will hide by default. You will need to click to view the diffs.

Resolves https://github.com/letsencrypt/boulder/issues/2858
2017-08-08 17:27:35 -07:00
Daniel McCarney 538aeb4a43 WFEv2 updated JWS validation preparation (#2909)
This PR renames wfe2/jose.go to wfe2/verify.go to better reflect
its purpose.
Additionally this PR moves signatureValidationError, extractJWSKey
and verifyPOST from wfe2/wfe.go to wfe2/verify.go. This is in
preparation of refactoring for the ACME v2 POST verification logic to
help keep diffs reviewable.
2017-07-27 10:34:46 -07:00