Commit Graph

5285 Commits

Author SHA1 Message Date
Jonathan Vanasco 8e8f8bdf6a
Add documentation for RFC-conformant design implementation decisions. (#5105)
@jsha suggested I re-implement a PR against Pebble regarding Authorization
reuse into Boulder (see https://github.com/letsencrypt/pebble/pull/325).

This is an initial attempt. I opted to handle this by creating a new file for
"Implementation Details" that are RFC conformant and are known to have
confused client developers.
2020-10-05 18:03:57 -07:00
Aaron Gable c1c307a713
Fix parity of RevokeCertificate error message (#5106) 2020-10-05 17:16:55 -07:00
Jacob Hoffman-Andrews ec7b5f2b80
Fix ocsp/helper. (#5104)
In #5103 I tweaked the help to allow customizing where the output goes,
but I didn't ensure that the output field was always set. Also, I forgot
to expand the `...v` parameter when passing it to Fprintf.
2020-09-28 08:39:06 -07:00
Jacob Hoffman-Andrews d90a2817c4
ocsp_helper: allow suppressing output. (#5103)
This adds a configurable output parameter for ocsp_helper, which
defaults to stdout. This allows suppressing the stdout output when using
ocsp_helper in integration tests. That output was making it hard to
see details about failing tests.
2020-09-25 14:03:50 -07:00
Aaron Gable d3f2efcb7f
ocsp-updater: use certDER codepath when IssuerID is 0 (#5100)
The IssuerID shouldn't ever be 0 (it should always be NULL/nil or
an actual value), but we recently had an incident in which it was
being set to 0 instead of NULL. This ensures that functionality
will continue as intended even in the face of that circumstance.

Fixes #5098
2020-09-24 13:28:41 -07:00
Aaron Gable 17e9e7fbb7
SA: Ensure that IssuerID is set when adding precertificates (#5099)
This change adds `req.IssuerID` to the set of fields that the SA's
`AddPrecertificate` method requires be non-zero.

As a result, this also updates many tests, both unit and integration,
to ensure that they supply a value (usually just 1) for that field. The
most complex part of the test changes is a slight refactoring to the
orphan-finder code, which makes it easier to reason about the
separation between log line parsing and building and sending the
request.

Based on #5096
Fixes #5097
2020-09-23 16:45:19 -07:00
Aaron Gable cbef9ac43b
Update acme divergences documentation (#5101)
This change reorganizes the document to have all changes
noted under their respective section headings, updates estimated
resolution dates on long-standing divergences, and updates all URLs
to reference the final RFC 8555 instead of various drafts.

In addition, it adds a note that we do not accept the (optional)
`notBefore` and `notAfter` fields of a `newOrder` request.
2020-09-23 13:37:57 -07:00
Aaron Gable 96f9bfaab8
Fix IsAnyNilOrZero to correctly handle all numeric types (#5096)
The previous implementation of `IsAnyNilOrZero` did not in fact work,
and its tests did not catch this fact. Within the numeric clause, the
compiler would only instantiate the comparison literal 0 to be one
of the eight possible types. Comparisons against any of the other
seven types would always be false, no matter what value that type
held.

The tests did not catch this because they only tested two literal
values: `0` and `-12.345`, both of which can be `float64`s.

This change updates the utility function to use the `reflect` package,
to ensure that it works correctly. It also updates the test to test
multiple different kinds of numeric values, and removes the code
for handling pointer-to- types, as all of our proto2 code has been
removed.

Finally, it updates the SA wrapper's `RevokeCertificate` method to
correctly not require that `req.Reason` be non-zero: this field can
and often is zero, as that value represents `Unspecified`.

Using the reflect package is a conscious tradeoff. It will be slower
than manually writing out every single case, but it will also be less
prone to error.

Part of #5097
2020-09-23 09:01:20 -07:00
Aaron Gable 7672d9bc99
CA: Verify digitalSignature and certSign key usages (#5091)
When the CA loads new issuers (both their certificates and their
private keys), it performs a variety of sanity checks, such as
ensuring that the profile's signature algorithm matches the key
type.

With this change, we also check that the issuer's certificate has
the appropriate key usage bits set:
`certSign`, if it is going to be issuing end-entity certs; and
`digitalSignature`, because it will be signing OCSP responses for
previously-issued certificates.

Fixes #5068
2020-09-18 16:10:12 -07:00
Jacob Hoffman-Andrews 3bf6aa4aac
notify-mailer: improve log output (#5094)
One of the log lines describes the most frequent address corresponding
to a number of accounts, but it actually corresponds to a number of
lines in the input CSV.

Also, now that we escape newlines in log output, the dryRunMailer's
output looks messed up. Split the message body into lines and emit one
log message per line.
2020-09-17 09:56:24 -07:00
Jacob Hoffman-Andrews ef955a561a
wfe: reject empty identifiers in new-authz and new-order (#5089)
Currently these are rejected at the RA. It's nicer to reject them one step earlier.

Fixes #5081
2020-09-15 09:42:33 -07:00
Jacob Hoffman-Andrews 6f14be824d
ca: return better error on bad cert parse. (#5090)
Fixes #5078
2020-09-15 08:51:43 -07:00
Jacob Hoffman-Andrews 800d54d563
ceremony: Clarify key labels. (#5077)
Generated keys have the same label on both the private and public key
objects. When looking up keys for signing, the label is used to find the
public key.
2020-09-14 18:55:17 -07:00
Aaron Gable 2d10cce1a3
Refactor CA configs for more modularity (#5087)
The CA is the only service which still defines its json config format
in the package itself, rather than in its corresponding boulder-ca cmd
package. This has allowed the CA's constructor interface to hide
arbitrary complexity inside its first argument, the whole config blob.

This change moves the CA's config to boulder-ca/main.go, to match
the other Boulder components. In the process, it makes a host of
other improvements:

It refactors the issuance package to have a cleaner configuration
interface. It also separates the config into a high-level profile (which
applies equally to all issuers), and issuer-level profiles (which apply
only to a single issuer). This does involve some code duplication,
but that will be removed when CFSSL goes away.

It adds helper functions to the issuance package to make it easier
to construct a new issuer, and takes advantage of these in the
boulder-ca package. As a result, the CA now receives fully-formed
Issuers at construction time, rather than constructing them from
nearly-complete configs during its own initialization.

It adds a Linter struct to the lint package, so that an issuer can
simply carry around a Linter, rather than a separate lint signing
key and registry of lints to run.

It makes CFSSL-specific code more clearly marked as such,
making future removal easier and cleaner.

Fixes #5070
Fixes #5076
2020-09-14 18:38:12 -07:00
Phil Porada f0b54a8968
Upgrade mariadb from 10.3 to 10.5 (#5088) 2020-09-14 11:27:15 -07:00
Aaron Gable d8a786ea08
Unify usage of 'issuer' and 'signer' as nouns (#5085)
We define a "signer" to be a private key, or something that satisfies the
crypto.Signer interface. We define an "issuer" to be an object which has
both a signer (so it can sign things) and a certificate (so that the things
it signs can have appropriate issuer fields set).

As a result, this change:
- moves the new "signer" library to be called "issuance" instead
- renames several "signers" to instead be "issuers", as defined above
- renames several "issuers" to instead be "certs", to reduce confusion more

There are some further cleanups which could be made, but most of them
will be made irrelevant by the removal of the CFSSL code, so I'm leaving
them be for now.
2020-09-10 17:18:42 -07:00
Aaron Gable ad2ec784d1
CA: Small cleanups to issuer loading
This just changes the `loadCFSSLIssuers` signature to more closely match
the `loadBoulderIssuers` signature (it didn't need access to the whole config
object), and standardize our json on lowercase string keys.
2020-09-10 14:23:33 -07:00
Aaron Gable 86c49278ac
CA: Set IssuerID when integrating orphaned certs (#5083)
There are two code paths which end up calling the SA's AddPrecertificate
RPC: one "normal" path from inside the CA's IssuePrecertificate
method, and one "exceptional" path from inside the orphan-integration
path which only gets executed if the initial attempt to store the cert
failed for some reason.

The first of these paths always sets the IssuerID in the RPC's
AddCertificateRequest. The latter of these paths never does.
Historically, this has been fine, as the SA has stored NULL in the
certificateStatus table when given a nil IssuerID, which matches the
behavior prior to the StoreIssuerInfo flag (when the IssuerID was
always nil, and cert status was tracked by full cert DER instead).

However, with the switch to proto3, the SA now interprets a nil
IssuerID as a 0, and stores that value in the table instead. The
ocsp-updater code which consumes rows of the certificateStatus table
is not able to properly handle IssuerIDs of 0, leading to fun times.

This change ensures that the orphan handling code also sets the
IssuerID when asking the SA to create a new certificateStatus row,
so we should stop producing new rows with a 0 IssuerID.
2020-09-09 09:51:31 -07:00
Jacob Hoffman-Andrews 74c3139680
Remove ecVerify and rsaVerify. (#5071)
These functions sign a random nonce with a newly-created issuance key,
in order to verify that the key was correctly generated and its public
component was correctly extracted. In general we can trust that keys are
correctly created by the HSM, and unit and integration tests can check
that we are correctly extracting public keys.

Removing these avoids the possibility of signing something that could be
construed as a "certificate, but malformed."
2020-09-02 11:08:55 -07:00
Jacob Hoffman-Andrews 70ebbc4107
integration: use 2048-bit intermediate. (#5073)
Since we generate an intermediate on each integration test run, this
speeds things up by a few seconds. It also makes generation of our
linting keys on CA startup faster.
2020-09-02 09:44:27 -07:00
Jacob Hoffman-Andrews b5539a51df
ceremony: collapse two cases in a switch. (#5075)
Follow up on review feedback from
3e77783723 (diff-ffc9ac475f36a165b548f96a56bec83c).
2020-09-02 09:05:39 -07:00
Roland Bracewell Shoemaker 1c389fc5e7
cmd/ceremony: add cross-csr ceremony type (#5072)
Fixes #5035.
2020-09-01 17:46:35 -07:00
Jacob Hoffman-Andrews 5a3daf448c
cmd: use Fprintln instead of Fprint for Fail. (#5069) 2020-09-01 17:42:11 -07:00
Jacob Hoffman-Andrews 64127916b6
Check for CKA_LABEL in NewSigner. (#5067)
In #4992, we refactored NewSigner to look keys up by public key and by
label. However, we didn't correctly incorporate the label check into
the new code. This fixes that and adds a test.
2020-08-31 18:17:35 -07:00
Jacob Hoffman-Andrews bf7c80792d
core: move to proto3 (#5063)
Builds on #5062
Part of #5050
2020-08-31 17:58:32 -07:00
Aaron Gable 00133dc6c3
CA: Choose issuer cert based on CSR's PublicKeyAlgorithm (#5042)
The ca's configuration already has support for containing multiple
issuers. However, when it comes time to actually sign a (pre)cert,
it always uses the defaultIssuer.

This change has the ca instead choose which issuer to use based
on the PublicKeyAlgorithm requested in the CSR (or, for final cert
issuances, based on the PublicKeyAlgorithm in the precert).

This will allow us to use our RSA issuers to sign certificates for
users who aren't ready to switch to ECDSA, while immediately switching
to our new ECDSA chain for subscribers who want to use it.

Fixed #5027
2020-08-31 16:13:31 -07:00
Jacob Hoffman-Andrews 050a60f810
sa: Update newOrders limit outside of transaction (#5066)
It's not vital that this row be strongly consistent with the other
updates. And updating it inside the transaction means we hold a lock on
this row while doing a bunch of other expensive inserts, which is likely
creating lock contention.
2020-08-31 15:48:12 -07:00
Aaron Gable d8e0d01935
Add pre-issuance linting to ceremony tooling (#5056)
When issuing a new root or intermediate cert, we should take every
precaution possible to ensure that these certs are well-formed.

This change introduces a new step prior to issuing and writing a new CA
cert. We generate a new disposable private key based on the type of the
key being used in the real ceremony, then use this key to sign a fake
certificate for the sole purpose of linting. We then pass this through
the full suite of zlint's checks before proceeding with the actual
issuance.

Since this code path is largely similar to the pre-issuance linting done
by the new boulder signer tool, this change also factors it out into a
small, single-purpose `lint` package.

Fixes #5051
2020-08-31 12:47:40 -07:00
Jacob Hoffman-Andrews ea274ff462
Log when incorporating an orphaned certificate. (#5057)
This gives a little clearer lifecycle of the certificate's processing,
and makes it clear when it should be available in the DB.
2020-08-31 11:53:42 -07:00
Aaron Gable 91898e51a0
Update zlint to include changes from SC31 (#5064)
This brings in the following changes to zlint:
https://github.com/zmap/zlint/compare/v2.1.0...9ab0643

Importantly, this prevents the cert lifetime lint from triggering on
CA certs, and removes the OCSP url requirement lint entirely.
2020-08-31 11:53:23 -07:00
Jacob Hoffman-Andrews 0d8404bb22
core: Remove nil checks for core proto types. (#5062)
In preparation for moving to proto3 for the core/proto types
(Registration, Order, Authorization, Challenge, etc), this removes
checks that will fail when a proto2 client or server receives a message
from a proto3 client or server. Since proto3 encodes fields that have
their zero value as being absent (i.e. nil, in Go), we treat nil the
same as having a zero value.

In the process this change introduces additional checks, verifying
certain fields which should never have a zero value.

This involves factoring out registrationValid into registrationValid and
newRegistrationValid, since new registration requests lack some fields that
already-created registrations should always have.

Similarly, UpdateRegistration is changed to not verify that
`request.Update` is valid, since an update to registration object is not
a complete registration object - it may only update one field.
2020-08-31 11:47:12 -07:00
Jacob Hoffman-Andrews 5e22c3fee0
Failed status get should return internal error. (#5060)
Previously this was a NotFound error, but since we now update the
certificateStatus table synchronously on issuance and revocation, we
expect to always get a successful response; if we get an error, that's
a ServerInternal error.
2020-08-28 13:06:09 -07:00
Jacob Hoffman-Andrews 2a28efd8c9
Remove "useV2authorizations" boolean flags. (#5058)
These were used during the transition to authzv2. The SA side of these
RPCs already ignores these booleans. This is just cleaning up the
protobufs and call sites.
2020-08-28 11:54:04 -07:00
Jacob Hoffman-Andrews 3c8b566a91
Remove references to authzv2 from WFE. (#5059)
We've now made the migration; no need to keep these vestiges around.
2020-08-28 11:43:36 -07:00
Roland Bracewell Shoemaker 1bf3d5d660
cmd/caa-log-checker: non-zero exit when errors are found (#5041)
Fixes #5033
2020-08-27 13:57:37 -07:00
Roland Bracewell Shoemaker 75dc93db01
Document EKU inclusion (#5055) 2020-08-27 13:40:16 -07:00
Jacob Hoffman-Andrews 1d31d60450
test: improve quality of some mocks (#5054)
As part of #5050, I'm updating some of the code in grpc/pb-marshaling.go
to move from nil checks to zero checks. In the process I'm introducing some
new zero checks, on things like challenge type, status, and token. This is
shaking out some places where our mocks have taken shortcuts by not
creating a "full" object including all fields that are normally present.

This PR updates our mocks and tests to provide more realistic objects in
all the places that broke when introducing those zero checks.
2020-08-27 09:42:22 -07:00
Roland Bracewell Shoemaker 3e0e2a3121
cmd/ceremony: validate crl output (#5047)
Uses a mix of the crypto/x509 CRL parsing and custom parsing to check
that the output of generateCRL is valid.

Fixes #4988.
2020-08-25 16:57:35 -07:00
Jacob Hoffman-Andrews 8dd386b6bc
SA: Update RPC interface to proto3 (#5043)
One slightly surprising / interesting thing: Since core types like
Order and Registration are still proto2 and have pointer fields,
there are actually some places in this PR where I had to add
a `*` rather than delete an `&`, because I was taking a pointer
field from one of those core types and passing it as a field in
an SA RPC request.

Fixes #5037.
2020-08-25 10:28:41 -07:00
Tim Geoghegan 8685e7aec2
cmd/caa-log-checker: -earliest and -latest (#5045)
Since we now sync caaChecks logs daily instead of continuously,
caa-log-checker can no longer assume that the validation logs it is
checking cover the exact same span of time as the issuance logs. This
commit adds -earliest and -latest parameters so that the script
that drives this tool can restrict verification to a timespan where we
know the data is valid.

Also adds a -debug flag to caa-log-checker to enable debug logs. At the
moment this makes the tool write to stderr how many issuance messages
were evaluated and how many were skipped due to -earliest and
-latest parameters.
2020-08-25 09:54:20 -07:00
Jacob Hoffman-Andrews 30ebb2427c
akamai-purger: move to proto3 (#5048) 2020-08-24 16:06:16 -07:00
Jacob Hoffman-Andrews 3c0e414a74
Update interceptors_test to proto3. (#5046) 2020-08-24 16:05:57 -07:00
Dennis Benzinger | SAP Hybris a92d54ae6d
Fix link to `acme-divergences-v1.md` (#5049) 2020-08-24 14:54:26 -07:00
Aaron Gable d1d9269530
Switch to testing only on go1.15 (#5022)
Now that our prod deployment has updated to using go1.15,
it is no longer be necessary to duplicate our tests across two
different go versions.
2020-08-24 13:47:50 -07:00
Aaron Gable 4d72f1f60e
RA: Update RPC interface to proto3 (#5039)
Updates the Registration Authority to use proto3 for its
RPC methods. This turns out to be a fairly minimal change,
as many of the RA's request and response messages are
defined in core.proto, and are therefore still proto2.

Fixes #4955
2020-08-24 13:00:41 -07:00
Aaron Gable 599a934b87
CA: increment signatureCount with both signers (#5040)
Signatures conducted with the new signer (still behind the
NonCFSSLSigner feature flag) wouldn't increment this counter.
2020-08-20 12:28:54 -07:00
Jacob Hoffman-Andrews 56b98bd665
ceremony: add cross-certificate ceremony type. (#5031)
This is like an intermediate ceremony, but the EKU and path length
constraints are omitted.

Fixes #5029
2020-08-19 17:32:24 -07:00
Aaron Gable 84799dbdf1
RA: Remove nil checks for zero-able fields (#5038)
Any field which can be zero must be allowed to be nil,
so that a proto2 server receiving requests from a proto3
client is willing to process messages with zero-value fields
encoded as missing.

Part of #4955
2020-08-18 16:54:26 -07:00
Jacob Hoffman-Andrews baf2a5be6e
sa: remove nil checks for zero-able fields. (#5034)
As part of the migration to proto3, any fields in requests that may be
zero should also be allowed to be nil. That's because proto3 will
represent those fields as absent when they have their zero value.

This is based on a manual review of the wrappers for the SA, plus
a pair of integration test runs. For the integration test runs I took these
steps:

1. Copy sa/proto to sa/proto2
2. Change sa/proto to use proto3 and regenerate.
3. In sa/*.go and cmd/boulder-sa/main.go, update the imports to use the
    proto2 version.
4. Split grpc/sa-wrappers.go into sa-server-wrappers.go and sa-wrappers.go
    (containing the client code)
5. In sa-server-wrappers.go, change the import to use sa/proto2.
6. In sa-server-wrappers.go, make a local copy of the core.StorageAuthority
    interface that uses the sa/proto2 types. This was necessary as
    a temporary kludge because of how the server wrapper internally
    uses the core.StorageAuthority interface.
7. Fix all the pointer-vs-value build errors in every other package.
8. Run integration tests.

I also performed those steps with proto2 and proto3 swapped, to confirm the
behavior when a proto2 client talks to a proto3 SA.
2020-08-18 16:20:07 -07:00
Jacob Hoffman-Andrews d9e5e68aae
test: set golangci-lint timeout to 9m. (#5032)
This is an increase from the default of 1m.
2020-08-18 14:09:38 -07:00