Commit Graph

6868 Commits

Author SHA1 Message Date
huochexizhan a6dc97cb5b
fix: fix slice init length (#7731)
Initialize a slice with a capacity of len(nameToString) rather than initializing
the length of this slice.

Signed-off-by: huochexizhan <huochexizhan@outlook.com>
2024-10-08 11:32:25 -04:00
dependabot[bot] 0a543d151b
build(deps): bump the aws group across 1 directory with 4 updates (#7734) 2024-10-07 13:39:28 -07:00
dependabot[bot] 61ff7f606d
Update OTel dependencies (#7713)
Updates:
- go.opentelemetry.io/contrib/instrumentation (and subpackages) from 0.52.0 to 0.55.0
- go.opentelemetry.io/otel (and subpackages) from 1.27.0 to 1.30.0

Upstream release notes:
https://github.com/open-telemetry/opentelemetry-go-contrib/releases

Also transitively updates a few golang.org/x/ dependencies, and the grpc and protobuf
dependencies.
2024-10-07 13:22:08 -07:00
Samantha Frank 2e19a362ec
WFE/RA: Default codepaths to CheckRenewalExemptionAtWFE: true (#7745)
Also, remove redundant renewal checks in
`RA.checkNewOrdersPerAccountLimit()` and
`RA.checkCertificatesPerNameLimit()`.

Part of #7511
2024-10-07 15:12:30 -04:00
Aaron Gable 08615e3898
Deprecated goodkey.BlockedKeyFile (#7749)
This config field duplicates functionality that is better provided by
the blockedKeys database table. We should only have one mechanism for
blocking keys, so this one should be removed.

Mark it deprecated as a warning to any downstream consumers of Boulder.

Part of https://github.com/letsencrypt/boulder/issues/7748
2024-10-07 15:00:45 -04:00
Samantha Frank d656afce78
ratelimits: Rename DomainsForRateLimiting() to clarify use (#7746)
Rename as suggested by @jsha in #7729.
2024-10-07 14:56:36 -04:00
Phil Porada 56d392793a
Allow block-a-key to process private key files (#7737)
The CAB/F Debian weak keys (https://github.com/cabforum/Debian-weak-keys)
repository contains a bunch of DER encoded private keys that we should ensure
are blocked. I hacked up the block-a-key tool to output a base64 encoded SPKI
hash from an arbitrary PEM formatted private key file.
2024-10-07 14:56:14 -04:00
Aaron Gable 7b032a663f
Add feature flag to remove use of "INSERT RETURNING" in NewOrderAndAuthzs (#7739)
This is our only use of MariaDB's "INSERT ... RETURNING" syntax, which
does not exist in MySQL and Vitess. Add a feature flag which removes our
use of this feature, so that we can easily disable it and then re-enable
it if it turns out to be too much of a performance hit.

Also add a benchmark showing that the serial-insertion approach is
slower, but perhaps not debilitatingly so.

Part of https://github.com/letsencrypt/boulder/issues/7718
2024-10-04 14:56:44 -07:00
Jacob Hoffman-Andrews 58f515ef58
ca: make precertificate logging consistent (#7741)
Previously, we logged csr.DNSNames along with the precertificate
issuance events, but this was potentially misleading. For instance, if a
CSR contained only a CN and no SANs, this set would be empty.

Instead, log the uniquified, lowercased, sorted SANs that are actually
issued.

Also, emit precert=[] in issuePrecertificateInner, which is consistent
with the field name used when the final certificate is issued.

Note: this definitely underscores why it would be better to log these
things in a more structured way, for instance logging the
`issuance.IssuanceRequest` encoded as JSON, but I wanted to get these
quick fixes out of the way first.
2024-10-04 16:56:33 -04:00
James Renken beddae5970
Introduce SerialPrefixHex field in CA (#7721)
Add a new SerialPrefixHex field to the CA's config, which takes a
two-character hexadecimal string to use as the serial prefix. This
matches the way that the OCSP Responder's acceptable serial prefixes are
configured, and is easier for human operators to configure than raw
integers.

At the same time, change the type of the CA's internal serial prefix
from `int` to `byte`, using the type system to enforce its 8-bit length.

Fixes #7213
2024-10-04 10:50:57 -07:00
Matthew McPherrin a731497958
Add spans around (pre)certificate signing (#7707)
This adds custom spans around one of the more important parts of the
issuance stack - actually signing the (pre)certificates. We only have
automatic tracing right now, so this is just a small step towards adding
more customization there.

One specific note: I didn't include the regID in the span attributes,
though it is in the nearby log lines. I think that's something we likely
want to handle holistically (eg, via baggage propagation) rather than
one-off in manual spans like this.
2024-10-02 12:00:47 -07:00
Kruti Sutaria e9b6148448
Remove code that rejects old TLS requests (#7711)
The Boulder WFE accepts incoming connections (from our load balancers)
via either TLS or plain HTTP. When those connections are made over TLS,
it already enforces that the client be using TLS 1.3 or above. When those
connections are made over plain HTTP, the load balancer includes the TLS
version as a header, and Boulder was performing filtering based on that.

Our load balancers are now configured to reject older TLS versions, so we
can remove this check.

Fixes https://github.com/letsencrypt/boulder/issues/7710
2024-10-01 11:34:20 -07:00
Samantha Frank 61a9aa5353
WFE: Plumb ARI explanationURL through for incidents (#7730) 2024-09-30 15:25:22 -04:00
Samantha Frank ab69b72901
VA: Fix performRemoteValidation goroutine leak (#7727)
PerformValidation goroutines write to a buffered results channel to
prevent blocking.
2024-09-30 14:51:06 -04:00
Samantha Frank d850e633ae
ratelimits: Use full domain for the FailedAuthorizations limit (#7729)
The key-value implementation for the Failed Authorizations limit
mistakenly used eTLD+1 instead of the full domain, unlike its
predecessor.
2024-09-30 14:50:35 -04:00
Samantha Frank 2fa9fbcd23
SA: Add feature flag DisableLegacyLimitWrites (#7728) 2024-09-30 14:09:40 -04:00
Samantha Frank c034221f59
config: Default to checking renewal exemption at WFE (#7706)
Part of https://github.com/letsencrypt/boulder/issues/7511
2024-09-27 16:42:54 -04:00
James Renken 267c82dc25
Change ClearEmail to use a direct UPDATE query (#7724)
Change ClearEmail to use a direct `UPDATE` query instead of
`tx.Update()`, in order to avoid `LockCol` issues.

Part of https://github.com/letsencrypt/boulder/issues/7716
2024-09-27 12:39:27 -07:00
Matthew McPherrin 8dac30f1ad
Log the time hourly (#7723)
Logging it every minute is just a bit too much log volume and adds a
fair amount of clutter, especially for 'quieter' services.
2024-09-26 11:49:54 -07:00
cui fliter d71b4bc62b
Fix CT log loading error message (#7725)
The intention here should be to initialize a slice with a capacity of
len(remaining) rather than initializing the length of this slice, so that
the resulting error message doesn't start with empty-string entries.
2024-09-26 10:22:27 -07:00
Samantha Frank 3451952a6e
WFE: Only log warnings for non-limit errors (#7717)
Only log errors from `wfe.checkNewOrderLimits` and
`wfe.checkNewAccountLimits` if they're not `errors.RateLimit`.
2024-09-26 11:20:49 -04:00
Samantha Frank 8c009f2c5e
WFE: Suppress logging of probs.PausedProblem (#7719)
Instead of logging the message shown to the caller, log "429 ::
rateLimited :: account/ident pair is paused"
2024-09-26 11:20:26 -04:00
Samantha Frank c6849960d3
admin: Perform unpauseAccount batches in parallel (#7690)
- Deduplicates accounts being unpaused
- Dispatches (default: 10) SA.UnpauseAccount calls in parallel
- Retries AccountIDs with unpause.RequestLimit (50,000) unpaused
identifiers

Fixes https://github.com/letsencrypt/boulder/issues/7682
2024-09-26 11:20:08 -04:00
Samantha Frank 1b6e0867ae
ratelimits: Set a TTL each time we store bucket data in Redis (#7720)
Set the Redis TTL to TAT (theoretical arrival time) plus a 10-minute
buffer to account for possible clock skew.
2024-09-26 11:19:53 -04:00
Matthew McPherrin 2e2bb944cc
Make upgrading OpenTelemetry easier (#7712)
OpenTelemetry has "semantic conventions" which are versioned
independently of the software package, as it describes the semantics of
the resources being produced. Previously, we'd combined
`resource.Default()` using the `Merge` function with our own resources.

Merge, however, doesn't handle merging resources with different semantic
conventions. This means that every dependabot PR that bumps otel will
break when the `resources.Default` has a new version.

That doesn't seem worth it for the default resources, so just provide
our own resources which have everything we care about. I've added the
PID which we didn't have before but will be interesting. We will lose
the SDK's version, but I don't think that matters.

For more discussion on this topic, see
https://github.com/open-telemetry/opentelemetry-go/issues/3769
2024-09-24 16:37:27 -07:00
Aaron Gable 990ad076b7
Update CI to go1.23.1, remove go1.22.5 (#7699)
https://go.dev/doc/devel/release#go1.23.1
2024-09-11 10:09:01 -04:00
James Renken 412e959063
Allow CSRs whose CN is longer than acceptable (#7700)
Also rework comments & test names for clarity, add tests for this new CN
handling, and change/remove tests that should indeed no longer fail.

Fixes https://github.com/letsencrypt/boulder/issues/7623
2024-09-10 14:05:32 -04:00
James Renken 77fcc8f58a
Remove outdated integration test limitations (#7698)
Remove outdated limitations in TestIssuanceCertStorageFailed &
TestSubordinateCAChainsServedByWFE

Fixes https://github.com/letsencrypt/boulder/issues/7696
2024-09-04 17:10:58 -07:00
James Renken 707b734a75
Remove outdated limitation in TestNonceBalancer (#7694)
Also fix minor typos in comments.

Part of https://github.com/letsencrypt/boulder/issues/7696
2024-09-04 13:35:20 -07:00
Aaron Gable 1fcf0ee081
Write release checksums to per-release files (#7681)
Have the release action write the checksums to a file whose name matches
the name of the boulder deb and rpm files whose checksums it contains.
This prevents name-collision errors when we are running multiple Go
versions side-by-side in CI.

To demonstrate this, augment the try-release action to write the
checksums to the same file, print the list of files it would upload, and
print the contents of the checksums file. Also allow the try-release
workflow to be triggered manually.
2024-08-30 12:42:43 -07:00
Aaron Gable 135eda3cf3
Close test servers used by VA's HTTP tests (#7691)
Fixes https://github.com/letsencrypt/boulder/issues/1989
2024-08-30 11:44:15 -07:00
Aaron Gable dad9e08606
Lay the groundwork for supporting IP identifiers (#7692)
Clean up how we handle identifiers throughout the Boulder codebase by
- moving the Identifier protobuf message definition from sa.proto to
core.proto;
- adding support for IP identifier to the "identifier" package;
- renaming the "identifier" package's exported names to be clearer; and
- ensuring we use the identifier package's helper functions everywhere
we can.

This will make future work to actually respect identifier types (such as
in Authorization and Order protobuf messages) simpler and easier to
review.

Part of https://github.com/letsencrypt/boulder/issues/7311
2024-08-30 11:40:38 -07:00
Aaron Gable d58d09615a
Improve how we disable challenge types (#7677)
When creating an authorization, populate it with all challenges
appropriate for that identifier, regardless of whether those challenge
types are currently "enabled" in the config. This ensures that
authorizations created during a incident for which we can temporarily
disabled a single challenge type can still be validated via that
challenge type after the incident is over.

Also, when finalizing an order, check that the challenge type used to
validation each authorization is not currently disabled. This ensures
that, if we temporarily disable a single challenge due to an incident,
we don't issue any more certificates using authorizations which were
fulfilled using that disabled challenge.

Note that standard rolling deployment of this change is not safe if any
challenges are disabled at the same time, due to the possibility of an
updated RA not filtering a challenge when writing it to the database,
and then a non-updated RA not filtering it when reading from the
database. But if all challenges are enabled then this change is safe for
normal deploy.

Fixes https://github.com/letsencrypt/boulder/issues/5913
2024-08-29 15:38:50 -07:00
Samantha Frank ea62f9a802
admin: PauseIdentifier batch by account and pause in parallel (#7689)
Part of #7682
2024-08-29 14:33:27 -04:00
Aaron Gable e5731a4c23
gRPC: reject request if clock skew is too large (#7686)
Have our gRPC server interceptor check for excessive clock skew between
its own clock and gRPC client clocks. Do this by taking advantage of the
client request timestamp that most clients already supply for the
purpose of measuring cross-service latency. If the included timestamp is
more than 10 minutes from the gRPC server's local time, immediately
error out.

To keep the integration tests -- which heavily rely on clock
manipulation -- working, use build tags to disable this behavior during
integration testing.

Fixes https://github.com/letsencrypt/boulder/issues/7684
2024-08-29 11:32:24 -07:00
Aaron Gable da7865cb10
Add go1.23.0 to CI (#7665)
Begin testing on go1.23. To facilitate this, also update /x/net,
golangci-lint, staticcheck, and pebble-challtestsrv to versions which
support go1.23. As a result of these updates, also fix a handful of new
lint findings, mostly regarding passing non-static (i.e. potentially
user-controlled) format strings into Sprintf-style functions.

Additionally, delete one VA unittest that was duplicating the checks
performed by a different VA unittest, but with a context timeout bug
that caused it to break when go1.23 subtly changed DialContext behavior.
2024-08-23 14:56:53 -07:00
Aaron Gable cac431c661
WFE: Use RA.GetAuthorization to filter out disabled challenges (#7659)
Have the WFE ask the RA for authorizations, rather than asking the SA
directly. This extra layer of indirection allows us to filter out
challenges which have been disabled, so that clients don't think they
can attempt challenges that we have disabled.

Also shuffle the order of challenges within the authz objects rendered
by the API. We used to have code which does this at authz creation time,
but of course that was completely ineffectual once we stored the
challenges as just a bitmap in the database.

Update the WFE unit tests to mock RA.GetAuthorization instead of
SA.GetAuthorization2. This includes making the mock more accurate, so
that (e.g.) valid authorizations contain valid challenges, and the
challenges have their correct types (e.g. "http-01" instead of just
"http"). Also update the OTel tracing test to account for the new RPC.

Part of https://github.com/letsencrypt/boulder/issues/5913
2024-08-22 13:42:58 -07:00
Samantha Frank c9be034c00
ratelimits: Add a feature-flag which makes key-value implementation authoritative (#7666)
- Add feature flag `UseKvLimitsForNewOrder`
- Add feature flag `UseKvLimitsForNewAccount`
- Flush all Redis shards before running integration or unit tests, this
avoids false positives between local testing runs

Fixes #7664
Blocked by #7676
2024-08-22 15:56:30 -04:00
Phil Porada c7a04e8e22
admin: Add pause-identifier and unpause-account subcommands (#7668)
Implements tooling in `admin` that allows an operator to
administratively pause account/identifier pairs and unpause
whole accounts. This functionality mirrors the self-service
capabilities of the SFE, so that we can administratively intervene
in the pausing and unpausing process.

The new `pause-identifier` subcommand accepts a single form
of input, specified by the `-batch-file` flag. This expects a CSV
where each row is an accountID, identifierType, identifierValue
triple.

The new `unpause-account` subcommand accepts either a single
account ID with the `-account` flag, or a text file containing a list
of account IDs with the `-batch-file` flag.

Relates to https://github.com/letsencrypt/boulder/issues/7406
Fixes https://github.com/letsencrypt/boulder/issues/7618
2024-08-22 08:31:46 -07:00
Samantha Frank 4bf6e2f5a9
ratelimits: Skip Spends on CertificatesPerDomain for renewals (#7676)
This bug was introduced in
https://github.com/letsencrypt/boulder/pull/7669.

Also, make calls to ra.countCertificateIssued() non-blocking like
ra.countFailedValidation().

Part of #7664
Blocks #7666
2024-08-21 15:25:22 -04:00
Adin Schmahmann 9b08fa52ca
Update public suffix list (#7672)
Updates:

github.com/weppos/publicsuffix-go from
v0.30.3-0.20240510084413-5f1d03393b3d to
v0.40.3-0.20240815124645-a8ed110559c9
golang.org/x/crypto from v0.24.0 to v0.26.0
golang.org/x/net from v0.26.0 to v0.28.0
golang.org/x/sync from v0.7.0 to v0.8.0
golang.org/x/term from v0.21.0 to v0.23.0
golang.org/x/text from v0.16.0 to v0.17.0
golang.org/x/sys from v0.21.0 to v0.23.0
2024-08-19 14:03:03 -04:00
Aaron Gable 4482818a4f
Unify sa.GetAuthorizations2 and sa.GetValidAuthorizations2 (#7663)
These two methods were already nearly identical, their only meaningful
differences being the set of statuses they select for in their database
query, and the condition on which they prioritize entries in their
output.

Update them to have the exact same structure and logic. Most
meaningfully, update GetValidAuthorizations2 to hint the database to use
the same index which GetAuthorizations2 already hints.
2024-08-19 10:36:22 -07:00
Samantha Frank 14c0b2c3bb
ratelimits: Check at NewOrder and SpendOnly later (#7669)
- Check `CertificatesPerDomain` at newOrder and spend at Finalize time.
- Check `CertificatesPerAccountPerDomain` at newOrder and spend at
Finalize time.
- Check `CertificatesPerFQDNSet` at newOrder and spend at Finalize time.
- Fix a bug
in`FailedAuthorizationsPerDomainPerAccountSpendOnlyTransaction()` which
results in failed authorizations being spent for the exact FQDN, not the
eTLD+1.
- Remove redundant "max names" check at transaction construction time
- Enable key-value rate limits in the RA
2024-08-15 19:08:17 -04:00
Aaron Gable 41e8526fad
Simplify account creation in SA unit tests (#7670) 2024-08-15 16:05:10 -07:00
Aaron Gable ced0117f6e
Remove deprecated sapb.Authorizations.Authz "map" (#7658)
This field was deprecated in
https://github.com/letsencrypt/boulder/pull/7646 and the last uses of it
were removed in https://github.com/letsencrypt/boulder/pull/7650.
2024-08-15 15:46:46 -07:00
Aaron Gable e1790a5a02
Remove deprecated sapb.NewAuthzRequest fields (#7651)
Remove the id, identifierValue, status, and challenges fields from
sapb.NewAuthzRequest. These fields were left behind from the previous
corepb.Authorization request type, and are now being ignored by the SA.

Since the RA is no longer constructing full challenge objects to include
in the request, remove pa.ChallengesFor and replace it with the much
simpler pa.ChallengeTypesFor.

Part of https://github.com/letsencrypt/boulder/issues/5913
2024-08-15 15:35:10 -07:00
Samantha Frank 31d0ff0f98
ratelimits: Replace *Decision merging with always returning most restrictive (#7667)
Fix a bug added in #7653 which sometimes attributed an "Allowed"
`Transaction` to the amalgamated "Denied" `*Decision`. Instead, always
return the most restrictive `*Decision` in the batch.

Remove a debug `fmt.Printf()` call added in #7653
2024-08-15 17:49:34 -04:00
Aaron Gable 46859a22d9
Use consistent naming for dnsName gRPC fields (#7654)
Find all gRPC fields which represent DNS Names -- sometimes called
"identifier", "hostname", "domain", "identifierValue", or other things
-- and unify their naming. This naming makes it very clear that these
values are strings which may be included in the SAN extension of a
certificate with type dnsName.

As we move towards issuing IP Address certificates, all of these fields
will need to be replaced by fields which carry both an identifier type
and value, not just a single name. This unified naming makes it very
clear which messages and methods need to be updated to support
non-dnsName identifiers.

Part of https://github.com/letsencrypt/boulder/issues/7647
2024-08-12 14:32:55 -07:00
Aaron Gable fa732df492
Remove challenge.ProvidedKeyAuthorization (#7655)
This field was deprecated in
https://github.com/letsencrypt/boulder/pull/7515, and has been fully
replaced by vapb.PerformValidationRequest.ExpectedKeyAuthorization.

Fixes https://github.com/letsencrypt/boulder/issues/7514
2024-08-12 14:08:06 -07:00
Samantha Frank 6a3e9d725b
ratelimits: Provide verbose user-facing rate limit errors (#7653)
- Instruct callers to call *Decision.Result() to check the result of
rate limit transactions
- Preserve the Transaction within the resulting *Decision
- Generate consistently formatted verbose errors using the metadata
found in the *Decision
- Fix broken key-value rate limits integration test in
TestDuplicateFQDNRateLimit

Fixes #7577
2024-08-12 16:14:15 -04:00