Commit Graph

4408 Commits

Author SHA1 Message Date
Roland Bracewell Shoemaker 3a8f0bc0be Allow ocsp-responder to filter requests by serial prefix (#3815) 2018-08-10 11:16:22 -04:00
Simone Carletti 77c2071392 Update publicsuffix-go to cbbcd04 (#3814)
The previous update was just [9 days ago](https://github.com/letsencrypt/boulder/pull/3808). However, since we merged some changes into the PSL that are related to IANA TLDs I though about providing an immediate patch.

Tests are passing:

```
➜  ~ cd ~/go/src/github.com/weppos/publicsuffix-go
➜  publicsuffix-go git:(master) GOCACHE=off  go test ./...
?   	github.com/weppos/publicsuffix-go/cmd/load	[no test files]
ok  	github.com/weppos/publicsuffix-go/net/publicsuffix	0.021s
ok  	github.com/weppos/publicsuffix-go/publicsuffix	0.034s
```
2018-08-09 13:03:09 -07:00
Daniel McCarney 0cb28c9e02
WFE2: Implement draft-13 keyrollover with feature flag. (#3813)
ACME draft-13 changed the inner JWS' body to contain the old key
that signed the outer JWS. Because this is a backwards incompatible
change with the draft-12 ACME v2 key rollover we introduce a new feature
flag `features.ACME13KeyRollover` and conditionally use the old or new
key rollover semantics based on its value.
2018-08-07 15:27:25 -04:00
Roland Bracewell Shoemaker 52e5f20806 wfe2: return existing account in body (#3811)
Fixes #3801.
2018-08-06 09:01:49 -04:00
Daniel McCarney 29cdd78155
README: Remove slowstart instructions. (#3810)
None of the development team use this approach to running a dev env. It
no longer works without modifying `test/startservers.py` and the `test/`
configurations. Given that it has been broken for a month+ and has only
provoked one user issue I think we can be fairly confident that few others
are using this method of setting up a Boulder development environment
and should prioritize our time/docs accordingly.
2018-08-02 13:52:30 -04:00
Daniel McCarney 139276b171 Godeps: Update publicsuffix-go to b8c0530. (#3808)
This commit updates the vendored `publicsuffix-go` dependency to [b8c0530](b8c0530c1a), the tip of master at the time of writing.

Unit tests confirmed to pass:
```
~/go/src/github.com/weppos/publicsuffix-go/publicsuffix$ go test ./...
?   	github.com/weppos/publicsuffix-go/cmd/load	[no test files]
ok  	github.com/weppos/publicsuffix-go/net/publicsuffix	0.007s
ok  	github.com/weppos/publicsuffix-go/publicsuffix	0.024s
```

Resolves #3807
2018-07-31 13:23:13 -07:00
Roland Bracewell Shoemaker b5f7c62460 Remove leftover publisher CT config (#3803) 2018-07-27 08:05:51 -04:00
Daniel McCarney a13185a5db
Revert "Temporarily allow fetching of expired authzs. #3778" (#3800)
This reverts commit fa8814baab.
2018-07-23 13:12:20 -04:00
Jacob Hoffman-Andrews a6f93ffca4 Fix staggering of log submission. (#3796)
ctpolicy permutes logs before submitting to them, to give each log a
chance. The stagger feature was meant to sleep for an amount of time
proportional to a log's position in the permuted list. However, it was
actually using the log's position in the un-permuted list, so logs that
appear later in the config would always be submitted to later than logs
earlier in the config.

This fixes that, and does some minor variable renaming for clarity.
2018-07-16 10:07:29 -04:00
Jacob Hoffman-Andrews 36a83150ad Add stagger to CT log submissions. (#3794)
This allows each log a chance to respond before we move onto the next,
spreading our load more evenly across the logs in a log group.
2018-07-06 16:25:51 -04:00
Daniel McCarney 92d273408f
docs: remove order ready status v2 divergence. (#3792) 2018-07-05 15:30:27 -04:00
Daniel McCarney bbf0102cdc
Remove UseAIAIssuerURL feature flag and code. (#3790)
We aren't going to deploy this as-is and its causing integration test
problems for downstream clients.
2018-07-03 16:29:44 -04:00
Roland Bracewell Shoemaker 9ea4a54ca2 Use challtestsrv for solving TLS-ALPN-01 in integration tests (#3789)
Also in the process fix some errors I made in the original challtestsrv TLS-ALPN-01 implementation.

Fixes #3780.
2018-07-03 10:41:20 -04:00
Jacob Hoffman-Andrews fa8814baab Temporarily allow fetching of expired authzs. #3778
This also allows deactivating expired authzs, which is fine.

Fixes #3777
2018-06-29 13:57:34 -04:00
Jacob Hoffman-Andrews 6c6e82fcc3 Deconflict netaccess and boulder containers. (#3785)
Since these two containers were using the same entrpoint.sh, they were
competing to run migrations and bind ports when run with `docker-compose
up`. Since we don't need the netaccess container when doing
`docker-compose up`, give it a separate entrypoint that exits
immediately by default, but does the normal migrations when run with
`docker-compose run`.
2018-06-29 12:35:19 -04:00
Roland Bracewell Shoemaker 670ab0a141 Switch from Unicode NFKC->NFC (#3782) 2018-06-28 18:52:00 -07:00
Roland Bracewell Shoemaker e27f370fd3 Excise code relating to pre-SCT embedding issuance flow (#3769)
Things removed:

* features.EmbedSCTs (and all the associated RA/CA/ocsp-updater code etc)
* ca.enablePrecertificateFlow (and all the associated RA/CA code)
* sa.AddSCTReceipt and sa.GetSCTReceipt RPCs
* publisher.SubmitToCT and publisher.SubmitToSingleCT RPCs

Fixes #3755.
2018-06-28 08:33:05 -04:00
Jacob Hoffman-Andrews a6597b9f12 Change pendingAuthorizations indexes for better performance. (#3775)
There are two main queries we do against pendingAuthorizations: counting pending authzs
for rate limiting, and looking up existing authorizations for reuse. Neither of these is served
perfectly by our current (regID, expires) index. The index works well in some conditions but
not others. This change adds two more specific indexes to replace the existing ones.

The below set of EXPLAINs demonstrates the new indexes in use. Note that in order to
get MariaDB to make proper use of the new index, I had to create a local account and
fill it with pending authzs using a modified chisel.py.

The `registrationID`, `status`, `expires` index is used for the case when an account creates
and then deactivates a lot of authzs, since deactivated authzs stay in the pending table
and create performance issues. Adding an index that includes status can fix those performance
issues. The last section of statements logs below, after I `UPDATE` all the pending authorizations
to be `deactivated`, demonstrates the speed difference in the count query (check the `rows` count).

```
mysql> SHOW CREATE TABLE pendingAuthorizations \G                                                                     *************************** 1. row ***************************
       Table: pendingAuthorizations
Create Table: CREATE TABLE `pendingAuthorizations` (
  `id` varchar(255) NOT NULL,
  `identifier` varchar(255) NOT NULL,
  `registrationID` bigint(20) NOT NULL,
  `status` varchar(255) NOT NULL,
  `expires` datetime DEFAULT NULL,
  `combinations` varchar(255) NOT NULL,
  `LockCol` bigint(20) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `regId_expires_idx` (`registrationID`,`expires`),
  CONSTRAINT `regId_pending_authz` FOREIGN KEY (`registrationID`) REFERENCES `registrations` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8
1 row in set (0.00 sec)

mysql> EXPLAIN SELECT COUNT(*) FROM pendingAuthorizations WHERE status = 'pending' AND expires > NOW() \G             *************************** 1. row ***************************                                                                   id: 1
  select_type: SIMPLE
        table: pendingAuthorizations
         type: ALL
possible_keys: NULL
          key: NULL
      key_len: NULL
          ref: NULL
         rows: 270
        Extra: Using where
1 row in set (0.01 sec)

mysql> EXPLAIN SELECT COUNT(*) FROM pendingAuthorizations WHERE registrationID = 2003 AND status = 'pending' AND expires > NOW() \G
*************************** 1. row ***************************
           id: 1
  select_type: SIMPLE
        table: pendingAuthorizations
         type: ref
possible_keys: regId_expires_idx
          key: regId_expires_idx
      key_len: 8
          ref: const
         rows: 150
        Extra: Using index condition; Using where
1 row in set (0.00 sec)

mysql> EXPLAIN SELECT id, identifier, registrationID, status, expires, combinations, LockCol FROM pendingAuthorizations WHERE registrationID = 2003 AND identifier = '{\"type\":\"dns\",\"value\":\"23.com\"}' AND status = 'pending' AND expires > NOW() ORDER BY expires ASC LIMIT 1 \G                                                                         *************************** 1. row ***************************
           id: 1
  select_type: SIMPLE
        table: pendingAuthorizations
         type: ref
possible_keys: regId_expires_idx
          key: regId_expires_idx
      key_len: 8
          ref: const
         rows: 150
        Extra: Using index condition; Using where
1 row in set (0.00 sec)

mysql>
mysql> ALTER TABLE `pendingAuthorizations`
    ->   ADD INDEX `identifier_registrationID_status_expires_idx` (
    ->     `identifier`, `registrationID`, `status`, `expires`),
    ->   ADD INDEX `registrationID_status_expires_idx` (
    ->     `registrationID`, `status`, `expires`),
    ->   DROP INDEX `regId_expires_idx`;
Query OK, 0 rows affected (0.05 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> EXPLAIN SELECT COUNT(*) FROM pendingAuthorizations WHERE registrationID = 2003 AND status = 'pending' AND expires > NOW() \G                                                                                                         *************************** 1. row ***************************
           id: 1
  select_type: SIMPLE
        table: pendingAuthorizations
         type: range
possible_keys: registrationID_status_expires_idx
          key: registrationID_status_expires_idx
      key_len: 781
          ref: NULL
         rows: 150
        Extra: Using where; Using index
1 row in set (0.00 sec)

mysql> EXPLAIN SELECT id, identifier, registrationID, status, expires, combinations, LockCol FROM pendingAuthorizations WHERE registrationID = 2003 AND identifier = '{\"type\":\"dns\",\"value\":\"23.com\"}' AND status = 'pending' AND expires > NOW() ORDER BY expires ASC LIMIT 1 \G
*************************** 1. row ***************************
           id: 1
  select_type: SIMPLE
        table: pendingAuthorizations
         type: range
possible_keys: identifier_registrationID_status_expires_idx,registrationID_status_expires_idx
          key: identifier_registrationID_status_expires_idx
      key_len: 1548
          ref: NULL
         rows: 1
        Extra: Using index condition
1 row in set (0.00 sec)

mysql> UPDATE pendingAuthorizations SET status = 'deactivated' WHERE registrationID = 2003;
Query OK, 150 rows affected (0.02 sec)
Rows matched: 150  Changed: 150  Warnings: 0

mysql> EXPLAIN SELECT COUNT(*) FROM pendingAuthorizations WHERE registrationID = 2003 AND status = 'pending' AND expires > NOW() \G                                                                                                         *************************** 1. row ***************************
           id: 1
  select_type: SIMPLE
        table: pendingAuthorizations
         type: range
possible_keys: registrationID_status_expires_idx
          key: registrationID_status_expires_idx
      key_len: 781
          ref: NULL
         rows: 1
        Extra: Using where; Using index
1 row in set (0.01 sec)

mysql> 
mysql> ALTER TABLE `pendingAuthorizations`
    ->   DROP INDEX `identifier_registrationID_status_expires_idx`,
    ->   DROP INDEX `registrationID_status_expires_idx`,
    ->   ADD INDEX `regId_expires_idx` (`registrationID`,`expires`);
Query OK, 0 rows affected (0.04 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> EXPLAIN SELECT COUNT(*) FROM pendingAuthorizations WHERE registrationID = 2003 AND status = 'pending' AND expires > NOW() \G
*************************** 1. row ***************************
           id: 1
  select_type: SIMPLE
        table: pendingAuthorizations
         type: ref
possible_keys: regId_expires_idx
          key: regId_expires_idx
      key_len: 8
          ref: const
         rows: 150
        Extra: Using index condition; Using where
1 row in set (0.00 sec)
```
2018-06-26 10:49:20 -07:00
Shiloh Heurich d7bfbd25be Fix gen-ca output (#3773)
Fix: When any of OCSPURL, CRLURL or IssuerURL in the CertProfile are empty, the relevant fields are encoded in ASN.1 as empty arrays.
Fix: KeyUsage is a bitmask requiring bitwise OR.
2018-06-21 15:22:02 -07:00
Roland Bracewell Shoemaker 1e6699d03e Remove hyphens from ACME-CAA parameters (#3772)
The hyphens were incompatible with RFC 6844 (but not RFC 6844bis), and
broke some CAA-processing software in practice. Hugo revised the ACME-CAA
draft (https://datatracker.ietf.org/doc/html/draft-ietf-acme-caa-05) to remove
the hyphens.
2018-06-21 13:49:48 -07:00
Shiloh Heurich 3f348f1284 Require OCSPURL and CRLURL in CertProfile only for intermediates. (#3771) 2018-06-21 13:58:00 -04:00
Roland Bracewell Shoemaker 6692dd5628 Add TLS-ALPN-01 support to challtestserv (#3758)
Adds support for TLS-ALPN-01 challenges to `test/challtestsrv`.

Fixes #3757.
2018-06-18 14:25:26 -04:00
Daniel McCarney 2dadd5e09a VA: Log exceptional non-problem remote VA errors. (#3760)
Previously, if a remote VA returned an error that is not a ProblemDetail, the
primary VA would log a ServerInternalProblem but not the underlying error.
This commit updates performRemoteValidation to always return the full error it
receives from a remote VA.

This commit also adds a unittest that checks that the VA still returns a
ServerInternalProblem to the RA, and that the VA audit logs the underlying
error.

Resolves https://github.com/letsencrypt/boulder/issues/3753
2018-06-15 10:53:16 -07:00
Jacob Hoffman-Andrews 49a1959e21
Upgrade MariaDB in CI to 10.3. (#3765) 2018-06-15 10:29:41 -07:00
Roland Bracewell Shoemaker ef02f513d9 Fix wait_tcp_port in test/entrypoint.sh (#3763)
* If loop hits max exit with 1

* Increase timeout
2018-06-15 08:45:30 -04:00
Daniel McCarney fa9a79b55f
CI/Dev: Remove Go 1.10.2. (#3761)
We've migrated the production/staging Boulder instances to builds using
Go 1.10.3 and can now remove the Go 1.10.2 builds from the travis matrix
and the `tag_and_upload.sh` Boulder tools script.
2018-06-14 12:04:29 -04:00
Jacob Hoffman-Andrews 2142544bdd Fix missing rollback-on-error cases in SA. (#3759)
In each of GetAuthorization, DeactivateAuthorization, and SetOrderError, there
was an error case that could cause us to not rollback the transaction,
leaving it open. This could cause database performance problems.
2018-06-14 08:48:46 -04:00
Roland Bracewell Shoemaker 6fe950bc0c
Add PKCS#11 certificate generation tool (#3729)
Tested against relevant hardware for generating both RSA and ECDSA roots and intermediates with keys generated using `gen-key`.

Also this makes a few changes to the `gen-key` tool after further experience with the HSM and more reading of the PCKS#11 specification. Main change is the removal of `compatMode`, which was intended to provide support for two naming schemes for EC used in subsequent PKCS#11 drafts. It turns out these schemes were changes in name only and the underlying structs/ints were the exact same (i.e. `CKA_ECDSA_PARAMS == CKA_EC_PARAMS` and `CKM_ECDSA_KEY_PAIR_GEN == CKM_EC_KEY_PAIR_GEN`) and just allowed using one of the two names based on preference. This meant with `compatMode` enabled or disabled the tool did the exact same thing.

Fixes #3697.
2018-06-12 12:13:09 -07:00
Roland Bracewell Shoemaker c96e1f150b Update boulder-tools (#3754) 2018-06-12 13:29:07 -04:00
Daniel McCarney b9dd06ad85 CI/Dev: Add Go 1.10.3 to build matrix. (#3751) 2018-06-11 15:55:26 -07:00
Roland Bracewell Shoemaker 813aa788e9 Assume acmeValidation-v1 is wrapped OCTET STRING (#3752)
As defined by the spec.
2018-06-11 14:44:13 -07:00
Joel Sing 9c2859c87b Add support for CAA account-uri validation. (#3736)
This adds support for the account-uri CAA parameter as specified by
section 3 of https://tools.ietf.org/html/draft-ietf-acme-caa-04, allowing
issuance to be restricted to one or more ACME accounts as specified by CAA
records.
2018-06-08 12:08:03 -07:00
Daniel McCarney 8583e42964
RA: Forbid contact addresses for IANA example domains. (#3748)
We see a fair number of ACME accounts/registrations with contact
addresses for the RFC2606 Section 3 "Reserved Example Second Level
Domain Names" (`example.com`, `example.net`, `example.org`). These are
not real contact addresses and are likely the result of the user
copy-pasting example configuration. These users will miss out on
expiration emails and other subscriber communications :-(

This commit updates the RA's `validateEmail` function to reject any
contact addresses for reserved example domain names. The corresponding
unit test is updated accordingly.

Resolves https://github.com/letsencrypt/boulder/issues/3719
2018-06-08 13:42:51 -04:00
Maciej Dębski bb9ddb124e Implement TLS-ALPN-01 and integration test for it (#3654)
This implements newly proposed TLS-ALPN-01 validation method, as described in
https://tools.ietf.org/html/draft-ietf-acme-tls-alpn-01 This challenge type is disabled 
except in the config-next tree.
2018-06-06 13:04:09 -04:00
Roland Bracewell Shoemaker 63f34c3700 Update boulder-tools image to contain master certbot/certbot (#3746) 2018-06-05 10:00:08 -04:00
Roland Bracewell Shoemaker 72949d5915
Switch from globalsign/certlint to zmap/zlint (#3745)
Switch linting library to zmap/zlint.

```
github.com/zmap/zlint$ go test ./...
ok  	github.com/zmap/zlint	0.190s
?   	github.com/zmap/zlint/cmd/zlint	[no test files]
ok  	github.com/zmap/zlint/lints	0.216s
ok  	github.com/zmap/zlint/util	(cached)
```
2018-06-04 17:47:06 -07:00
Daniel McCarney b29fe6559d VA: Log challenge type in `checkCAA`. (#3742)
This commit updates the VA's checkCAA function to include the provided
challengeType parameter as part of the audit log line for the CAA
check result. If challengeType == nil then the value "none" is logged.
Unit tests are updated accordingly.

This change will make it easier to distinguish cases where "Valid for
issuance" is false because of a validation-methods restriction.

Resolves #3740
2018-06-04 09:19:10 -07:00
Daniel McCarney 0306a933ac CI: Ignore Godeps 'Comment' fields in godep-restore. (#3744)
In preparation of `vgo` it seems many upstream projects are adding new
tags. This is causing variations in the `godep-restore` phase of CI when
the CI Godeps picks up a new `Comment` field that isn't present in the
committed JSON. This has broken master ~3 times now and so it seems
prudent to ignore the Comment field entirely for the short term. We
continue to wait for the glorious day in which we can switch to `vgo`
and never muck with `Godeps.json` again.
2018-06-04 08:34:52 -07:00
Jacob Hoffman-Andrews b2f5cf39b9
Bring test/config up to date with test/config-next (#3743)
Notably, enable the precertificate flow, RPCHeadroom, and multi-IP hostnames.
Lots of other changes and feature flags too.
2018-06-01 12:00:52 -07:00
Daniel McCarney a9847f492e WFE2: Include invalid kid in error messages. (#3741)
This commit updates the `wfe2/verify.go` implementation of
`acctIDFromURL` to include the invalid `kid` value being rejected as
part of the rejection error message. This will hopefully help
users/client developers understand the problem faster. Unit tests are
updated accordingly.
2018-06-01 10:28:46 -07:00
Daniel McCarney 783784b680 SA: Enable OrderReadyStatus feature flag in config-next. (#3738)
We landed this feature flag disabled pending Certbot's acme library
supporting this status value. That work has landed and so we can enable
this feature in `config-next` ahead of a staging/prod rollout.
2018-05-29 10:32:58 -07:00
Jacob Hoffman-Andrews d42a0ab277
Godeps: Fix golang_protobuf_extensions comment. (#3737)
We're still on the same commit, which Godep previously commented as
"v1.0.0-2-gc12348c" (in other words, commit `c12348c`, which is slightly
ahead of the v1.0.0 tag). The upstream repo recently tagged a v1.0.1
release, at the same commit we were using. This caused Godep in our
tests to use a simplified comment referencing only the tag, which caused
a spurious diff and failed the test.

This commit updates the comment in Godeps.json.
2018-05-29 09:20:12 -07:00
Daniel c69314c45e Godeps: Fix golang_protobuf_extensions comment.
The "v1.0.0-2-gc12348c" tag referenced in the Godeps.json comment for
the "github.com/matttproud/golang_protobuf_extensions/pbutil" import
doesn't seem to exist in the upstream repo anymore.

The "v1.0.1" comment being flagged as a diff in Godeps restore during CI
_does_ exist and it points to the same commit
(c12348ce28de40eed0136aa2b644d0ee0650e56c) we are using.

This commit fixes the comment to match upstream & expected.

(ugh Godeps....)
2018-05-29 11:27:49 -04:00
Jacob Hoffman-Andrews b8e42cfbdf Update to latest boulder-tools. (#3734)
* Update to latest boulder-tools.

* Add Fprint* to errcheck ignore.
2018-05-29 08:58:44 -04:00
Kyle Spiers dd0e0249e5 core/util: ValidSerial should return false if the serial is not 32 or 36 (#3712)
The current check always fails because a length can't be simultaneously be both less than 32 and greater than 36.
2018-05-24 15:31:06 -04:00
Jacob Hoffman-Andrews b3f5c0f6e5
Speed up goodkey test. (#3733)
This is one of our slowest unittests, clocking in at 23 seconds in a recent run.
This was largely due to generating keys. Note that performance is significantly
worse under the race detector.
2018-05-23 16:11:46 -07:00
Joel Sing 2540d59296 Implement CAA validation-methods checking. (#3716)
When performing CAA checking respect the validation-methods parameter (if
present) and restrict the allowed authorization methods to those specified.
This allows a domain to restrict authorization methods that can be used with
Let's Encrypt.

This is largely based on PR #3003 (by @lukaslihotzki), which was landed and
then later reverted due to issue #3143. The bug the resulted in the previous
code being reverted has been addressed (likely inadvertently) by 76973d0f.

This implementation also includes integration tests for CAA validation-methods.

Fixes issue #3143.
2018-05-23 14:32:31 -07:00
Jacob Hoffman-Andrews 5ad14170fb Ignore canceled IsSafeDomain calls. (#3730)
Fixes #3681.
2018-05-23 12:50:30 -07:00
Jacob Hoffman-Andrews dbcb16543e Start using multiple-IP hostnames for load balancing (#3687)
We'd like to start using the DNS load balancer in the latest version of gRPC. That means putting all IPs for a service under a single hostname (or using a SRV record, but we're not taking that path). This change adds an sd-test-srv to act as our service discovery DNS service. It returns both Boulder IP addresses for any A lookup ending in ".boulder". This change also sets up the Docker DNS for our boulder container to defer to sd-test-srv when it doesn't know an answer.

sd-test-srv doesn't know how to resolve public Internet names like `github.com`. Resolving public names is required for the `godep-restore` test phase, so this change breaks out a copy of the boulder container that is used only for `godep-restore`.

This change implements a shim of a DNS resolver for gRPC, so that we can switch to DNS-based load balancing with the currently vendored gRPC, then when we upgrade to the latest gRPC we won't need a simultaneous config update.

Also, this change introduces a check at the end of the integration test that each backend received at least one RPC, ensuring that we are not sending all load to a single backend.
2018-05-23 09:47:14 -04:00
Jacob Hoffman-Andrews ef0324727d Remove exclude for Go 1.10.2 coverage build. (#3728) 2018-05-21 13:07:28 -04:00