Commit Graph

5275 Commits

Author SHA1 Message Date
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
Aaron Gable 132f303a80
Disable new signer in config-next (#5036)
This appears to be causing timeouts when communicating with the ca
in the integration tests. Disabling the config so that we can
ensure everything is working for this week's release.

This is a partial (config-only) revert of #5007
2020-08-18 13:55:12 -07:00
Roland Bracewell Shoemaker 85851a6f2e
ca: implement our own certificate issuance lib (#5007)
Adds a replacement issuance library that replaces CFSSL. Usage of the
new library is gated by a feature, meaning until we fully deploy the
new signer we need to support both the new one and CFSSL, which makes
a few things a bit complicated.

One Big follow-up change is that once CFSSL is completely gone we'll
be able to stop using CSRs as the internal representation of issuance
requests (i.e. instead of passing a CSR all the way through from the
WFE -> CA and then converting it to the new signer.IssuanceRequest,
we can just construct a signer.IssuanceRequest at the WFE (or RA) and
pass that through the backend instead, making things a lot less opaque).

Fixes #4906.
2020-08-17 15:53:28 -07:00
Aaron Gable 8556d8a801
Update VA RPCs to proto3 (#5005)
This updates va.proto to use proto3 syntax, and updates
all clients of the autogenerated code to use the new types.
In particular, it removes indirection from built-in types
(proto3 uses ints, rather than pointers to ints, for example).

Depends on #5003
Fixes #4956
2020-08-17 15:20:51 -07:00
Aaron Gable 7e57a788d5
Create workflow to comment on PRs against master (#5025) 2020-08-17 12:37:18 -07:00
Aaron Gable 316ffd6241
Update to stable go1.15 (#5021)
This updates our test infrastructure from using go1.15rc2 to the
newly-released go1.15 stable version.
2020-08-17 12:32:20 -07:00
Aaron Gable 32d56ae1e6
Make ra.PerformValidation resilient to va failure (#5028)
ra.PerformValidation's goroutine surfaces errors not by returning them,
but by accumulating them into the `prob`variable and saving them to
the database. This makes it possible for processing to continue even
in error cases when it should (mostly) halt. This change fixes a bug
where we would try to access a member of the result returned from
va.PerformValidation, even if that function call had returned an error.
2020-08-17 12:29:33 -07:00
Jacob Hoffman-Andrews 71478020c4
Don't overwrite files during ceremonies. (#5026)
At validation time, verify that output paths don't already exist.
When writing files, use O_CREAT and O_EXCL to prevent overwriting.
2020-08-17 11:41:10 -07:00
milgradesec 20b08365be
Update github.com/letsencrypt/challtestsrv to v1.2.0 (#5000)
This pull request updates github.com/letsencrypt/challtestsrv dependency
2020-08-13 10:32:47 -07:00
David Lakatos a2f29d2c64
Removes GRANT to removed sctReceipts table (#5020)
This table was dropped from both config and config-next
in #4793. Fixes #5019.
2020-08-12 11:47:45 -07:00
Jacob Hoffman-Andrews f794cbb74a
Capitalize X509 in CRL PEM output. (#5016)
`openssl crl` rejects "x509" but accepts "X509", at least as of version
1.1.1f.
2020-08-11 16:00:34 -07:00