Commit Graph

3989 Commits

Author SHA1 Message Date
Jacob Hoffman-Andrews 8afec60433 Remove unneeded dns config value for WFE. (#3057) 2017-09-08 14:32:36 -04:00
Jacob Hoffman-Andrews 20ec1e3e4e Filter spurious shutdown errors. (#3052)
Previously, we would produce an error an a nonzero status code on shutdown,
because gRPC's GracefulStop would cause s.Serve() to return an error. Now we
filter that specific error and treat it as success. This also allows us to kill
process with SIGTERM instead of SIGKILL in integration tests.

Fixes #2410.
2017-09-07 13:45:32 -07:00
Daniel McCarney 84d6a35b1e Restore `run_and_expect_silence` for `godep save`. (#3055) 2017-09-07 11:40:48 -07:00
Daniel McCarney d18e1dbcff Add WrongAuthorizationState error code for UpdateAuthorization (#3053)
This commit adds a new boulder error type WrongAuthorizationState.
This error type is returned by the SA when UpdateAuthorization is
provided an authz that isn't pending. The RA and WFE are updated
accordingly such that this error percolates back through the API to the
user as a Malformed problem with a sensible description. Previously this
behaviour resulted in a ServerInternal error.

Resolves #3032
2017-09-07 11:22:02 -07:00
Jacob Hoffman-Andrews 0b8f8510dd Add parallelism to expired-authz-purger. (#3034)
Fixes #2933

The parallelism code will get executed as part of the existing integration test, with the modified config file.
2017-09-06 15:45:02 -07:00
Roland Bracewell Shoemaker e91349217e Switch to using go 1.9 (#3047)
* Switch to using go 1.9

* Regenerate with 1.9

* Manually fix import path...

* Upgrade mockgen and regenerate

* Update github.com/golang/mock
2017-09-06 16:30:13 -04:00
Daniel McCarney baf32878c0 Prefix problem type with namespace at runtime. (#3039)
To support having problem types that use either the classic
"urn:acme:error" namespace or the new "urn:ietf:params:acme:error"
namespace as appropriate we need to prefix the problem type at runtime
right before returning it through the WFE to the user as JSON. This
commit updates the WFE/WFE2 to do this for both problems sent through
sendError as well as problems embedded in challenges. For the latter
we do not modify problems with a type that is already prefixed to
support backwards compatibility.

Resolves #2938

Note: We should cut a follow-up issue to devise a way to share some
common code between the WFE and WFE2. For example, the
prepChallengeForDisplay should probably be hoisted to a common
"web" package
2017-09-06 12:55:10 -07:00
Roland Bracewell Shoemaker f193137405 Remove superfluous gRPC error encodings (#3048)
Follow up from #3041

Fixes #2589
2017-09-06 12:38:10 -07:00
Kleber Correia 02864c11bf Remove AllowAccountDeactivation flag (#2927)
Part of #2712
2017-09-06 11:11:40 -07:00
Kleber Correia c2156479dd Remove ResubmitMissingSCTsOnly flag (#3042)
Part of #2692
2017-09-06 10:30:30 -07:00
Kleber Correia 710c814720 Remove AllowKeyRollover flag (#3037) 2017-09-06 08:43:15 -04:00
Jacob Hoffman-Andrews 18f15b2b3d Remove unused error types (#3041)
* Remove all of the errors under core. Their purpose is now served by errors, and they were almost entirely unused. The remaining uses were switched to errors.
* Remove errors.NotSupportedError. It was used in only one place (ca.go), and that usage is more appropriately a ServerInternal error.
2017-09-05 16:51:32 -07:00
Jacob Hoffman-Andrews 45f42f6583 Switch recheckCAA error to Unauthorized. (#3040)
ConnectionFailure is only used during validation, and so isn't handled by WFE's
problemDetailsFromBoulderError. This led to returning ServerInternal instead of
the intended error code, and hiding the error detail. Unauthorized is probably
a better error type for now anyhow, but long-term we should switch to a specific
CAA error type.

This PR will allow clients to see the detailed list of problem domains when
new-cert returns an error due to CAA rechecking.
2017-09-05 10:53:47 -07:00
Roland Bracewell Shoemaker 191a043585 Implement handler for retrieving an order object and SA RPC (#3016)
Fixes #2984 and fixes #2985.
2017-09-01 15:26:36 -07:00
Jacob Hoffman-Andrews 1adbb695fe WFE2: Add Revocation support. (#3005)
This PR 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.

Resolves #2952
2017-09-01 14:35:45 -07:00
Daniel b8abe39e28
Fix processRevocation comment 2017-09-01 17:18:45 -04:00
Jacob Hoffman-Andrews ac245b3600 Add a host override flag for checkocsp. (#3035)
Fixes #3028
2017-09-01 11:56:48 -07:00
Daniel 760ca5f081
Remove `authenticateRevocation` handlers. 2017-09-01 12:43:23 -04:00
Daniel d3c802512b
Small review tweaks 2017-09-01 11:58:35 -04:00
Daniel McCarney bde69231b5 Handle `sql.ErrNoRows` for GetAuthorization correctly. (#3024)
Prior to this commit if the sa.GetAuthorization found no pending authz
rows and no authz rows for a given authz ID then sql.ErrNoRows
was returned to callers.

This commit changes the SA's GetAuthorization function to transform
sql.ErrNoRows into berrors.NotFound error. The wfe (and wfe2) are
updated to check for the GetAuthorization error being a berrors.NotFound
instance and now handle this correctly with a missing response instead of
a server internal error.

Resolves #3023
2017-08-31 15:55:47 -07:00
Daniel c4f235a614
Update `regHoldsAuthorizations` to `acctHoldsAuthorizations`. 2017-08-31 16:12:29 -04:00
Daniel 38b1c2620c
Merge remote-tracking branch 'le/master' into cpu-wfe2-revocation 2017-08-31 16:07:43 -04:00
Daniel ec1e7803d8
Fix tests 2017-08-31 15:37:35 -04:00
Daniel 5ab10c6744
Review feedback 2017-08-31 15:23:17 -04:00
Daniel McCarney 99eeb01984 Only wrap error given to `Rollback` when `tx.Rollback()` fails. (#3025)
Prior to this commit the `Rollback` function always wrapped the provided
error in a `sa.RollbackError`. This makes it difficult for callers to
test the type of the original error. This commit updates the `Rollback` function to only
return a `sa.RollbackError` when the call to `tx.Rollback()` produces an error.
2017-08-31 14:44:25 -04:00
Daniel 29377bb9d2
Refactor large `RevokeCertificate` method. 2017-08-31 13:08:21 -04:00
Jacob Hoffman-Andrews 2549c3c80e Recommend avoiding named returns. (#3027) 2017-08-31 12:22:50 -04:00
Jacob Hoffman-Andrews ba95793628 Remove all named returns from RA. (#3021)
This is a followup from https://github.com/letsencrypt/boulder/pull/3017, in
which we identified a data race caused by the use of named returns. This also
reverts the change from that PR, which was only a surface level fix.

Fixes #3019.
2017-08-30 12:03:27 -07:00
Jacob Hoffman-Andrews 08cd61bcfa Consolidate "rpm" Travis task with another task. (#3022)
Travis only allows us 5 simultaneous build jobs, so going from 6 to 5 jobs per
build should reduce the wall time required to get a CI result on any given
branch.
2017-08-30 11:57:08 -07:00
Daniel 65f64a92ba
Remove deprecated `Resource` fields. 2017-08-30 12:28:15 -04:00
Daniel addb3b8683
Typo fix 2017-08-30 12:25:07 -04:00
Jacob Hoffman-Andrews 4ec662ee59 Fix data race when MatchesCSR fails (#3017) 2017-08-29 10:05:09 -04:00
Jacob Hoffman-Andrews b0c7bc1bee Recheck CAA for authorizations older than 8 hours (#3014)
Fixes #2889.

VA now implements two gRPC services: VA and CAA. These both run on the same port, but this allows implementation of the IsCAAValid RPC to skip using the gRPC wrappers, and makes it easier to potentially separate the service into its own package in the future.

RA.NewCertificate now checks the expiration times of authorizations, and will call out to VA to recheck CAA for those authorizations that were not validated recently enough.
2017-08-28 16:40:57 -07:00
Jacob Hoffman-Andrews a0ec53d183 Raise Exceptions rather than strings. (#3015)
raise("foo") isn't valid Python, but raise Exception("foo") is.
2017-08-28 15:23:26 -04:00
Jacob Hoffman-Andrews 0d69b24fcc Move VA's CAA code into separate file (#3010)
va.go is quite a large file. This splits out the CAA-related code and tests into its own file for simplicity. This is a simple move; no code has been changed, and there is no package split.
2017-08-28 11:24:03 -07:00
Jacob Hoffman-Andrews d1249525ab Increase timeouts for dns-test-srv. (#3011)
They used to be a millisecond, which remarkably worked most of the time.
However, some fraction of DNS requests would fail and need to be retried. Even
successful integration test runs had a number of such failures, but retries
generally saved them. However, sometimes all of the retries for a given lookup
would fail, leading to a failure of the overall lookup. This typically
manifested as an error looking up CAA, because our integration tests look up CAA
much more frequently than other record types.

This appears to fix our integration test flakiness.
2017-08-26 13:04:24 -04:00
Jacob Hoffman-Andrews 9026f6cbf8 Remove global state from VA test (#3009)
The VA test had a global:

`var ident = core.AcmeIdentifier{Type: core.IdentifierDNS, Value: "localhost"}`

Evidently this was meant as a convenience to avoid having to retype this common value, but it wound up being mutated independently by different tests. This PR replaces it with a convenience function `dnsi()` that generates a DNS-type identifier with the given hostname. Makes the VA test much more reliable locally.
2017-08-25 16:55:38 -07: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 McCarney 387209dfb5 Update `google/safebrowsing` lib to tip of master. (#3006)
This commit updates the `github.com/google/safebrowsing` dependency to
commit f387af, the tip of master at the time of writing.

Unit tests were confirmed to pass per CONTRIBUTING.md:
```
$ go test ./...
ok    github.com/google/safebrowsing  2.500s
?     github.com/google/safebrowsing/cmd/sblookup [no test files]
?     github.com/google/safebrowsing/cmd/sbserver [no test files]
?     github.com/google/safebrowsing/cmd/sbserver/statik  [no test files]
?     github.com/google/safebrowsing/internal/safebrowsing_proto  [no test files]
```
2017-08-24 12:58:31 -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
Roland Bracewell Shoemaker eadbc19c43 Switch DNS metrics from statsd to prometheus (#2994)
Makes the DNS stats code much nicer if I don't say so myself. Should make investigating DNS problems much easier now as well.

Fixes #2956.
2017-08-22 14:33:36 -07: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
Roland Bracewell Shoemaker 53a180bf22 Remove unused policy/pa/suffixMatch function (#2993) 2017-08-18 10:10:05 -04:00
Roland Bracewell Shoemaker 3140c3f160 Add CSR signature algorithm usage metric (#2990) 2017-08-18 10:09:24 -04:00
Roland Bracewell Shoemaker 11a2149746 Switch from badSignatureAlgorithms to goodSignatureAlgorithms (#2989)
In ca/certificate-authority.go, we previously had a block list of signature algorithms we will not accept for CSRs. This commit switches to an allowed list of signature algorithms that we will accept.
2017-08-17 08:55:07 -04:00
Roland Bracewell Shoemaker e17175a851 Remove new-cert and new-authz handlers from wfe2 (#2987) 2017-08-16 15:50:55 -04:00
Roland Bracewell Shoemaker 6962bfe1a6 WFE2 new-order implementation (#2981)
Limited tests, since we don't do any integration tests for wfe2 this could still not be perfect.

Fixes #2930.
2017-08-16 12:40:56 -07: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
Roland Bracewell Shoemaker c560fa4fc5 Remove features checks from wfe2 (#2982) 2017-08-16 10:53:47 -04:00