Commit Graph

1007 Commits

Author SHA1 Message Date
Jacob Hoffman-Andrews a8586d05cd
Add integration test for precertificate OCSP. (#4417)
This test adds support in ct-test-srv for rejecting precertificates by
hostname, in order to artificially generate a condition where a
precertificate is issued but no final certificate can be issued. Right
now the final check in the test is temporarily disabled until the
feature is fixed.

Also, as our first Go-based integration test, this pulls in the
eggsampler/acme Go client, and adds some suport in integration-test.py.

This also refactors ct-test-srv slightly to use a ServeMux, and fixes
a couple of cases of not returning immediately on error.
2019-09-06 13:35:08 -07:00
Jacob Hoffman-Andrews bdd29a1e27
Promote authzv2 to test/config now that it's live (#4421)
This also removes some awkward dancing we did in integration_test.py to
run setup_twenty_days_ago under the opposite config of whatever we were
about to run tests under.

Reverts most of #4288 and #4290.
2019-09-05 12:33:56 -07:00
Daniel McCarney 4a6e34fc4e
va: clean up DNS error handling for HTTP-01 challenges. (#4409)
This PR changes the VA to return `dns` problem type for errors when performing
HTTP-01 challenges for domains that have no IP addresses, or errors looking up
the IP addresses.

The `va.getAddrs` function is internal to the VA and can return
`berrors.BoulderError`s with a DNS type when there is an error, allowing the
calling code to convert this to a problem when required
using an updated `detailedError` function. This avoids some clunky conversion
the HTTP-01 code was doing that misrepresented DNS level errors as connection
problems with a DNS detail message.

In order to add an integration test for challenge validation that results in
`getAddrs` DNS level errors the Boulder tools image had to be bumped to a tag
that includes the latest `pebble-challtestsrv` that
supports mocking SERVFAILs. It isn't possible to mock this case with internal IP
addresses because our VA test configuration does not filter internal addresses
to support the testing context.

Additionally this branch removes the `UnknownHostProblem` from the `probs`
package:

1. It isn't used anywhere after 532c210
2. It's not a real RFC 8555 problem type. We should/do use the
   DNS type for this.

Resolves https://github.com/letsencrypt/boulder/issues/4407
2019-08-28 15:47:35 -04:00
Daniel McCarney c2d8876413
test: remove Go 1.12.0 support (#4401) 2019-08-14 17:26:35 -04:00
Roland Bracewell Shoemaker 04fb34c282 tools: add golang1.12.8 to travis (#4400) 2019-08-13 17:32:19 -04:00
Roland Bracewell Shoemaker 62e52f4103 test: weakKeyDirectory -> weakKeyFile in test configs (#4397) 2019-08-12 18:07:56 -04:00
Jacob Hoffman-Andrews 5e7fee0c4a test: update test/config with deployed configs. (#4396) 2019-08-09 12:08:56 -04:00
Jacob Hoffman-Andrews b7250c1d43
integration: test for DisableAuthz2Orders. (#4390)
To make this work, I changed the twenty_days_ago setup to use
`config-next` when the main test phase is running `config`. That, in
turn, made the recheck_caa test fail, so I added a tweak to that.

I also moved the authzv2 migrations into `db`. Without that change,
the integration test would fail during the twenty_days_ago setup because
Boulder would attempt to create authzv2 objects but the table wouldn't
exist yet.
2019-08-08 17:07:29 -07:00
Roland Bracewell Shoemaker db01830508
Return OCSP unauthorized status if the certificate is expired (#4380)
The ocsp-updater ocspStaleMaxAge config var has to be bumped up to ~7 months so that when it is run after the six-months-ago run it will actually update the ocsp responses generated during that period and mark the certificate status row as expired.

Fixes #4338.
2019-08-01 14:13:27 -07:00
Daniel McCarney 8b518451b4 deps: update github.com/zmap/zlint to latest. (#4384)
* deps: update github.com/zmap/zlint to latest.

Update the `github.com/zmap/zlint` dependency to b126a9b. This captures
a small fix to the `ct_sct_policy_count_unsatisfied` lint that ensures
it isn't run for precertificates.

* config: remove ct_sct_policy_count_unsatisfied from ignored_lints.

With the latest `zlint` the `ct_sct_policy_count_unsatisfied` lint won't
flag precertificates as having an info-level lint result for missing
SCTs. With that fix in place we no longer have to ignore this lint in
the config-next CA configs that enable preissuance linting.
2019-08-01 10:22:30 -07:00
Roland Bracewell Shoemaker 2e4531342d tests: add authorization deactivation integration tests (#4381)
Add pending and valid authorization deactivation integration tests
2019-07-31 17:47:52 -04:00
Daniel McCarney eb20b2accd
CA: implement CFSSL/zlint pre-issuance linting. (#4378)
The `test/config-next` CA configs are both updated to use `zlint` to lint TBS
pre-certificates with a throw-away key and treat any lint findings >=
`lints.Pass` as an error, blocking the CA from signing the TBS pre-cert with its
private key.

The CA `issuePrecertificateInner` function is updated to specifically catch
linting related errors from CFSSL to marshal the linting findings to the audit
log. A small unit test for this change is included.

The CA `IssueCertificateForPrecertificate` function remains unchanged: the CFSSL
interface that defines `SignFromPrecert` doesn't facilitate linting. We still
lint final certificates post-issuance with `cert-checker` and accept the
possibility there may be some compliance issues that could occur between the
precertificate passing linting and the final certificate being signed.

Resolves https://github.com/letsencrypt/boulder/issues/4255
2019-07-31 15:08:57 -04:00
Daniel McCarney bb005e1c79
integration: add test for boulder-janitor. (#4364) 2019-07-29 16:13:10 -04:00
Jacob Hoffman-Andrews 98677b83d8 integration: make test case filter better (#4366) 2019-07-29 09:00:02 -07:00
Jacob Hoffman-Andrews a68c39ad9b SA: Delete unused challenges (#4353)
For authzv1, this actually executes a SQL DELETE for the unused challenges
when an authorization is updated upon validation.

For authzv2, this doesn't perform a delete, but changes the authorizations that
are returned so they don't include unused challenges.

In order to test the flag for both authz storage models, I set the feature flag in
both config/ and config-next/.

Fixes #4352
2019-07-26 14:04:46 -04:00
Roland Bracewell Shoemaker 59ef95230d integration: Fix typo in test/helpers.py (#4369) 2019-07-26 14:02:52 -04:00
Jacob Hoffman-Andrews 1613082c22 integration: Stop printing an exception for HTTP timeout test. (#4368) 2019-07-26 10:03:53 -04:00
Daniel McCarney 9e896325f7
boulder-janitor: add initial daemon for tidying certificate resources. (#4354)
A new `boulder-janitor` command is added that provides a long-running
daemon that cleans up rows associated with expired certificate
resources. At present this is rows from the following tables:

* certificates
* certificateStatus
* certificatesPerName

Adding cleanup of tables associated with Order resources is the next step.

Three prometheus stats are exported:

* janitor_deletions - CounterVec for the number of deletions by table the 
  boulder-janitor has performed.
* janitor_workbatch - GaugeVec for the number of items of work by table
  the boulder-janitor queued for deletion.
* janitor_errors - CounterVec for the number of errors by table and error
  type the boulder-janitor has experienced.
2019-07-24 15:09:04 -04:00
Roland Bracewell Shoemaker cc2754cc57 Report the correct identifier when there are suberrors (#4358)
Turns out the test was already flagging this issue.

Fixes #4356.
2019-07-24 09:12:48 -07:00
Jacob Hoffman-Andrews f06e0ac0b1 tests: delete old files that are no longer used. (#4347) 2019-07-18 14:21:29 -04:00
Daniel McCarney 028822d435 sa: drop SCTReceipts table and assoc. code. (#4344)
The `SCTReceipts` database table and associated model linkages are
legacy cruft from before Boulder implemented SCT embedding. We can
safely remove all of this stuff.
2019-07-17 11:12:42 -07:00
Daniel McCarney bdc9e17afe test: remove stale comment in sa_db_users.sql (#4335)
I noticed this stale bit of text in `test/sa_db_users.sql` while working on something unrelated.

The CA component does not have its own DB, it relies on the SA and its DB the same as
other components. Consulting a historian tells me that this was once true in a lost age :-)

The explicit license header comment isn't required. We don't follow this practice in any of
the other files and assume the base repo LICENSE file is sufficient.

Similarly we don't need to drop each user and recreate them, we use
`CREATE USER IF NOT EXISTS` from MariaDB 10.1+ We also don't need the related
`drop_users.sql` script.
2019-07-15 08:35:26 -07:00
Jacob Hoffman-Andrews 34a55a9b97 integration: add test for failed validation limit. (#4333)
I introduced test_fail_thrice as a specific regression test for #4329,
but I realized that a more general test of the failed validation limit
would have better coverage and also serve as a regression test at the
same time.

Fixes #4332.
2019-07-11 15:35:35 -04:00
Jacob Hoffman-Andrews 74699486ec Fix FasterGetOrderForNames and add tests. (#4331)
This rolls forward #4326 after it was reverted in #4328.

Resolves https://github.com/letsencrypt/boulder/issues/4329

The older query didn't have a `LIMIT 1` so it was returning multiple results,
but gorp's `SelectOne` was okay with multiple results when the selection was
going into an `int64`. When I changed this to a `struct` in #4326, gorp started
producing errors.

For this bug to manifest, an account needs to create an order, then fail
validation, twice in a row for a given domain name, then create an order once
more for the same domain name - that third request will fail because there are
multiple orders in the orderFqdnSets table for that domain.

Note that the bug condition doesn't happen when an account does three successful
issuances in a row, because finalizing an order (that is, issuing a certificate
for it) deletes the row in orderFqdnSets. Failing an authorization does not
delete the row in orderFqdnSets. I believe this was an intentional design
decision because an authorization can participate in many orders, and those
orders can have many other authorizations, so computing the updated state of
all those orders would be expensive (remember, order state is not persisted in
the DB but is calculated dynamically based on the authorizations it contains).

This wasn't detected in integration tests because we don't have any tests that
fail validation for the same domain multiple times. I filed an issue for an
integration test that would have incidentally caught this:
https://github.com/letsencrypt/boulder/issues/4332. There's also a more specific
test case in #4331.
2019-07-11 13:43:42 -04:00
Jacob Hoffman-Andrews 2131065b2d
Revert "SA: improve performance of GetOrderForNames. (#4326)" (#4328)
This reverts commit 9fa360769e.

This commit can cause "gorp: multiple rows returned for: ..." under certain situations.

See #4329 for details of followup.
2019-07-09 14:33:28 -07:00
Jacob Hoffman-Andrews 9fa360769e SA: improve performance of GetOrderForNames. (#4326)
When there are a lot of potential orders to reuse, the query could scan
unnecessary rows, sometimes leading to timeouts. The new query used 
when the FasterGetOrderForNames feature flag is enabled uses the
available index more effectively and adds a LIMIT clause.
2019-07-09 09:46:06 -04:00
Jacob Hoffman-Andrews 3af49a16be
Revert "integration: move to Python3 (#4313)" (#4323)
This reverts commit 796a7aa2f4.

People's tests have been breaking on `docker-compose up` with the following output:

```
ImportError: No module named requests
```

Fixes #4322
2019-07-03 11:35:45 -07:00
Roland Bracewell Shoemaker 0d9b48e280 PA: restructure error for single bad name in multi-name req (#4319) 2019-07-03 13:47:31 -04:00
Jacob Hoffman-Andrews 796a7aa2f4 integration: move to Python3 (#4313)
* integration: move to Python3

- Add parentheses to all print and raise calls.
- Python3 distinguishes bytes from strings. Add encode() and
  decode() calls as needed to provide the correct type.
- Use requests library consistently (urllib3 is not in Python3).
- Remove shebang from Python files without a main, and update
  shebang for integration-test.py.
2019-07-02 09:28:49 -04:00
Roland Bracewell Shoemaker af41bea99a Switch to more efficient multi nonce-service design (#4308)
Basically a complete re-write/re-design of the forwarding concept introduced in
#4297 (sorry for the rapid churn here). Instead of nonce-services blindly
forwarding nonces around to each other in an attempt to find out who issued the
nonce we add an identifying prefix to each nonce generated by a service. The
WFEs then use this prefix to decide which nonce-service to ask to validate the
nonce.

This requires a slightly more complicated configuration at the WFE/2 end, but
overall I think ends up being a way cleaner, more understandable, easy to
reason about implementation. When configuring the WFE you need to provide two
forms of gRPC config:

* one gRPC config for retrieving nonces, this should be a DNS name that
resolves to all available nonce-services (or at least the ones you want to
retrieve nonces from locally, in a two DC setup you might only configure the
nonce-services that are in the same DC as the WFE instance). This allows
getting a nonce from any of the configured services and is load-balanced
transparently at the gRPC layer. 
* a map of nonce prefixes to gRPC configs, this maps each individual
nonce-service to it's prefix and allows the WFE instances to figure out which
nonce-service to ask to validate a nonce it has received (in a two DC setup
you'd want to configure this with all the nonce-services across both DCs so
that you can validate a nonce that was generated by a nonce-service in another
DC).

This balancing is implemented in the integration tests.

Given the current remote nonce code hasn't been deployed anywhere yet this
makes a number of hard breaking changes to both the existing nonce-service
code, and the forwarding code.

Fixes #4303.
2019-06-28 12:58:46 -04:00
Roland Bracewell Shoemaker 1c8cfb3cba Fix SAN to CN promotion (#4298)
Before #4275 if a CSR only contained SANs longer than the max CN limit
it would set the CN to one anyway and would cause the 'CN too long'
check to get triggered. After #4275 if all of the SANs were too long
the CN wouldn't get set and we didn't have a check for `forceCNFromSAN
&& cn == ""` which would allow empty CNs despite `forceCNFromSAN`
being set. This adds that check and a test for the corner case.
2019-06-26 15:34:47 -07:00
Roland Bracewell Shoemaker 844ae26b65
Allow forwarding of nonce-service Redeem RPCs from one service… (#4297)
Fixes #4295.
2019-06-26 13:04:31 -07:00
Roland Bracewell Shoemaker 352899ba2f Remove RevokeAuthorizationsByDomain/2 functionality (#4302)
* Remove RevokeAuthorizationsByDomain/2 functionality
* Remove old integration test
2019-06-26 15:48:18 -04:00
Jacob Hoffman-Andrews 38ef76bcba
Refactor test_caa into four test cases. (#4290)
The three new cases separately test:
 - Rechecking CAA during authz reuse.
 - Successful issuance for a positive CAA record
 - Rejected issuance for a negative CAA record
 - The various CAA extensions from https://tools.ietf.org/html/draft-ietf-acme-caa-06

Importantly, this also switches `recheck.good-caa-reserved.com` to use a
dynamically generated random name. This should fix the problem where
running integration tests locally several times resulted in hitting an
exact match rate limit error, requiring a clear of the fqdnSets table.

This also moves the creation of the client for test_recheck_caa into its
own early-setup function, so there is less test-case-specific setup in
integration-test.py.
2019-06-25 10:51:56 -07:00
Jacob Hoffman-Andrews df19fd9e58
Integration test for v1 authz reuse when v2 flag is enabled (#4288)
When NewAuthorizationSchema is enabled, we still want v1 authzs to be reusable in
new orders. This tests that that code is implemented correctly.

Updates #4241
2019-06-25 10:50:58 -07:00
Jacob Hoffman-Andrews 2a7437af83
Remove seventy- and zero-day ago integration setup (#4292)
These two setup phases were only used by `test_expired_authz_404`,
which is adequately covered by unittests. Since each setup and teardown
is rather time consuming, this speeds up and simplifies integration
tests.

Before: 5m10
After: 4m46
2019-06-25 09:35:58 -07:00
Roland Bracewell Shoemaker 24f150f8fc Re-apply #4279 with requests fix (#4286)
Move from using `requests` to `urllib2` in `helpers.py`. Verified
this works with `docker-compose up`. In the future we really should
be installing our own python dependencies in the boulder-tools image
rather than relying on getting them by using the certbot virtualenv.
2019-06-24 11:58:37 -07:00
Adrien Ferrand 8e31d58113 Revert "tests: Switch to instant OCSP verification in int. tests (#4279)" (#4285)
This reverts commit f4b9235acb.

Fixes #4284
2019-06-23 12:06:16 -07:00
Roland Bracewell Shoemaker f4b9235acb tests: Switch to instant OCSP verification in int. tests (#4279)
* Switch to instant OCSP verification in integration tests
* Move waitport to helpers and use it to determine if ocsp-responder is
  alive in test_single_ocsp
2019-06-21 09:53:01 -04:00
Roland Bracewell Shoemaker 0a16b5f57d Reduce akamai purger interval in integration tests (#4277)
and reduce the verify_akamai_purge deadline/sleep to match the much smaller interval.
2019-06-20 16:31:44 -04:00
Roland Bracewell Shoemaker acc44498d1 RA: Make RevokeAtRA feature standard behavior (#4268)
Now that it is live in production and is working as intended we can remove
the old ocsp-updater functionality entirely.

Fixes #4048.
2019-06-20 14:32:53 -04:00
Daniel McCarney 8d3a246adb
cert-checker: allow ignoring lints by name. (#4272)
This updates the `cert-checker` utility configuration with a new allow list of
ignored lints so we can exclude known false-positives/accepted info results by
name instead of result level. To start only the `n_subject_common_name_included`
lint is excluded in `test/config-next/cert-checker.json`. Once this lands we can
treat info/warning lint results as errors as a follow-up to not break
deployability guarantees.

Resolves https://github.com/letsencrypt/boulder/issues/4271
2019-06-20 13:09:10 -04:00
Jacob Hoffman-Andrews 18a3c78d6f Refactor test_caa and twenty-days-ago setup (#4261)
As part of #4241, I need to introduce some twenty-days-ago setup. So I refactored the
only current instance (test_caa) to use a style where setup functions can be registered right
next to the test cases they affect. The @register_twenty_days_ago is Python for
"call register_twenty_days_ago with the thing on the next line as an argument."

I also cleaned up a bunch of related stuff:
* Removed the ACCOUNT_URI environment variable and associated function params.
This was introduced in in #3736 to pass a URI to challtestsrv before we refactored for
more dynamic updates. It's not used any more.
* Removed a try / except from startChallSrv that needlessly hid errors.
* Move setting of DNS fixtures for caa_test into the test case itself.
2019-06-18 14:58:06 -07:00
Roland Bracewell Shoemaker 098a761c02 ocsp-updater: Remove integrated akamai purger (#4258)
This is now an external service.

Also bumps up the deadline in the integration test helper which checks for
purging because using the remote service from the ocsp-updater takes a little
longer. Once we remove ocsp-updater revocation support that can probably be
cranked back down to a more reasonable timeframe.
2019-06-12 09:36:53 -04:00
Roland Bracewell Shoemaker 3532dce246 Excise grpc maxConcurrentStreams configuration (#4257) 2019-06-12 09:35:24 -04:00
Daniel McCarney fea7106927
WFE2: Add feature flag for Mandatory POST-As-GET. (#4251)
In November 2019 we will be removing support for legacy pre RFC-8555
unauthenticated GET requests for accessing ACME resources. A new
`MandatoryPOSTAsGET` feature flag is added to the WFE2 to allow
enforcing this change. Once this feature flag has been activated in Nov
we can remove both it and the WFE2 code supporting GET requests.
2019-06-07 08:36:13 -04:00
Roland Bracewell Shoemaker 4ca01b5de3
Implement standalone nonce service (#4228)
Fixes #3976.
2019-06-05 10:41:19 -07:00
Daniel McCarney 7dd176e9a4 Implement suberrors for policy blocked names. (#4234)
When validating a CSR's identifiers, or a new order's identifiers there may be more than one identifier that is blocked by policy. We should return an error that has suberrors identifying each bad identifier individually in this case.

Updates https://github.com/letsencrypt/boulder/issues/4193
Resolves https://github.com/letsencrypt/boulder/issues/3727
2019-05-31 15:00:17 -07:00
Roland Bracewell Shoemaker 11d16df3a6
Add authz2 expired-authz-purger tool (#4226)
Fixes #4188.
2019-05-30 14:01:01 -07:00
Roland Bracewell Shoemaker dc11681faa load-generator: Add revocation-by-account support (#4237)
Adds RFC 8555 revocation authorized using the issuing account.
2019-05-30 11:18:19 -04:00