Commit Graph

22 Commits

Author SHA1 Message Date
Samantha 9aef5839b5
WFE: Add new key-value ratelimits implementation (#7089)
Integrate the key-value rate limits from #6947 into the WFE. Rate limits
are backed by the Redis source added in #7016, and use the SRV record
shard discovery added in #7042.

Part of #5545
2023-10-04 14:12:38 -04:00
Samantha 4ed54ff9c6
dependencies: Update go-redis from v8 to v9 (#7041)
Updated so we can access the `SetAddrs()` method added to `*redis.Ring`
in `v9` in #7042.

Part of #5545
2023-08-22 13:06:25 -04:00
Samantha 55ac2a2604
rocsp: Call PING on each Redis shard (#7034) 2023-08-10 11:45:30 -04:00
Samantha 48f211c7ba
ratelimits: Add Redis source (#7016)
Part of #5545
2023-08-10 11:45:04 -04:00
Samantha 6c6da76400
ROCSP: Replace Redis Cluster with a consistently sharded all-primary nodes (#6516) 2022-12-19 15:06:47 -05:00
Jacob Hoffman-Andrews d55fc7e001
rocsp: use better buckets (#6251)
In practice Redis queries often complete in under 1ms, but we were using
the default Prometheus histogram buckets, the lowest of which is 5ms.
That means we don't get very detailed latency information from this
histogram. Use a smaller value (0.5ms) for the lowest bucket.
2022-07-26 12:59:07 -07:00
Jacob Hoffman-Andrews 29724cb0b7
ocsp/responder: update Redis source to use live signing (#6207)
This enables ocsp-responder to talk to the RA and request freshly signed
OCSP responses.

ocsp/responder/redis_source is moved to ocsp/responder/redis/redis_source.go
and significantly modified. Instead of assuming a response is always available
in Redis, it wraps a live-signing source. When a response is not available,
it attempts a live signing.

If live signing succeeds, the Redis responder returns the result right away
and attempts to write a copy to Redis on a goroutine using a background
context.

To make things more efficient, I eliminate an unneeded ocsp.ParseResponse
from the storage path. And I factored out a FakeResponse helper to make
the unittests more manageable.

Commits should be reviewable one-by-one.

Fixes #6191
2022-07-18 10:47:14 -07:00
Jacob Hoffman-Andrews 00056d5b54
ocsp-responder: on startup, ping Redis (#6218)
This should allow us to spot any configuration problems right away.
Otherwise, such problems may be swallowed in background tasks in the
go-redis library.
2022-07-06 16:36:39 -07:00
Jacob Hoffman-Andrews 18b5194f2e
rocsp: remove Metadata (#6206)
The metadata values were planned to be used for scanning Redis in
ocsp-updater. Since we won't do that, remove it. Happily, this also
allows us to get rid of shortIssuerId.

Removing the issuer check in rocsp_sa.go uncovered a "boxed nil" problem:
SA was doing a nil check against an interface field that in practice was
never nil (because it was promoted from a concrete type at construction
time). So we would always hit the ROCSP path. But one of the first steps
in that path was looking up an issuer ID. Since `test/config` never
had the issuers set, we would look up the issuer ID, not find it, and
return an error before we attempted to call storeResponse. To fix this,
I made `NewSQLStorageAuthority` take a concrete `*rocsp.WritingClient`
instead of an interface, and check for nil before assigning it to an
internal interface field.

Built on top of #6201.
2022-07-05 16:20:56 -07:00
Jacob Hoffman-Andrews ed1063d5c6
rocsp: add "connection_pool" to metric names (#6112)
Most of our existing Redis metrics are related to the connection pool,
but some sound like they could be request-oriented (like redis_hits and
redis_misses). Fix that with better naming. Also, join three related
metrics (hits, misses, and timeouts) under a single metric name with
labels so they more easily by grouped and counted.

Move the stat creation into rocsp/metrics.go so the names are in the
same file as the collector.

Add a unittest for rocsp metrics.
2022-05-12 16:01:07 -07:00
Jacob Hoffman-Andrews 0044c1b089
Make rocsp config robust to empty "addrs" config (#6086)
Before this change, an empty "addrs" config would result in a panic.
After this change, it will result in a clean error message.
2022-05-11 14:41:13 -07:00
Andrew Gabbitas 87ef1b4934
Use OCSP NextUpdate to calculate Redis TTL (#6031) 2022-04-04 15:18:11 -06:00
Andrew Gabbitas e2b49dbe0a
Support writing OCSP to Redis on revocation (#6012)
If a Redis client is configured for the SA service, OCSP responses created
during a revocation event will be written to Redis on a best effort basis.

Use the OCSP response NextUpdate time as the expiration time for the
redis entry. Change the new issuance OCSP storage to do the same.

Fixes #5888
2022-04-01 13:59:56 -06:00
Aaron Gable d1777c5fda
Fix shadowing assignments inside closures (#5944)
When inside a closure, it is important to not accidentally assign
to variables declared outside the scope of the closure. Doing so
causes static analysis tools (such as `errcheck`) to be unable to
evaluate the lifetime of the variable, and unable to determine if
it is appropriately read from before being assigned to again.

Fix two instances where we assign to a variable declared in the
closure's enclosing scope, rather than declaring a new variable
with the same name.
2022-02-16 14:33:17 -08:00
Aaron Gable ab79f96d7b
Fixup staticcheck and stylecheck, and violations thereof (#5897)
Add `stylecheck` to our list of lints, since it got separated out from
`staticcheck`. Fix the way we configure both to be clearer and not
rely on regexes.

Additionally fix a number of easy-to-change `staticcheck` and
`stylecheck` violations, allowing us to reduce our number of ignored
checks.

Part of #5681
2022-01-20 16:22:30 -08:00
Jacob Hoffman-Andrews 06ba17c2be
Add scanning to rocsp-tool (#5864)
We can scan metadata and get the age of responses.
We can scan responses and print them in base64.

Note: this issues a GET for each key, and blocks on the result. For much
faster scanning we will want to introduce parallel GETs in a subsequent
PR.

Also, add a `get` operation to get a single entry.

Fixes #5830
2022-01-18 14:27:15 -08:00
Andrew Gabbitas 47377915f9
Add latency metrics to rocsp (#5865)
Measure and export latency histogram metrics for ocsp storage and lookup
operations in redis.

Fixes #5832
2022-01-10 16:22:55 -07:00
Andrew Gabbitas 8ea5a3dcbf
Handle redis lookup errors when value not found (#5860)
Add a not found error type to rocsp.

Handle redis value not found lookup errors in the ocsp-responder different
than other redis lookup errors.

Add labels to the to ocspLookup metric and delete the source used
metric. This can now be determined based on which lookup metric
reports success.

Fixes #5833
2021-12-22 13:19:24 -08:00
Andrew Gabbitas def152b722
Export Prometheus stats for Redis ClusterClient (#5828)
Redis ClusterClient has metrics available. Create a collector so
Prometheus can access the metrics on-demand.

Part of #5768
2021-12-06 18:27:18 -08:00
Andrew Gabbitas 6184ad5365
Add `MakeReadClient` for creating a redis reader (#5814)
Add a function to create and return a read only redis client.
2021-11-25 12:16:01 -07:00
Jacob Hoffman-Andrews 4f1934af82
Add load-from-db support to rocsp-tool (#5778)
This scans the database for certificateStatus rows, gets them signed by the CA, and writes them to Redis.

Also, bump the default PoolSize for Redis to 100.
2021-11-08 17:35:10 -08:00
Jacob Hoffman-Andrews 7fab32a000
Add rocsp-tool to manually store OCSP responses in Redis (#5758)
This is a sort of proof of concept of the Redis interaction, which will
evolve into a tool for inspection and manual repair of missing entries,
if we find ourselves needing to do that.

The important bits here are rocsp/rocsp.go and
cmd/rocsp-tool/main.go. Also, the newly-vendored Redis client.
2021-11-02 11:04:03 -07:00