Commit Graph

5133 Commits

Author SHA1 Message Date
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
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
Aaron Gable 8920b698ea
Report canceled remote validations as problems (#5011)
Previously, canceled remote validations were simply noted and then
dropped on the floor. This should be safe, as they're theoretically
only canceled when the parent span (i.e. the local PerformValidation
RPC) ends. But for the sake of defense-in-depth, it seems better to
correctly mark canceled remote validations as having Problems, so
that their results cannot be accidentally used anywhere.

This results in a test behavior change: if EnforceMultiVA is on, and
some RPCs are canceled, this now results in validation failure. This
should not have any production impact, because remote validations
should only be canceled when the parent RPC early-exits, but that only
happens when EnforceMultiVA is not enabled. These tests now test a
case where the other remote validations were canceled for some other
reason, which should result in validation failure.
2020-08-11 09:29:49 -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
Aaron Gable d873e01fa8
Update to go1.15rc2 for tests (#5013)
Go 1.15rc2 was released today. The diff from rc1 only includes one
change to the crypto/ package, but worth upgrading just to be ready
for the official 1.15 stable release.
2020-08-10 11:24:32 -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
Aaron Gable 634d57ce86
Use 2-space indents in all proto files (#5006)
Our proto files had a variety of indentation styles: 2 spaces,
4 spaces, 8 spaces, and tabs; sometimes mixed within the same
file. The proto3 style guide[1] says to use 2-space indents,
so this change standardizes on that.

[1] https://developers.google.com/protocol-buffers/docs/style
2020-08-05 10:38:19 -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
Roland Bracewell Shoemaker 75b034637b
Update travis go versions (remove 1.14.1, add 1.15rc1) (#5002)
Fixes #4919.
2020-08-04 12:13:09 -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
milgradesec 09c060f3de
Update prometheus/client libs (#4993)
This pull requests updates prometheus/client_golang and
prometheus/client_model dependencies. Also updates
golang/protobuf as indirect.
2020-07-29 12:38:06 -07:00
Aaron Gable 09917baf47
Add gosec linter to golangci-lint (#4990)
This enables the gosec linter. It also disables a number of
warnings which it emits on the current codebase. Some of these
(e.g. G104: Errors unhandled) we expect to leave disabled
permanently; others (e.g. G601: Implicit memory aliasing in for loop)
we expect to fix and then enable to prevent regressions.

Part of #4948
2020-07-28 16:42:17 -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
milgradesec 11d5ed4443
Update github.com/miekg/dns from v1.1.8 to v1.1.30 (#4984)
Includes 16 months of updates and security fixes.
2020-07-28 10:18:18 -07:00
Aaron Gable ffdae2d338
Return proto from ca.IssueCertificateFromPrecertificate (#4982)
This is the only method on the ca which uses a non-proto
type as its request or response value. Changing this to
use a proto removes the last logic from the wrappers,
allowing them to be removed in a future CL. It also makes
the interface more uniform and easier to reason about.

Issue: #4940
2020-07-23 18:39:10 -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
Aaron Gable 91ba1730dc
wfe: Return after sending errors (#4978)
Because these `wfe.sendError()` calls were not followed
by `return`s, the wfe was sending both them and the
next error encountered. In some cases, this could result
in the wrong HTTP response code being set, as that is
determined by the last error sent.
2020-07-23 12:11:59 -07:00
Jacob Hoffman-Andrews f9fd977bd6
Remove SerialExists. (#4976)
It no longer... exists.

Fixes #4943
2020-07-22 18:59:34 -07:00
Jacob Hoffman-Andrews 4ba537f293
Handle "too many objects" in pkcs11helper. (#4972)
Previously we were relying on a "more" boolean returned from
FindObjects. But according to
https://pkg.go.dev/github.com/miekg/pkcs11?tab=doc#Ctx.FindObjects,

> The returned boolean value is deprecated and should be ignored.

Instead, we ask for more objects than we need and error if we get more
than 1.

Add a test, and in the process split up the relevant test  into
multiple smaller test cases.
2020-07-22 18:57:28 -07:00
Aaron Gable 12d8674130
Move CA RPC non-nil checks out of wrappers (#4971)
Introduces a new generic helper utility to check that
fields of proto messages are non-nil and non-zero.

Uses this helper to simplify the ca RPC wrapper
methods, moving their completeness checks into
the underlying method handler. Also annotates the
completeness checks to justify which fields are or
are not being checked for future readers. Finally,
removes the similar non-nil checks from the client
wrappers, where they provide no marginal value.

Follow-up changes will do the same for other RPC
services, migrate said services to proto3, and change
the IssueCertificateForPrecertificate method to return
a corepb.Certificate instead of a core.Certificate, like
the other methods on the ca service.

Issues: #4955
2020-07-22 17:42:16 -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 ffe71f967e
Update publicsuffix-go (#4975)
This brings in 14 commits, adds approximately 45
new public suffixes, and removes about 15:
983d101bec...2c0d957a74
2020-07-22 10:15:34 -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
Jacob Hoffman-Andrews 7876120f9c
Increase granularity of new orders rate limit. (#4968)
Previously, this limit was bucketed by hour, but that created too much
sudden traffic at the beginning of each hour as accounts' rate limits
expired. Chunking by the minute should make it possible to smooth out
traffic more.
2020-07-20 14:58:34 -07:00
Jacob Hoffman-Andrews 0c543e7e2f
Move FasterNewOrdersRateLimit flag to config/ (#4969)
This flag is now live. Also move the migration from _db-next to _db.
2020-07-20 14:47:31 -07:00
Aaron Gable 8923fa29a7
Remove infinite memlock rlimit from docker config (#4967)
This was necessary to work around a poor interaction between
Go 1.4.x and unpatched linux kernels. Although we are still using
the same version of Go, and the Linux project only released the
fix in kernel 5.4.2 and later, Ubuntu has backported the fix into
Focal Fossa 20.04's 5.4.0 kernel. Therefore this workaround is
no longer needed.
https://github.com/golang/go/issues/37436#issuecomment-657436406

This also removes one need for elevated permissions, making it
easier to use docker rootless for development.
2020-07-20 14:12:45 -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
Aaron Gable 281575433b
Switch VA RPCs to proto3 (#4960)
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).

Fixes #4956
2020-07-16 09:16:23 -07:00
Aaron Gable 440c5f96d9
Remove unreferenced values from test configs (#4959) 2020-07-15 13:50:00 -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
Phil Porada 2afb087183
Add revocation reason metric to RA (#4957) 2020-07-15 13:30:15 -07:00
Roland Bracewell Shoemaker 7e342a545f
wfe/wfe2: only return 404 when certificate is actually not found (#4958)
Fixes #4950
2020-07-15 13:29:54 -07:00
Aaron Gable 696fc4e122
Enable testing on go1.14.5 (#4953)
New go version 1.14.5 was released today:
https://groups.google.com/g/golang-announce/c/XZNfaiwgt2w/m/E6gHDs32AQAJ
It includes a security fix for X.509 verification
(CVE-2020-14039, https://golang.org/issue/39360).
2020-07-14 11:28:39 -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
Aaron Gable dea2f6ef92
Refactor and cleanup python integration tests (#4945) 2020-07-13 14:31:15 -07:00
Jacob Hoffman-Andrews 50d404333e
akamai-purger: empty queue on shutdown (#4944) 2020-07-10 13:04:46 -07:00