Commit Graph

6437 Commits

Author SHA1 Message Date
Aaron Gable d1f8fd2921
RA: improve AdministrativelyRevokeCertificate (#7275)
The RA.AdministrativelyRevokeCertificate method has two primary modes of
operation: if a certificate DER blob is provided, it parses and extracts
information from that blob, and revokes the cert; if no DER is provided,
it assumes the cert is malformed, and revokes it (but doesn't do an OCSP
cache purge) based on the serial alone. However, this scheme has
slightly confusing semantics in the RA and requires that the admin
tooling look up the certificates to provide them to the RA.

Instead, add a new "malformed" field to the RA's
AdministrativelyRevokeCertificateRequest, and deprecate the "cert" field
of that same request. When the malformed boolean is false, the RA will
look up and parse the certificate itself. When the malformed field is
true, it will revoke the cert based on serial alone.

Note that the main logic of AdministrativelyRevokeCertificate -- namely
revoking, potentially re-revoking, doing an akamai cache purge, etc --
is not changed by this PR. The only thing that changes here is how the
RA gets access to the to-be-revoked certificate's information.

Part of https://github.com/letsencrypt/boulder/issues/7135
2024-01-29 13:54:44 -08:00
Samantha 97a19b18d2
WFE: Check NewOrder rate limits (#7201)
Add non-blocking checks of New Order limits to the WFE using the new
key-value based rate limits package.

Part of #5545
2024-01-26 21:05:30 -05:00
Phil Porada 03152aadc6
RVA: Recheck CAA records (#7221)
Previously, `va.IsCAAValid` would only check CAA records from the
primary VA during initial domain control validation, completely ignoring
any configured RVAs. The upcoming
[MPIC](https://github.com/ryancdickson/staging/pull/8) ballot will
require that it be done from multiple perspectives. With the currently
deployed [Multi-Perspective
Validation](https://letsencrypt.org/2020/02/19/multi-perspective-validation.html)
in staging and production, this change brings us in line with the
[proposed phase
3](https://github.com/ryancdickson/staging/pull/8/files#r1368708684).
This change reuses the existing
[MaxRemoteValidationFailures](21fc191273/cmd/boulder-va/main.go (L35))
variable for the required non-corroboration quorum.
> Phase 3: June 15, 2025 - December 14, 2025 ("CAs MUST implement MPIC
in blocking mode*"):
>
>    MUST implement MPIC? Yes
> Required quorum?: Minimally, 2 remote perspectives must be used. If
using less than 6 remote perspectives, 1 non-corroboration is allowed.
If using 6 or more remote perspectives, 2 non-corroborations are
allowed.
>    MUST block issuance if quorum is not met: Yes.
> Geographic diversity requirements?: Perspectives must be 500km from 1)
the primary perspective and 2) all other perspectives used in the
quorum.
>
> * Note: "Blocking Mode" is a nickname. As opposed to "monitoring mode"
(described in the last milestone), CAs MUST NOT issue a certificate if
quorum requirements are not met from this point forward.

Adds new VA feature flags: 
* `EnforceMultiCAA` instructs a primary VA to command each of its
configured RVAs to perform a CAA recheck.
* `MultiCAAFullResults` causes the primary VA to block waiting for all
RVA CAA recheck results to arrive.


Renamed `va.logRemoteValidationDifferentials` to
`va.logRemoteDifferentials` because it can handle initial domain control
validations and CAA rechecking with minimal editing.

Part of https://github.com/letsencrypt/boulder/issues/7061
2024-01-25 16:23:25 -05:00
Samantha f8a6d3b63d
bdns: Properly handle transient network errors when performing DoH queries (#7280) 2024-01-25 16:01:18 -05:00
Matthew McPherrin 2f114f8a9b
Fix doc comment on core.KeyDigest (#7281)
This functionality was changed in
https://github.com/letsencrypt/boulder/pull/4745
but the doc wasn't updated.
2024-01-24 14:23:08 -08:00
Oleg Kovalov e46ca79366
semaphore: Add missing mutex unlock (#7272)
Add mutex unlock to ErrMaxWaiters return path.
2024-01-24 12:56:45 -05:00
Aaron Gable adb9673c37
Exempt renewals from NewOrders rate limit (#7002)
When a client is attempting to open a new Order which is identical to an
already-issued certificate, allow that request to bypass the normal New
Orders rate limit. This will allow renewals to go through even when a
client is exhibiting other bad behavior. This should not open the door
to floods of requests for the same certificate in rapid success, as the
Duplicate Certificates rate limit will still block those.

Fixes https://github.com/letsencrypt/boulder/issues/6792
2024-01-23 14:57:37 -08:00
Aaron Gable c305acfd97
SA: Add GetLintPrecertificate gRPC method (#7274)
Add a new "GetLintPrecertificate" method to the SA's gRPC service. This
acts identically to the existing "GetCertificate", but returns the
linting precertificate created just prior to the actual precertificate
instead. This is useful for revocation, where we need to be able to act
on a serial even if the corresponding (pre)certificate was never issued
or never saved to the database.

Part of https://github.com/letsencrypt/boulder/issues/7135
2024-01-23 14:01:28 -08:00
Aaron Gable 6ac1e46bcf
boulder-tools: plumb TARGETPLATFORM into build.sh (#7278)
This is necessary in order for build.sh to download the correct version
of protoc.

This bug was introduced by
https://github.com/letsencrypt/boulder/pull/7205, which inserted another
"FROM" clause between the top of the file (where TARGETPLATFORM was
originally pulled in) and the point where build.sh is executed.
2024-01-23 11:43:43 -08:00
Samantha 21044c5236
WFE: Two changes to NewRegistration key-value rate limits (#7258)
Make NewRegistration more consistent with the implementation in NewOrder
(#7201):
- Construct transactions just once,
- use batched spending instead of multiple spend calls, and
- do not attempt a refund for requests that fail due to RateLimit
errors.

Part of #5545
2024-01-23 12:09:20 -05:00
Jacob Hoffman-Andrews ce5632b480
Remove `service1` / `service2` names in consul (#7266)
These names corresponded to single instances of a service, and were
primarily used for (a) specifying which interface to bind a gRPC port on
and (b) allowing `health-checker` to check individual instances rather
than a service as a whole.

For (a), change the `--grpc-addr` flags to bind to "all interfaces." For
(b), provide a specific IP address and port for health checking. This
required adding a `--hostOverride` flag for `health-checker` because the
service certificates contain hostname SANs, not IP address SANs.

Clarify the situation with nonce services a little bit. Previously we
had one nonce "service" in Consul and got nonces from that (i.e.
randomly between the two nonce-service instances). Now we have two nonce
services in consul, representing multiple datacenters, and one of them
is explicitly configured as the "get" service, while both are configured
as the "redeem" service.

Part of #7245.

Note this change does not yet get rid of the rednet/bluenet distinction,
nor does it get rid of all use of 10.88.88.88. That will be a followup
change.
2024-01-22 09:34:20 -08:00
Oleg Kovalov f54292e7d1
all: use proper deprecation comment (#7273)
Silences `go-critic` linter by fixing a capitalization error.
2024-01-22 12:26:55 -05:00
Phil Porada eb69e9a66d
Replace codespell with typos (#7265)
Replace the python "codespell" tool with the rust "typos" tool.
To accomplish this, add a new rust-based step to the boulder-tools
docker build process, with some complexity to handle builds on
multiple developer architectures.

Co-authored-by: Viktor Szépe <viktor@szepe.net>
2024-01-17 18:08:22 -08:00
Aaron Gable ab6e023b6f
Simplify issuance.NameID and how it is used (#7260)
Rename "IssuerNameID" to just "NameID". Similarly rename the standalone
functions which compute it to better describe their function. Add a
.NameID() directly to issuance.Issuer, so that callers in other packages
don't have to directly access the .Cert member of an Issuer. Finally,
rearrange the code in issuance.go to be sensibly grouped as concerning
NameIDs, Certificates, or Issuers, rather than all mixed up between the
three.

Fixes https://github.com/letsencrypt/boulder/issues/5152
2024-01-17 12:55:56 -08:00
Samantha 551c10f77b
RA/CA: Make MaxNames field consistent and supply default (#7256)
Update RA and CA configuration to be more consistent with the identical
MaxNames field added to the WFE by #7201.
2024-01-17 14:48:02 -05:00
Aaron Gable d57edfa0f1
Run more go vet checks (#7255)
Enable the atomicalign, deepequalerrors, findcall, nilness,
reflectvaluecompare, sortslice, timeformat, and unusedwrite go vet
analyzers, which golangci-lint does not enable by default. Additionally,
enable new go vet analyzers by default as they become available.

The fieldalignment and shadow analyzers remain disabled because they
report so many errors that they should be fixed in a separate PR.

Note that the nilness analyzer appears to have found one very real bug
in tlsalpn.go.
2024-01-17 12:27:55 -05:00
Matthew McPherrin 56c10c613c
Update zlint (#7252)
Upgrade to zlint v3.6.0

Two new lints are triggered in various places:
aia_contains_internal_names is ignored in integration test
configurations, and unit tests are updated to have more realistic URLs.
The w_subject_common_name_included lint needs to be ignored where we'd
ignored n_subject_common_name_included before.

Related to https://github.com/letsencrypt/boulder/issues/7261
2024-01-16 11:50:37 -08:00
Aaron Gable d38b7b685b
Fix flaky integration test failures (#7262)
This partially reverts commit 20b121138c,
which was landed in https://github.com/letsencrypt/boulder/pull/7254.
Specifically, it reverts the addition of "noWaitForReady" to the
health-checker's gRPC config. This appears to stop the flaky `last
resolver error: produced zero addresses` failures we've been seeing in
the CI integration tests.
2024-01-16 09:50:13 -08:00
Aaron Gable a9a87cd4a8
Remove fallbacks from IssuerNameID to IssuerID (#7259)
The last rows using the old-style IssuerID were written to the database
in late 2021. Those rows have long since aged out -- we no longer serve
certificates or revocation information for them -- so we can remove the
code which handles those old-style IDs. This allows for some nice
simplifications in the CA's ocspImpl and in the Issuance package, which
will be useful for further reorganization of the CA and issuance
packages.

Fixes https://github.com/letsencrypt/boulder/issues/5152
2024-01-12 14:03:49 -08:00
Phil Porada 442b906ee8
test: dont overlap ca2 and va2 debug ports (#7257)
https://github.com/letsencrypt/boulder/pull/7246 introduced
using different ports for instances of the same service. CA2 and VA2
accidentally configured the same debug port.
2024-01-11 12:57:35 -08:00
Jacob Hoffman-Andrews 20b121138c
health-checker: bail early on handshake failure (#7254)
When we have a problem with our authentication certificates, it's better
to get a clear error early than to wait for health checker to time out.

Also, set noWaitForReady in the config, which prevents detailed errors
from being obscured by "timed out" errors.
2024-01-11 09:36:35 -08:00
Aaron Gable f3aab2d0c4
Silo OCSP Responder ID computation to filterSource (#7249)
The issuance.KeyHash() and issuance.NameHash() methods are used solely
by the OCSP responder filterSource. To avoid any possibility of
confusion between these OCSP-specific values and the normal SKID
extension, move them from the issuance package into the filterSource
itself.
2024-01-11 09:35:43 -08:00
Aaron Gable 19bd4a7a87
Issuance: carry SKID forward from precert (#7253)
Rather than regenerating the Subject Key ID during both precertificate
and final certificate issuance, carry the SKID forward from the precert
to the final cert. This ensures that the SKID remains stable between the
precert and final cert, even when the method for computing the SKID is
updated in the middle of certificate finalization.

Additionally, to ensure that the IssuanceRequest -> Certificate
conversion process is nearly identical for both precerts and final
certs, move SKID computation out of the issuance package and into the
CA, so that the SKID is always supplied as part of the issuance request
and the issuance package itself doesn't have conditionals or feature
flags regarding this behavior.
2024-01-10 14:42:25 -08:00
Jacob Hoffman-Andrews 7b347dd6c3
Use different ports for instances of the same service (#7246)
Part of #7245.

This just provides a unique port for each instance, and breaks the
service<->port mapping. A subsequent PR will move to listening on the
same IP.

Remove unused `-b` variants of crl-storer and akamai-purger.

The new port scheme is that the first instance of a service is on `93xx`
and the second instance of a service is on `94xx`.

Part of a stacked change with #7243.
2024-01-10 14:32:33 -08:00
Matthew McPherrin c7a0987971
Use asn1.TagOctetString constant (#7247)
We require a Go version newer than 1.6, so we can use the constant.
2024-01-10 10:38:02 -08:00
Jacob Hoffman-Andrews cd3bbf91ad
test: move SRV stanzas from config-next to config (#7243)
Service discovery via SRV records is now deployed in prod.
2024-01-10 10:31:23 -08:00
Phil Porada 2fe77e630e
Add additional service resolution strategy to consul doc (#7244)
While working on https://github.com/letsencrypt/boulder/pull/7238, I dug
into why the consul services config has, for example, `[ca-a, ca-b]` in
addition to `[ca1, ca2]`. Boulder test configs use `ca.service.consul`
which will return both CAs (`[ca-a, ca-b]`). For `[ca1, ca2]` though, a
grpc load balancing [integration
test](a55bf19ea0/test/integration-test.py (L121-L143))
individually targets services such as to verify that each backend is
working correctly.
2024-01-09 13:46:44 -08:00
Viktor Szépe 5c0ca04575
Fix typos (#7241)
Found new misspellings using the `typos` rust crate:
https://crates.io/crates/typos
2024-01-09 13:17:27 -08:00
Shiloh Heurich a55bf19ea0
Correct Comments on Challenge Construction in `core/challenges.go` (#7242)
This PR addresses a discrepancy between the code comments and the actual
behavior in the challenge construction functions within
`core/challenges.go`. The existing comments suggest that these functions
generate a random token if the supplied token is empty. However, upon
reviewing the relevant code, it's evident that these functions do not
generate a random token; they simply use the token that is passed to
them.

The [only calling
code](a3afce5f75/policy/pa.go (L561-L571))
in `policy/pa.go` demonstrates this behavior:

```go
token := core.NewToken()

for i, t := range challTypes {
	c, err := core.NewChallenge(t, token)
	// ... additional code ...
}
```

This change corrects the comments to reflect actual behavior.
2024-01-08 14:55:33 -08:00
dependabot[bot] c47e95e75a
build(deps): bump github.com/aws/aws-sdk-go-v2
Update AWS SDK v2, and its dependencies and subpackages:

- ask-sdk-go-v2: v1.22.1 -> v1.24.1
- aws-sdk-go-v2/config: v1.18.25 -> v1.26.3
- aws-sdk-go-v2/config: v1.18.25 -> v1.48.0
- smithy-go: v1.16.0 -> v1.19.0
2024-01-08 13:27:17 -08:00
Phil Porada 2e951b0105
Remove ca-a and ca-b distinction in test configs (#7238)
Fixes https://github.com/letsencrypt/boulder/issues/7187
2024-01-08 13:19:28 -08:00
Matthew McPherrin e8d382aec0
Upgrade the protobuf and grpc dependencies in Boulder (#7232)
Protobuf v1.32 fixes a potential stack overflow crash. Boulder doesn't
expose grpc externally so the risk is minimal, but it seems prudent to
upgrade on a regular cadence.  IE, this is not a security fix for Boulder.
2024-01-08 11:23:23 -08:00
Samantha 4e5105d2af
ratelimits: Fix two transaction construction bugs (#7200)
- Update parsing of overrides with Ids formatted as 'fqdnSet' to produce
a hexadecimal string.
- Update validation for Ids formatted as 'fqdnSet' when constructing a
bucketKey for a transaction to validate before identifier construction.
- Skip CertificatesPerDomain transactions when the limit is disabled.

Part of #5545
2024-01-08 12:22:09 -05:00
dependabot[bot] c1f7de06e9
build(deps): bump actions/setup-go from 4 to 5 (#7234)
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 4 to
5.
2024-01-04 09:07:12 -05:00
dependabot[bot] 21fc191273
build(deps): bump go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp from 0.44.0 to 0.46.1 (#7233)
Bumps
[go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp](https://github.com/open-telemetry/opentelemetry-go-contrib)
from 0.44.0 to 0.46.1.
2024-01-02 12:44:53 -05:00
Aaron Gable 5972d43924
Add error checking and default value for LifespanOCSP (#7222)
We do this in code, rather than with the config validation package,
because our custom config.Duration type confuses the config validator.

Fixes https://github.com/letsencrypt/boulder/issues/7219
2023-12-21 13:07:06 -05:00
Phil Porada 0fc9de63ee
SA: Enforce microsecond granularity for long_query_time and max_statement_time (#7224)
In MariaDB, `long_query_time`[1] and `max_statement_time`[2] have up to
microsecond granularity (6 digits to the right of the decimal).

Fixes an issue detected by proxysql in staging.
```
MySQL_Session.cpp:6567:handler___status_WAITING_CLIENT_DATA___STATE_SLEEP___MYSQL_COM_QUERY_qpo(): [ERROR] Unable to parse query. If correct, report it as a bug: SET long_query_time=3.9200000000000004
```

1. https://mariadb.com/kb/en/server-system-variables/#long_query_time
2. https://mariadb.com/kb/en/server-system-variables/#max_statement_time

---------

Co-authored-by: Aaron Gable <aaron@letsencrypt.org>
2023-12-21 13:06:30 -05:00
Matthew McPherrin e331a51e4d
Switch from lint.Lint to lint.CertificateLint (#7230)
Zlint is deprecating lint.Lint in favour of lint.CertificateLint.

The main difference is that metadata is now its own struct, shared with
lint.RevocationListLint and presumably future lint types.
2023-12-21 08:11:03 -08:00
Aaron Gable d84e8d08f2
Begin testing on go1.22rc1 (#7226)
Draft release notes: https://tip.golang.org/doc/go1.22
2023-12-20 11:41:35 -08:00
dependabot[bot] 238518da55
build(deps): bump golang.org/x/crypto from 0.15.0 to 0.17.0 (#7223)
Changelog: https://github.com/golang/crypto/compare/v0.15.0...v0.17.0
2023-12-20 11:38:15 -08:00
Samantha d281702c17
PA: Improve wildcard exact blocklist implementation (#7218)
Revamp WillingToIssueWildcards to WillingToIssue. Remove the need for
identifier.ACMEIdentifiers in the WillingToIssue(Wildcards) method.
Previously, before invoking this method, a slice of identifiers was
created by looping over each dnsName. However, these identifiers were
solely used in error messages.

Segment the validation process into distinct parts for domain
validation, wildcard validation, and exact blocklist checks. This
approach eliminates the necessity of substituting *. with x. in wildcard
domains.

Introduce a new helper, ValidDomain. It checks that a domain is valid
and that it doesn't contain any invalid wildcard characters.
Functionality from the previous ValidDomain is preserved in
ValidNonWildcardDomain.

Fixes #3323
2023-12-19 14:22:18 -05:00
Aaron Gable 300b291624
expiration-mailer: check address validity before sending (#7220)
Use policy.ValidEmail to vet email addresses before sending expiration
notifications to them. This same check is performed by notify-mailer,
and it helps reduce the number of invalid addresses we attempt to send
to and the number of email bounces we generate.

Additionally, mark certificates as having had a nag email sent if there
are no valid addresses for us to send to, so that we don't constantly
retry them.

Fixes https://github.com/letsencrypt/boulder/issues/5372
2023-12-18 13:32:43 -08:00
Jacob Hoffman-Andrews 1d5b539555
dns: clone and modify http.DefaultTransport (#7216)
Besides inheriting the ForceAttemptHTTP2 setting, this inherits
reasonable defaults for MaxIdleConns, IdleConnTimeout, DialTimeout, and
so on.

Follow-up for https://github.com/letsencrypt/boulder/pull/7215
2023-12-15 15:09:27 -08:00
Samantha 25ea9e9cf0
WFE: Implement CertID format as per draft-ietf-acme-ari-02 (#7184)
Add support for draft-ietf-acme-ari-02 format alongside the existing
draft-ietf-acme-ari-01 implementation. Both formats are interchangeable.

Fixes #7037
2023-12-15 14:34:28 -08:00
Aaron Gable 164e035915
Reduce logging from inflight validation collisions (#7209)
If a client attempts to validate a challenge twice in rapid succession,
we'll kick off two background validation routines. One of these will
complete first, updating the database with success or failure. The other
will fail when it attempts to update the database and finds that there
are no longer any authorizations with that ID in the "pending" state.
Reduce the level at which we log such events, since we don't
particularly care about them.

Fixes https://github.com/letsencrypt/boulder/issues/3995
2023-12-15 09:58:34 -08:00
Aaron Gable 6b54b61f21
Prevent serial prefixes from beginning with a 1 (#7214)
Change the max value of the CA's `SerialPrefix` config value from 255 (a
byte of all 1s) to 127 (a byte of one 0 followed by seven 1s). This
prevents the serial prefix from ever beginning with a 1.

This is important because serials are interpreted as signed
(twos-complement) integers, and are required to be positive -- a serial
whose first bit is 1 is considered to be negative and therefore in
violation of RFC 5280. The go stdlib fixes this for us by prepending a
zero byte to any serial that begins with a 1 bit, but we'd prefer all
our serials to be the same length.

Corresponding config change was completed in IN-9880.
2023-12-15 07:37:44 -08:00
Aaron Gable 21b18667b2
Remove static test certs from SA unittests (#7217)
Fixes https://github.com/letsencrypt/boulder/issues/6279
2023-12-15 07:36:59 -08:00
Jacob Hoffman-Andrews 81e04ab14c
dns: add ForceAttemptHTTP2 (#7215)
Per https://pkg.go.dev/net/http#hdr-HTTP_2:

> The http package's Transport and Server both automatically enable
HTTP/2 support for simple configurations.

and https://pkg.go.dev/net/http#Transport:

> // If non-nil, HTTP/2 support may not be enabled by default.
>	TLSClientConfig *tls.Config

Since we were setting a non-default TLSClientConfig to trust custom
roots, we accidentally turned off HTTP/2 support. And Unbound requires
HTTP/2 to serve DoH queries.

Also, clone the TLS config just to be safe against possible mutation in
other packages.
2023-12-13 22:18:00 -05:00
dependabot[bot] 289284ad6e
build(deps): bump golang.org/x/term from 0.13.0 to 0.15.0 (#7210)
Updates golang.org/x/term and golang.org/x/sys. Changelogs:
- https://github.com/golang/term/compare/v0.13.0...v0.15.0
- https://github.com/golang/sys/compare/v0.13.0...v0.15.0
2023-12-13 16:23:01 -08:00
Aaron Gable 26e3646249
Add integration test for account key change (#7208)
Fixes https://github.com/letsencrypt/boulder/issues/3112
Fixes https://github.com/letsencrypt/boulder/issues/7063
2023-12-13 13:54:38 -08:00