Commit Graph

6530 Commits

Author SHA1 Message Date
Phil Porada fc7c522c28
RA: Audit log and track cert profile names and hashes (#7433)
* Adds `CertProfileName` to the CAs `capb.IssuePrecertificateResponse`
so the RA can receive the CAs configured default profile name for audit
logging/metrics. This is useful for when the RA sends an empty string as
the profile name to the CA, but we want to know exactly what the profile
name chosen by the CA was, rather than just relying on comparing hashes
between CA and RA audit logs.
* Adds the profile name and hash to RA audit logs emitted after a
successful issuance.
* Adds new labels to the existing `new_certificates` metric exported by
the RA.
```
# HELP new_certificates A counter of new certificates including the certificate profile name and hexadecimal certificate profile hash
# TYPE new_certificates counter
new_certificates{profileHash="de4c8c8866ed46b1d4af0d79e6b7ecf2d1ea625e26adcbbd3979ececd8fbd05a",profileName="defaultBoulderCertificateProfile"} 2
```

Fixes https://github.com/letsencrypt/boulder/issues/7421
2024-04-23 12:05:25 -04:00
forcedebug b33d28c8bd
Remove repeated words in comments (#7445)
Signed-off-by: forcedebug <forcedebug@outlook.com>
2024-04-23 10:30:33 -04:00
Aaron Gable b3bb595075
Remove caa-log-checker (#7442)
We first introduced caa-log-checker as a remediation item in the wake of
https://bugzilla.mozilla.org/show_bug.cgi?id=1619047. Since that time,
we have upgraded to go1.22, which completely remoes the class of bug
which led to that incident (https://tip.golang.org/doc/go1.22#language).
Throughout its life, caa-log-checker was an operational burden, and was
at best a post-hoc check to detect issues after they had already
occurred. Therefore, we no longer run it in our production environment,
and it can be removed from the Boulder source.
2024-04-22 10:35:18 -07:00
Aaron Gable e05d47a10a
Replace explicit int loops with range-over-int (#7434)
This adopts modern Go syntax to reduce the chance of off-by-one errors
and remove unnecessary loop variable declarations.

Fixes https://github.com/letsencrypt/boulder/issues/7227
2024-04-22 10:34:51 -07:00
Jacob Hoffman-Andrews 89b07f4543
sa: get order names from authorizations (#7435)
This removes the only place we query the requestedNames table, which
allows us to get rid of it in a subsequent PR (once this one is merged
and deployed).

Part of https://github.com/letsencrypt/boulder/issues/7432
2024-04-18 14:00:53 -07:00
Aaron Gable 94d14689bf
Implement unpredictable issuance from similar intermediates (#7418)
Replace the CA's "useForRSA" and "useForECDSA" config keys with a single
"active" boolean. When the CA starts up, all active RSA issuers will be
used to issue precerts with RSA pubkeys, and all ECDSA issuers will be
used to issue precerts with ECDSA pubkeys (if the ECDSAForAll flag is
true; otherwise just those that are on the allow-list). All "inactive"
issuers can still issue OCSP responses, CRLs, and (notably) final
certificates.

Instead of using the "useForRSA" and "useForECDSA" flags, plus implicit
config ordering, to determine which issuer to use to handle a given
issuance, simply use the issuer's public key algorithm to determine
which issuances it should be handling. All implicit ordering
considerations are removed, because the "active" certificates now just
form a pool that is sampled from randomly.

To facilitate this, update some unit and integration tests to be more
flexible and try multiple potential issuing intermediates, particularly
when constructing OCSP requests.

For this change to be safe to deploy with no user-visible behavior
changes, the CA configs must contain:
- Exactly one RSA-keyed intermediate with "useForRSALeaves" set to true;
and
- Exactly one ECDSA-keyed intermediate with "useForECDSALeaves" set to
true.

If the configs contain more than one intermediate meeting one of the
bullets above, then randomized issuance will begin immediately.

Fixes https://github.com/letsencrypt/boulder/issues/7291
Fixes https://github.com/letsencrypt/boulder/issues/7290
2024-04-18 10:00:38 -07:00
Aaron Gable 13172ac3f1
Fix cert-checker in config-next integration tests (#7440)
Cert checker has been failing in config-next because the
"CertCheckerRequiresCorrespondence" flag is enabled, but no permissions
were granted on the precertificates table. While this did cause it to
log profusively, this did not cause the tests to fail because
integration-test.py simply executes cert-checker without caring about
its exit code.
2024-04-18 09:40:41 -07:00
Aaron Gable 5c97f994bb
SA: Remove unused PreviousCertificateExists method (#7439)
This method has had no callers since the removal of ACMEv1.
2024-04-18 12:29:35 -04:00
Phil Porada c0ecabd244
CA: Run all CA package tests in parallel (#7438)
The CA tests don't share any state and create their own individual CA
implementations. We can safely run these tests in parallel within the CA
package to shave at least a second off of unit test runs at the expense
of additional CPU and memory usage.
2024-04-17 16:01:37 -07:00
Aaron Gable 2b8dea9821
Update publicsuffix-go (#7429)
We last updated the PSL two months ago, and the latest officially-tagged
release of publicsuffic-go is just one month old, but the domain
prompting the latest request to update the PSL landed just a few days
ago, so update to the latest commit rather than the latest release.

Also incidentally updates x/crypto, x/net, x/term, and x/sys, but brings
in no meaningful updates for any of them.

Fixes https://github.com/letsencrypt/boulder/issues/7428
2024-04-15 11:37:11 -07:00
Aaron Gable e1c2352d8d
Revert "CA: Fix multi-profile deployability bug" (#7423)
Reverts https://github.com/letsencrypt/boulder/pull/7422. That PR was
landed only for the sake of deployability. Now that it has been tagged
(in `release-2024-04-09`), it should be safe to revert to the desired
stricter behavior in the next release.

Part of https://github.com/letsencrypt/boulder/issues/6966
2024-04-15 11:03:21 -07:00
Phil Porada 3dc0039838
issuance: Validate existence of a CRL's TBSCertList.revokedCertificates field (#7417)
[RFC 5280 Section
5.1.2.6](https://datatracker.ietf.org/doc/html/rfc5280#section-5.1.2.6)
states:
> When there are no revoked certificates, the revoked certificates list
> MUST be absent.

The golang x509 library does parse CRLs and by virtue of zero values,
will correctly omit the `revokedCertificates` field from the DER-encoded
bytes of an ASN.1 data structure. The important bits that `crypto/x509`
uses to determine whether `revokedCertificates` exists are here:
[[1]](https://cs.opensource.google/go/go/+/refs/tags/go1.22.2:src/crypto/x509/x509.go;l=2263-2267)
[[2]](https://cs.opensource.google/go/go/+/refs/tags/go1.22.2:src/crypto/x509/x509.go;l=2359-2369)
[[3]](https://cs.opensource.google/go/go/+/refs/tags/go1.22.2:src/crypto/x509/x509.go;l=2453-2455)
and
[[4]](https://cs.opensource.google/go/go/+/refs/tags/go1.22.2:src/crypto/x509/parser.go;l=1157-1163).

This code is a validation that golang is doing the correct thing with
respect to omitting this field. I chose this method over
`asn1.Unmarshal` and building out a struct representation of a CRL to
reduce complexity and avoid potential future issues in golang's handling
of asn1 encoding/decoding.

Fixes https://github.com/letsencrypt/boulder/issues/7415
2024-04-12 17:56:37 -04:00
Aaron Gable 3664314778
Add GitHub Action to prompt CP/CPS review when new flags are added (#7425)
Fixes https://github.com/letsencrypt/boulder/issues/7420
2024-04-12 12:04:48 -07:00
Aaron Gable ce8986e17b
Make "CRLDPBase" config item optional (#7427)
This was missed in https://github.com/letsencrypt/boulder/pull/7300

Part of https://github.com/letsencrypt/boulder/issues/7296
2024-04-12 11:23:27 -07:00
dependabot[bot] 393beac0a1
build(deps): bump golang.org/x/sync from 0.6.0 to 0.7.0 (#7426)
Bumps [golang.org/x/sync](https://github.com/golang/sync) from 0.6.0 to
0.7.0.

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-12 12:30:55 -04:00
Aaron Gable 2099d57a9e
Run config/sql change action when ready for review (#7419)
Rather than running the "check-changes" action immediately when a PR is
opened, wait for the PR to be ready for review (either by being taken
out of draft mode, or by having reviewers added). This way it's possible
to create a draft PR, then create a corresponding deployment ticket
which references the PR, add that ticket to the PR description, and mark
the PR ready for review, thereby pre-empting the bot so it doesn't have
to leave a comment.
2024-04-10 11:22:04 -04:00
Aaron Gable ebdabe693b
CA: Fix multi-profile deployability bug (#7422)
When https://github.com/letsencrypt/boulder/pull/7325 was deployed to
staging, the CA threw "Incomplete cert for precertificate request"
errors. Even though the RA was forwarding the CertProfileHash in all
IssueCertificateForPrecertificate requests to updated CA instances, it
can't do that if the IssuePrecertificate request was handled by a
non-updated CA instance that didn't yet know to return the hash.

This PR should be landed, tagged with a release, and then immediately
reverted for inclusion in the next release.

Part of https://github.com/letsencrypt/boulder/issues/6966
2024-04-09 15:41:46 -07:00
Aaron Gable 327f96d281
Update integration test hierarchy for the modern era (#7411)
Update the hierarchy which the integration tests auto-generate inside
the ./hierarchy folder to include three intermediates of each key type,
two to be actively loaded and one to be held in reserve. To facilitate
this:
- Update the generation script to loop, rather than hard-coding each
intermediate we want
- Improve the filenames of the generated hierarchy to be more readable
- Replace the WFE's AIA endpoint with a thin aia-test-srv so that we
don't have to have NameIDs hardcoded in our ca.json configs

Having this new hierarchy will make it easier for our integration tests
to validate that new features like "unpredictable issuance" are working
correctly.

Part of https://github.com/letsencrypt/boulder/issues/729
2024-04-08 14:06:00 -07:00
Phil Porada 1e1f6ff254
CA: Load multiple certificate profiles (#7325)
This change introduces a new config key `certProfiles` which contains a
map of `profiles`. Only one of `profile` or `certProfiles` should be
used, because configuring both will result in the CA erroring and
shutting down. Further, the singular `profile` is now
[deprecated](https://github.com/letsencrypt/boulder/issues/7414).

The CA pre-computes several maps at startup; 
* A human-readable name to a `*issuance.Profile` which is referred to as
"name".
* A SHA-256 sum over the entire contents of the given profile to the
`*issuance.Profile`. We'll refer to this as "hash".

Internally, CA methods no longer pass an `*issuance.Profile`, instead
they pass a structure containing maps of certificate profile
identifiers. To determine the default profile used by the CA, a new
config field `defaultCertificateProfileName` has been added to the
Issuance struct. Absence of `defaultCertificateProfileName` will cause
the CA to use the default value of `defaultBoulderCertificateProfile`
such as for the the deprecated `profile`. The key for each given
certificate profile will be used as the "name". Duplicate names or
hashes will cause the CA to error during initialization and shutdown.

When the RA calls `ra.CA.IssuePrecertificate`, it will pass an arbitrary
certificate profile name to the CA triggering the CA to lookup if the
name exists in its internal mapping. The RA maintains no state or
knowledge of configured certificate profiles and relies on the CA to
provide this information. If the name exists in the CA's map, it will
return the hash along with the precertificate bytes in a
`capb.IssuePrecertificateResponse`. The RA will then call
`ra.CA.IssueCertificateForPrecertificate` with that same hash. The CA
will lookup the hash to determine if it exists in its map, and if so
will continue on with certificate issuance.

Precertificate and certificate issuance audit logs will now include the
certificate profile name and hex representation of the hash that they
were issued with.

Fixes https://github.com/letsencrypt/boulder/issues/6966

There are no required config or SQL changes.
2024-04-08 12:52:46 -04:00
Samantha a88bd68ead
WFE: Count NewOrders which indicate replacement (#7416)
Add support for counting new orders which indicate replacement according
to draft-ietf-acme-ari.

Fixes #7405
2024-04-08 12:32:45 -04:00
dependabot[bot] 70d1887eea
build(deps): bump docker/login-action from 3.0.0 to 3.1.0 (#7399)
Bumps [docker/login-action](https://github.com/docker/login-action) from
3.0.0 to 3.1.0.

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-05 13:56:24 -04:00
Aaron Gable 1f8a6e869c
Remove IssueCertificateRequest.IssuerNameID (#7409)
This field was introduced in
https://github.com/letsencrypt/boulder/pull/5222 to allow the old v1
WFEs to continue to tightly control which issuers were used, rather than
letting the CA dynamically pick an issuer based on the to-be-issued
certificate's public key. The plumbing between the v1 WFEs and the RA
was removed in https://github.com/letsencrypt/boulder/pull/5900, and
this has been dead code ever since.

Part of https://github.com/letsencrypt/boulder/issues/7291
2024-04-04 12:58:44 -04:00
Aaron Gable 7086537553
Update golang.org/x/net for security advisory (#7413)
This will fix the error govulncheck is reporting.
2024-04-04 12:50:42 -04:00
Aaron Gable a7b73450d5
Re-enable lints on go1.22 (#7412)
We had disabled our lints on go1.22 because golangci-lint and
staticcheck didn't work with some of its updates. Re-enable them, and
fix the things which the updated linters catch now.

Fixes https://github.com/letsencrypt/boulder/issues/7229
2024-04-04 08:14:29 -07:00
Samantha d509183513
Go: Update from 1.22.1 to 1.22.2 (#7410) 2024-04-03 18:49:39 -07:00
Aaron Gable 31907e5afd
Add checksums to release artifacts (#7404)
Fixes https://github.com/letsencrypt/boulder/issues/7403
2024-04-02 15:16:17 -07:00
Phil Porada 5f616ccdb9
Upgrade go-jose from v2.6.1 to v.4.0.1 (#7345)
Upgrade from the old go-jose v2.6.1 to the newly minted go-jose v4.0.1. 
Cleans up old code now that `jose.ParseSigned` can take a list of
supported signature algorithms.

Fixes https://github.com/letsencrypt/boulder/issues/7390

---------

Co-authored-by: Aaron Gable <aaron@letsencrypt.org>
2024-04-02 17:49:51 -04:00
Aaron Gable 2f669ed3e7
Remove go1.21 from CI (#7401)
We have moved entirely to go1.22 in prod. This also allows us to remove
setting loopvar from our CI tasks, since it is the default behavior as
of go1.22.
2024-04-01 15:16:42 -07:00
Aaron Gable 28bf76e4ce
Fix new CRL IDP construction to avoid double slash (#7402) 2024-04-01 15:55:30 -04:00
Aaron Gable bce14e56f6
Restructure admin subcommands for greater flexibility (#7398)
Give the admin tool a slightly more structured subcommand system:
subcommands are now represented by structs (rather than just methods on
the admin object) which satisfy a particular interface. This interface
separates flag declaration from execution, so that we can have greater
flexibility with regard to command line parsing. This allows the two
top-level flags (-config and -dry-run) to appear anywhere in the command
line (not only before the subcommand name), and allows the -h/-help flag
to print usage information even when other critical flags (like -config)
are missing.

Fixes https://github.com/letsencrypt/boulder/issues/7393
Fixes https://github.com/letsencrypt/boulder/issues/7359
2024-03-29 12:51:27 -07:00
Aaron Gable 6149ac63e6
admin: gain ability to block keys by spki hash (#7397)
Add a new input method flag to `admin block-key` which processes a file
containing one hexadecimal-encoded SPKI hash on each line. To facilitate
this, restructure the block-key subcommand's execution to more closely
resemble the revoke-cert subcommand, with a parallelism flag and the
ability to run many workers at the same time.

Part of https://github.com/letsencrypt/boulder/issues/7267
2024-03-27 17:17:39 -07:00
George Ma 3f6eccf58d
Fix two function names in doc comments (#7394) 2024-03-25 23:46:29 -07:00
Shiloh Heurich 2cf734edcd
Fix TestAkamaiPurgerDrainQueueSucceeds data race (#7389)
Fixes https://github.com/letsencrypt/boulder/issues/7388
2024-03-25 10:52:19 -07:00
Samantha 3e2d852f3c
ARI: Return HTTP 409 "Conflict" when the certificate identified by 'replaces' has already been replaced (#7385)
Fixes #7338
2024-03-21 15:57:22 -04:00
dependabot[bot] f0ade6b2cb
build(deps): bump github.com/eggsampler/acme/v3 from 3.4.0 to 3.5.0 (#7391) 2024-03-20 15:21:16 -07:00
Phil Porada 8556eaedca
SA: store and return certificate profile name (#7352)
Adds `certificateProfileName` to the `orders` database table. The
[maximum
length](https://github.com/letsencrypt/boulder/pull/7325/files#diff-a64a0af7cbf484da8e6d08d3eefdeef9314c5d9888233f0adcecd21b800102acR35)
of a profile name matches the `//issuance` package.

Adds a `MultipleCertificateProfiles` feature flag that, when enabled,
will store the certificate profile name from a `NewOrderRequest`. The
certificate profile name is allowed to be empty and the database will
treat that row as [NULL](https://mariadb.com/kb/en/null-values/). When
the SA retrieves this potentially NULL row, it will be cast as the
golang string zero value `""`.

SRE ticket IN-10145 has been filed to perform the database migration and
enable the new feature flag. The migration must be performed before
enabling the feature flag.

Part of https://github.com/letsencrypt/boulder/issues/7324
2024-03-20 13:08:31 -04:00
Samantha c6b50558e6
WFE: Add support for certificate profiles (#7373)
- Parse and validate the `profile` field in `newOrder` requests.
- Pass the `profile` field from `newOrder` calls to the resulting
`RA.NewOrder` call.
- When the client requests a specific profile, ensure that the profile
field is populated in the order returned.

Fixes #7332
Part of #7309
2024-03-20 12:49:45 -04:00
dependabot[bot] 206c35f099
build(deps): bump google.golang.org/protobuf from 1.32.0 to 1.33.0 (#7384)
Updates google.golang.org/protobuf from 1.32.0 to 1.33.0
Also updates github.com/golang/protobuf from 1.5.3 to 1.5.4
2024-03-19 10:39:33 -07:00
Aaron Gable 7f04092e72
Simplify streaming rows from the database (#7372)
Create a new method on the gorm rows object which runs a small closure
for every row retrieved from the database. Use this new method to remove
20 lines of boilerplate from five different SA methods and rocsp-tool.
2024-03-19 08:39:00 -07:00
Samantha 5e68cbe552
WFE: Gate ARI limit exemption and replacement tracking on a feature flag (#7383)
Gate checking of replacement orders and exemption for ARI replacements
on the `TrackReplacementCertificatesARI` feature flag.
2024-03-18 12:22:01 -04:00
Aaron Gable 8ac88f557b
RA: Propagate profile name and hash from SA to CA (#7367)
When the order object retrieved from the SA contains a profile name,
propagate that into the request for the CA to issue a precertificate.
Similarly, when the CA's precertificate issuance response contains a
profile hash, propagate that into the request for the CA to issue the
corresponding final certificate.

Fixes https://github.com/letsencrypt/boulder/issues/7366
2024-03-14 14:55:32 -07:00
Aaron Gable 8d169a8dfb
Add certificateProfileName to RA, SA, and Core order protos (#7381)
This adds the profile name to the proto messages necessary to propagate
it from the WFE to the SA, and from the SA to the CA. This change is
safe to land prior to any logic being added, and unblocks
profile-handling logic changes to the WFE, RA, SA, and CA.

Part of https://github.com/letsencrypt/boulder/issues/7309
2024-03-14 13:46:58 -04:00
dependabot[bot] c175272335
build(deps): bump go.opentelemetry.io/otel/trace from 1.21.0 to 1.24.0 (#7343)
Bumps
[go.opentelemetry.io/otel/trace](https://github.com/open-telemetry/opentelemetry-go)
from 1.21.0 to 1.24.0.

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-14 13:36:52 -04:00
Kruti Sutaria 57cf7d5f45
fixes #7356: admin-tool checks serial format for cert revocation (#7379)
When a serial is passed in, all extraneous characters that are not
alphanumeric are stripped. The result is checked against
[[core.ValidSerial](9b05c38eb3/core/util.go (L170))]
to ensure that it is a valid hex of 32 or 36 characters and then passed
to the rest of boulder. If the stripped serial is not a valid serial, an
error is thrown and revocation does not proceed.
2024-03-14 12:58:33 -04:00
Jacob Hoffman-Andrews c724845579
ci: update govulncheck (#7380)
Always run on the latest Go version. This reduces busywork / failed CI
builds when Go publishes a security release, since we have other
processes for making sure we get notice of those security releases.

This may still fail for a little while after the Go release is
published, while we wait for GitHub to update the Go version used in CI
as "latest", but it will be a little faster and require less manual
work.
2024-03-13 15:52:46 -04:00
Samantha e2c89ddb7e
ARI: Fix typo in error (#7382) 2024-03-13 12:07:02 -07:00
Aaron Gable ffef10ab36
admin: use SA to get metadata before blocking key (#7377)
Use two existing SA methods, KeyBlocked and GetSerialsByKey, to replace
the direct database access previously used by the blockSPKIHash method.
This is less efficient than before -- it now streams the whole set of
affected serials rather than just counting them -- but doing so prevents
us from needing an additional SA method just for counting.

Also update the default mock StorageAuthority and
StorageAuthorityReadOnly provided by the mocks package to return actual
stream objects (which stream zero results) instead of nil, so that tests
can attempt to read from the resulting stream without getting a nil
pointer exception.

Part of https://github.com/letsencrypt/boulder/issues/7350
2024-03-11 15:18:46 -07:00
Samantha 7e5c1ca4bd
RA: Count failed authorizations using key-value rate limits (#7346)
Part of #5545
2024-03-11 17:24:45 -04:00
Aaron Gable 6710ebe4cd
admin: use SA to get serials by account and by SPKI hash (#7369)
Add two new methods to the SA, GetSerialsByKey and GetSerialsByAccount,
which use the same query as the admin tool has previously used to get
serials matching a given SPKI hash or a given registration ID. These two
new gRPC methods read the database row-by-row and produce streams of
results to keep SA memory usage low.

Use these methods in the admin tool so it no longer needs a direct
database connection for these actions.

Part of https://github.com/letsencrypt/boulder/issues/7350
2024-03-11 13:25:59 -07:00
Matthew McPherrin 7d633c6e78
Check if JSON configs are properly formatted instead of relying on git --diff (#7375)
This adds a new --write flag which will write out the formatted JSON
files.

By default this command now checks if the files are properly formatted
and prints a list of unformatted files.

This avoids the problem of lints failing if there are uncommited
changes, and decouples this check from git.

By using a proper argument parsing library, we also get a good --help
flag.
2024-03-08 14:39:00 -08:00