Commit Graph

40 Commits

Author SHA1 Message Date
Aaron Gable 146b78a0f7
Remove all static minica keys (#7489)
Remove the redis-tls, wfe-tls, and mail-test-srv keys which were
generated by minica and then checked in to the repo. All three are
replaced by the dynamically-generated ipki directory.

Part of https://github.com/letsencrypt/boulder/issues/7476
2024-05-17 11:45:40 -07: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
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
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
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
dependabot[bot] 75acd40df1
build(deps): bump github.com/google/certificate-transparency-go from 1.1.4 to 1.1.6 (#6975)
Update google/certificate-transparency-go from 1.1.4 to 1.1.6
Release notes: https://github.com/google/certificate-transparency-go/releases/tag/v1.1.6
Changelog: https://github.com/google/certificate-transparency-go/compare/v1.1.4...v1.1.6

Update prometheus/client_golang from v1.14.0 to v1.15.1
Release notes: https://github.com/prometheus/client_golang/releases/tag/v1.15.1
Changelog: https://github.com/prometheus/client_golang/compare/v1.14.0...v1.15.1

Update prometheus/client_model from v0.3.0 to v0.4.0
Release notes: https://github.com/prometheus/client_model/releases/tag/v0.4.0
Changelog: https://github.com/prometheus/client_model/compare/v0.3.0...v0.4.0

Update x/sync from v0.1.0 to v0.2.0
Changelog: https://github.com/golang/sync/compare/v0.1.0...v0.2.0

Minor updates to various indirect dependencies as well.

The prometheus/client_golang update changes the type of
`prometheus.Desc.variableLabels` from `[]string` to
`prometheus.ConstrainedLabels`, which changes the string representation
of that field, necessitating a minor test expectations update in
//rocsp/metrics_test.

Fixes https://github.com/letsencrypt/boulder/issues/4548
2023-07-21 11:28:56 -07:00
Samantha 487680629d
cmd: TLSConfig values should be string not *string (#6872)
Fixes #6737
2023-05-08 13:21:42 -04:00
Phil Porada 17fb1b287f
cmd: Export prometheus metrics for TLS cert notBefore and notAfter fields (#6836)
Export new prometheus metrics for the `notBefore` and `notAfter` fields
to track internal certificate validity periods when calling the `Load()`
method for a `*tls.Config`. Each metric is labeled with the `serial`
field.

```
tlsconfig_notafter_seconds{serial="2152072875247971686"} 1.664821961e+09
tlsconfig_notbefore_seconds{serial="2152072875247971686"} 1.664821960e+09
```

Fixes https://github.com/letsencrypt/boulder/issues/6829
2023-04-24 16:28:05 -04:00
Samantha b2224eb4bc
config: Add validation tags to all configuration structs (#6674)
- Require `letsencrypt/validator` package.
- Add a framework for registering configuration structs and any custom
validators for each Boulder component at `init()` time.
- Add a `validate` subcommand which allows you to pass a `-component`
name and `-config` file path.
- Expose validation via exported utility functions
`cmd.LookupConfigValidator()`, `cmd.ValidateJSONConfig()` and
`cmd.ValidateYAMLConfig()`.
- Add unit test which validates all registered component configuration
structs against test configuration files.

Part of #6052
2023-03-21 14:08:03 -04:00
Matthew McPherrin 391a59921b
Move cmd.ConfigDuration to config.Duration (#6705)
We rely on the ratelimit/ package in CI to validate our ratelimit
configurations. However, because that package relies on cmd/ just for
cmd.ConfigDuration, many additional dependencies get pulled in.

This refactors just that struct to a separate config package. This was
done using Goland's automatic refactoring tooling, which also organized
a few imports while it was touching them, keeping standard library,
internal and external dependencies grouped.
2023-02-28 08:11:49 -08:00
Samantha 5c49231ea6
ROCSP: Remove support for Redis Cluster (#6645)
Fixes #6517
2023-02-09 17:14:37 -05:00
Samantha 6c6da76400
ROCSP: Replace Redis Cluster with a consistently sharded all-primary nodes (#6516) 2022-12-19 15:06:47 -05:00
Aaron Gable 9c197e1f43
Use io and os instead of deprecated ioutil (#6286)
The iotuil package has been deprecated since go1.16; the various
functions it provided now exist in the os and io packages. Replace all
instances of ioutil with either io or os, as appropriate.
2022-08-10 13:30:17 -07: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 243bcd7e8c
rocsp: plumb through more config options (#6244)
This allows configuring Boulder to talk to read-only replicas, and
decide on a routing policy (random or by latency).
2022-07-22 12:17:17 -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 a4ba9b1adb
rocsp/config: fix PoolSize comment (#6110)
The go-redis docs say default is 10 * NumCPU, but the actual code says 5.

Extra context:

2465baaab5/options.go (L143-L145)

2465baaab5/cluster.go (L96-L98)

For Options, the default (documented) is 10 * NumCPUs. For ClusterOptions, the
default (undocumented) is 5 * NumCPUs. We use ClusterOptions. Also worth noting:
for ClusterOptions, the limit is per node.
2022-05-12 16:29:26 -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
Aaron Gable 8cb01a0c34
Enable additional linters (#6106)
These new linters are almost all part of golangci-lint's collection
of default linters, that would all be running if we weren't setting
`disable-all: true`. By adding them, we now have parity with the
default configuration, as well as the additional linters we like.

Adds the following linters:
* unconvert
* deadcode
* structcheck
* typecheck
* varcheck
* wastedassign
2022-05-11 13:58:58 -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
Andrew Gabbitas 79048cffba
Support writing initial OCSP response to redis (#5958)
Adds a rocsp redis client to the sa if cluster information is provided in the
sa config. If a redis cluster is configured, all new certificate OCSP
responses added with sa.AddPrecertificate will attempt to be written to
the redis cluster, but will not block or fail on errors.

Fixes: #5871
2022-03-21 20:33:12 -06:00
Andrew Gabbitas c931cf06e6
Fix typo in rocsp doc comment (#5989) 2022-03-11 11:42:53 -07: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
Jacob Hoffman-Andrews 3d7206a183
ocsp-updater: add support for writing to Redis (#5825)
If configured, ocsp-updater will write responses to Redis in parallel
with MariaDB, giving up if Redis is slower and incrementing a stat.

Factors out the ShortIDIssuer concept from rocsp-tool into
rocsp_config.
2021-12-06 14:46:46 -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 d9245e9eda
Plumb through Redis config options. (#5803)
All the options from
https://pkg.go.dev/github.com/go-redis/redis#Options (except "DB int",
which we don't use) are now available via our JSON config.
2021-11-17 17:12:11 -08: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