Commit Graph

1122 Commits

Author SHA1 Message Date
Roland Bracewell Shoemaker 75dc93db01
Document EKU inclusion (#5055) 2020-08-27 13:40:16 -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
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
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
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
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
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
Aaron Gable e2c8f6743a
Introduce new core.AcmeChallenge type (#5012)
ACME Challenges are well-known strings ("http-01", "dns-01", and
"tlsalpn-01") identifying which kind of challenge should be used
to verify control of a domain. Because they are well-known and
only certain values are valid, it is better to represent them as
something more akin to an enum than as bare strings. This also
improves our ability to ensure that an AcmeChallenge is not
accidentally used as some other kind of string in a different
context. This change also brings them closer in line with the
existing core.AcmeResource and core.OCSPStatus string enums.

Fixes #5009
2020-08-11 15:02:16 -07:00
Jacob Hoffman-Andrews 6ee3e1748a
Allow generating a key in a non-empty slot. (#5014)
Partial revert of #4981 / 62eae60. Some HSMs have a small number
of slots and require storing multiple keys per slot (differentiated
by keyID, which we now look up based on the public key per #4992).
2020-08-11 12:49:24 -07:00
Jacob Hoffman-Andrews dcb42cbe66
Don't require OCSP URL for intermediates. (#5015)
Per ballot SC30, assuming the review period passes with no objections,
OCSP is no longer required on intermediates.
2020-08-11 09:16:20 -07:00
Jacob Hoffman-Andrews 5d7b589d1b
ceremony: look up keys by pubkey instead of key ID (#4992)
This moves x509Signer from cmd/ceremony into pkcs11helpers. It also
adds helper functions getPublicKeyID and getPrivateKey, copied and
adapted from pkcs11key. These act as counterparts to the existing
GetRSAPublicKey and GetECDSAPublicKey, which go from an object handle
to a Go public key object (and are used after key generation).

Fixes #4918
2020-08-10 10:14:23 -07:00
Aaron Gable 0f5d2064a8
Remove logic from VA PerformValidation wrapper (#5003)
Updates the type of the ValidationAuthority's PerformValidation
method to be identical to that of the corresponding auto-generated
grpc method, i.e. directly taking and returning proto message
types, rather than exploded arguments.

This allows all logic to be removed from the VA wrappers, which
will allow them to be fully removed after the migration to proto3.

Also updates all tests and VA clients to adopt the new interface.

Depends on #4983 (do not review first four commits)
Part of #4956
2020-08-06 10:45:35 -07:00
Roland Bracewell Shoemaker 7853b12cb3
Remove support for issuing certificates with no CN (#5008)
We'd like to issue certs with no CN eventually, but it's not
going to happen any time soon. In the mean time, the existing
code never gets exercised and is rather complex, so this
removes it.
2020-08-05 09:15:30 -07:00
Jacob Hoffman-Andrews ccec6cfa19
Move X509Signer from ceremony to pkcs11helpers. (#5004) 2020-07-31 13:24:37 -07:00
Aaron Gable 82e9e41597
Update CA RPC interface to proto3 (#4983) 2020-07-31 13:23:55 -07:00
Aaron Gable 46d7ed0a29
Anchor all referenced loop variables (#4991) 2020-07-29 12:57:30 -07:00
Jacob Hoffman-Andrews 0834ca4a19
pkcs11helper: add a Session abstraction (#4989) 2020-07-29 12:38:45 -07:00
Jacob Hoffman-Andrews 80d66f11b2
Simplify test for CRL signer. (#4987)
This mocks out the signer type rather than mocking out the pkcs11
object, making the test less dependent on the internals of our
pkcs11helpers package.

Part of refactorings related to #4918.
2020-07-28 13:28:03 -07:00
Jacob Hoffman-Andrews 62eae60711
Check for existing objects before generating a key. (#4981)
We only expect to want one key per slot/token.

Refactor key_test somewhat to split up cases, and add a new test case.
2020-07-23 16:55:43 -07:00
Jacob Hoffman-Andrews 379aaeee4e
ceremony: Remove duplicated print of certificate PEM (#4974)
The same PEM bytes are already printed a few lines above,
on line 377.
2020-07-22 17:36:38 -07:00
Aaron Gable 3a03e86e89
Standardize all proto import names (#4970)
We previously used mixed case names for proto imports
(e.g. both `caPB` and `rapb`), sometimes in the same file.
This change standardizes on the all-lowercase spelling,
which was predominant throughout the codebase.
2020-07-20 16:29:17 -07:00
Aaron Gable 6f0016262f
Simplify database interactions (#4949)
Simplify database interactions

This change is a result of an audit of all places where
Go code directly constructs SQL queries and executes them
against a dbMap, with the goal of eliminating all instances
of constructing a well-known object type (such as a
core.CertificateStatus) from explicitly-listed database columns.
Instead, we should be relying on helper functions defined in the
sa itself to determine which columns are relevant for the
construction of any given object.

This audit did not find many places where this was occurring. It
did reveal a few simplifications, which are contained in this
change:
1) Greater use of existing SelectFoo methods provided by models.go
2) Streamlining of various SelectSingularFoo methods to always
   select by serial string, rather than user-provided WHERE clause
3) One spot (in ocsp-responder) where using a well-known type seemed
   better than using a more minimal custom type

Addresses #4899
2020-07-20 11:12:52 -07:00
Aaron Gable 7e626b63a6
Temporarily revert CA and VA proto3 migrations (#4962) 2020-07-16 14:29:42 -07:00
Aaron Gable 340d42760d
Break ceremony dependency on core (#4954) 2020-07-16 12:11:02 -07:00
Jacob Hoffman-Andrews 6fdc039c72
ceremony: Factor out openSigner (#4952)
We had some duplicated code related to opening the PKCS#11 session and
generating a signer, so I pulled it out into a separate function. This
function also takes an issuer so it can verify that the public key
matches what's expected.
2020-07-15 13:47:57 -07:00
Aaron Gable 24e782e8b4
Update CA RPC interface to proto3 (#4951)
This updates the ca.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).

It also updates a few instances where tests were being
conducted to see if various object fields were nil to instead
check for those fields' new zero-value.

Fixes #4940
2020-07-13 18:02:18 -07:00
Jacob Hoffman-Andrews 50d404333e
akamai-purger: empty queue on shutdown (#4944) 2020-07-10 13:04:46 -07:00
Jacob Hoffman-Andrews 8e64072d3b
Factor out common PKCS11 config types. (#4947)
Our PKCS11 config sections fall into two categories:
 - Those used for generating keys, where the HSM is both an input and an
   output, storing the resulting key in a specified slot.
 - Those used for signing certs, where the HSM is an input.

This creates dedicated config structs for these two, reducing
duplication in defining overall config structs. This also makes
defining test cases involving these config structs much more concise.

Fixes #4915
2020-07-10 11:31:37 -07:00
Jacob Hoffman-Andrews 3b5915a6f2
Reduce chance of log-validator having runaway output. (#4926) 2020-07-10 11:16:18 -07:00
orangepizza dee757c057
Remove multiva exception list code (#4933)
Fixes #4931
2020-07-08 10:57:17 -07:00
Roland Bracewell Shoemaker e940b6386f
ocsp: switch from cfssl/log to internal log (#4941)
Fixes #4898.
2020-07-08 09:32:23 -07:00
Roland Bracewell Shoemaker f8f4194c2a
cmd/ceremony: add CRL generation (#4892)
Also vendors the Go 1.15 CRL support for now, once we switch to 1.15
we can delete it.

Fixes #3714
2020-07-07 14:17:41 -07:00
Jacob Hoffman-Andrews cb06fe8e13
log: Remove trailing newlines and escape internal newlines. (#4925)
Fixes #4914.
2020-07-06 14:17:23 -07:00
Jacob Hoffman-Andrews df58af1406
Remove SA connection from ocsp-updater. (#4936)
The ocsp-updater no longer makes RPCs to the SA, but accesses the DB
directly (sometimes with help from SA functions to keep the DB
consistent).

This removes the SA connection config from config-next/. We'll remove
from config/ once the corresponding config has been removed from prod.
2020-07-06 14:14:02 -07:00
Aaron Gable f3db6d75ad
Remove key-hash-backfill cmd (#4928)
The key-hash-backfill cmd was used to fill the keyHashToSerial table
when it was first created. Now that the table is up and running, the
backfill utility can be removed.

Fixes #4895
2020-07-02 16:07:28 -07:00
Jacob Hoffman-Andrews be2b19efee
Improve bad-key-revoker log output. (#4924)
Previously this was logging a map of emails to unrevokedCertificates.
Since unrevokedCertificates includes DER, which is a []byte, this was
getting printed as a series of decimal numbers, one for each byte.

This adds a Stringer implementation for unrevokedCertificates that
omits the DER.

Fixes #4921.
2020-07-02 10:09:26 -07:00
Roland Bracewell Shoemaker 1864325d87
cmd/ceremony: add delegated crl signer generation (#4913) 2020-07-02 08:44:45 -07:00
Jacob Hoffman-Andrews 56d581613c
Update test/config. (#4923)
This copies over a number of features flags and other settings from
test/config-next that have been applied in prod.

Also, remove the config-next gate on various tests.
2020-07-01 17:59:14 -07:00
Jacob Hoffman-Andrews fe79f727a9
Restore SelectCertificateStatuses to SA. (#4902)
And use it in ocsp-updater. This was cleaned up in #4546 because it was
unused, but it should have been in use in ocsp-updater now that we can
make a straightforward query here instead of a JOIN.

This makes the SA the single source of truth for what columns are in the
certificateStatus table.
2020-07-01 12:20:29 -07:00
Aaron Gable d16d3fd067
Remove OCSPStaleMaxAge config value and handling (#4911)
The OCSPStaleMaxAge config value was added in #2419 as part of an
effort to ensure that ocsp-updater's queries of the certificateStatus
table were efficient. It was never intended as a long-term fix:
in #2431 and #2432 the query was updated to index on the much more
efficient isExpired and notAfter columns if a feature flag was set,
and in #2561 that code path was made the default and the flag removed.

However, the `WHERE ocspLastUpdate > ocspStaleMaxAge` clause has
remained in the query. This is redundant, as the ocspStaleMaxAge has
always been set to 5040 hours, or 210 days, significantly longer than
the 90-day expiration of Let's Encrypt certs.

This change removes that clause from the query, and removes the config
scaffolding around it. In addition, it updates the tests to remove
workarounds necessitated by this column, and simplifies and documents
them for future readers.

Fixes #4884
2020-06-29 12:42:51 -07:00
Jacob Hoffman-Andrews 36c8fed4d9
Fix up NoRows handling in bad-key-revoker. (#4874)
Join on the precertificates table to handle the case when a
precertificate was issued but no certificate.

Treat NoRows as a regular error.

Use named constants to specify revoked/expired arguments
to insertCert helper.

Remove the config gate on the bad-key-revoker unittest.
2020-06-23 11:31:21 -07:00
Jacob Hoffman-Andrews 7bddafd45e
Add MaxBytesReader for ocsp-responder. (#4869)
Also, return status code 500 when the OCSP response from
the DB is unparseable.
2020-06-23 11:30:59 -07:00
Roland Bracewell Shoemaker c4813cc340
cmd/ceremony: merge single-ocsp tool into ceremony (#4878)
Fixes #4658.
2020-06-23 11:30:31 -07:00
Aaron Gable 91d4e235ad
Deprecate the BlockedKeyTable feature flag (#4881)
This commit consists of three classes of changes:
1) Changing various command main.go files to always behave as they
   would have when features.BlockedKeyTable was true. Also changing
   one test in the same manner.
2) Removing the BlockedKeyTable flag from configuration in config-next,
   because the flag is already live.
3) Moving the BlockedKeyTable flag to the "deprecated" section of
   features.go, and regenerating featureflag_strings.go.

A future change will remove the BlockedKeyTable flag (and other
similarly deprecated flags) from features.go entirely.

Fixes #4873
2020-06-22 16:35:37 -07:00
Jacob Hoffman-Andrews 7b93e00021
Fix pass-through of revoke reason in ocsp-updater. (#4880)
This ensures that updates to OCSP responses keep the same reason code
as when they were revoked.
2020-06-18 17:37:32 -07:00
Jacob Hoffman-Andrews d1fa9f9db8
Add more logging to bad-key-revoker. (#4871) 2020-06-15 16:24:44 -07:00
Roland Bracewell Shoemaker 356510aa54
cmd/bad-key-revoker: don't skip certificates where the account has no contacts (#4872) 2020-06-15 10:33:28 -07:00
Jacob Hoffman-Andrews 20031f9796
Update ceremony documentation. (#4867)
Replace issuer-path with issuer-certificate-path, and fix a typo.
2020-06-15 09:14:15 -07:00