Commit Graph

23 Commits

Author SHA1 Message Date
Aaron Gable 1ffa95d53d
Stop interacting with registration.contact column (#8200)
Deprecate the IgnoreAccountContacts feature flag. This causes the SA to
never query the contact column when reading registrations from the
database, and to never write a value for the contact column when
creating a new registration.

This requires updating or disabling several tests. These tests could be
deleted now, but I felt it was more appropriate for them to be fully
deleted when their corresponding services (e.g. expiration-mailer) are
also deleted.

Fixes https://github.com/letsencrypt/boulder/issues/8176
2025-06-13 14:40:19 -07:00
Aaron Gable 44f75d6abd
Remove mail functionality from bad-key-revoker (#8229)
Simplify the main logic loop to simply revoke certs as soon as they're
identified, rather than jumping through hoops to identify and
deduplicate the associated accounts and emails. Make the Mailer portion
of the config optional for deployability.

Part of https://github.com/letsencrypt/boulder/issues/8199
2025-06-09 14:36:19 -07:00
Samantha Frank 45a56ae9bd
database: No longer store or retrieve InitialIP (#7942)
The initialIP column has been defaulted to 0.0.0.0 since #7760. Remove
this field from the all structs while leaving the schema itself intact.

Part of #7917
2025-01-13 17:33:59 -05:00
Jacob Hoffman-Andrews 7d66d67054
It's borpin' time! (#6982)
This change replaces [gorp] with [borp].

The changes consist of a mass renaming of the import and comments / doc
fixups, plus modifications of many call sites to provide a
context.Context everywhere, since gorp newly requires this (this was one
of the motivating factors for the borp fork).

This also refactors `github.com/letsencrypt/boulder/db.WrappedMap` and
`github.com/letsencrypt/boulder/db.Transaction` to not embed their
underlying gorp/borp objects, but to have them as plain fields. This
ensures that we can only call methods on them that are specifically
implemented in `github.com/letsencrypt/boulder/db`, so we don't miss
wrapping any. This required introducing a `NewWrappedMap` method along
with accessors `SQLDb()` and `BorpDB()` to get at the internal fields
during metrics and logging setup.

Fixes #6944
2023-07-17 14:38:29 -07:00
Jacob Hoffman-Andrews 824417f6c0
sa: refactor db initialization (#6930)
Previously, we had three chained calls initializing a database:

 - InitWrappedDb calls NewDbMap
 - NewDbMap calls NewDbMapFromConfig

Since all three are exporetd, this left me wondering when to call one vs
the others.

It turns out that NewDbMap is only called from tests, so I renamed it to
DBMapForTest to make that clear.

NewDbMapFromConfig is only called internally to the SA, so I made it
unexported it as newDbMapFromMysqlConfig.

Also, I copied the ParseDSN call into InitWrappedDb, so it doesn't need
to call DBMapForTest. Now InitWrappedDb and DBMapForTest both
independently call newDbMapFromMysqlConfig.

I also noticed that InitDBMetrics was only called internally so I
unexported it.
2023-06-13 10:15:40 -07:00
Phil Porada a178943d01
bad-key-revoker: Reduce probability of hash collision during testing (#6790)
Create a jwkHash of 32 bytes rather than 2 bytes to reduce the
probability of a hash collision in the `TestInvoke` function.

Fixes https://github.com/letsencrypt/boulder/issues/6789
2023-03-31 13:27:12 -07:00
Jacob Hoffman-Andrews 994e9d3d0b
Add duplicate serial to bad-key-revoker unittest (#6543)
This tests the fix in #6531.
2023-01-18 11:28:24 -08:00
Samantha 78ea1d2c9d
SA: Use separate schema for incidents tables (#6350)
- Move incidents tables from `boulder_sa` to `incidents_sa` (added in #6344)
- Grant read perms for all tables in `incidents_sa`
- Modify unit tests to account for new schema and grants
- Add database cleaning func for `boulder_sa`
- Adjust cleanup funcs to omit `sql-migrate` tables instead of `goose`

Resolves #6328
2022-09-09 15:17:14 -07:00
Samantha b825594fa4
bad-key-revoker: Report unprocessed keys on each invocation (#6197)
Add a new query to bad-key-revoker, which counts the number of
unprocessed/queued keys on each run. This gives us a metric by
which we can see if the bad-key-revoker is backed up or running
behind.

Fixes #6063
2022-07-01 09:38:06 -07:00
Aaron Gable eb5d0e9ba9
Update golangci-lint from v1.29.0 to v1.42.1 (#5745)
Update the version of golangci-lint we use in our docker image,
and update the version of the docker image we use in our tests.
Fix a couple places where we were violating lints (ineffective assign
and calling `t.Fatal` from outside the main test goroutine), and add
one lint (using math/rand) to the ignore list.

Fixes #5710
2021-10-22 16:26:59 -07:00
Jacob Hoffman-Andrews 23dd1e21f9
Build all boulder binaries into a single binary (#5693)
The resulting `boulder` binary can be invoked by different names to
trigger the behavior of the relevant subcommand. For instance, symlinking
and invoking as `boulder-ca` acts as the CA. Symlinking and invoking as
`boulder-va` acts as the VA.

This reduces the .deb file size from about 200MB to about 20MB.

This works by creating a registry that maps subcommand names to `main`
functions. Each subcommand registers itself in an `init()` function. The
monolithic `boulder` binary then checks what name it was invoked with
(`os.Args[0]`), looks it up in the registry, and invokes the appropriate
`main`. To avoid conflicts, all of the old `package main` are replaced
with `package notmain`.

To get the list of registered subcommands, run `boulder --list`. This
is used when symlinking all the variants into place, to ensure the set
of symlinked names matches the entries in the registry.

Fixes #5692
2021-10-20 17:05:45 -07:00
Samantha 8f4c105ad8
GRPC: Remove ra-wrappers.go (#5623)
- Remove `grpc/ra-wrapper.go`
- Remove `core.RegistrationAuthority` interface
- Add in-memory (`inmem`) wrappers for `RA` and `SA`
- Implement the minimum necessary methods for in-memory `RA` and `SA` wrappers

Fixes #5584
2021-09-03 12:34:38 -07:00
Andrew Gabbitas 17f300387b
BadKeyRevoker: backoff on errors or no work (#5580)
- Add exponential backoff
- Add key `backoffIntervalMax` to JSON config with a default of `60s`

Fixes #5559
2021-08-19 13:31:47 -07:00
James Renken 5b37639109
Add certNotAfter condition to initial bad-key-revoker query (#5556)
Check the `certNotAfter` column earlier in `bad-key-revoker`'s work,
to avoid unnecessary queries to `certificateStatus` and `precertificates`
about certificates we know are expired.

Update `bad-key-revoker` tests to set unexpired certificates to have a
future expiration time, and to use a fake clock for better hermeticity.

Part of #5548
2021-08-02 16:01:42 -07:00
Aaron Gable 8be32d3312
Use google.protobuf.Empty instead of core.Empty (#5454)
Replace `core.Empty` with `google.protobuf.Empty` in all of our gRPC
methods which consume or return an empty protobuf. The golang core
proto libraries provide an empty message type, so there is no need
for us to reinvent the wheel.

This change is backwards-compatible and does not require a special
deploy. The protobuf message descriptions of `core.Empty` and
`google.protobuf.Empty` are identical, so their wire-formats are
indistinguishable and therefore interoperable / cross-compatible.

Fixes #5443
2021-06-03 14:17:41 -07:00
Samantha e0510056cc
Enhancements to SQL driver tuning via JSON config (#5235)
Historically the only database/sql driver setting exposed via JSON
config was maxDBConns. This change adds support for maxIdleConns,
connMaxLifetime, connMaxIdleTime, and renames maxDBConns to
maxOpenConns. The addition of these settings will give our SRE team a
convenient method for tuning the reuse/closure of database connections.

A new struct, DBSettings, has been added to SA. The struct, and each of
it's fields has been commented.

All new fields have been plumbed through to the relevant Boulder
components and exported as Prometheus metrics. Tests have been
added/modified to ensure that the fields are being set. There should be
no loss in coverage

Deployability concerns for the migration from maxDBConns to maxOpenConns
have been addressed with the temporary addition of the helper method
cmd.DBConfig.GetMaxOpenConns(). This method can be removed once
test/config is defaulted to using maxOpenConns. Relevant sections of the
code have TODOs added that link back to an newly opened issue.

Fixes #5199
2021-01-25 15:34:55 -08:00
Jacob Hoffman-Andrews 36c8fed4d9
Fix up NoRows handling in bad-key-revoker. (#4874)
Join on the precertificates table to handle the case when a
precertificate was issued but no certificate.

Treat NoRows as a regular error.

Use named constants to specify revoked/expired arguments
to insertCert helper.

Remove the config gate on the bad-key-revoker unittest.
2020-06-23 11:31:21 -07:00
Jacob Hoffman-Andrews d1fa9f9db8
Add more logging to bad-key-revoker. (#4871) 2020-06-15 16:24:44 -07:00
Roland Bracewell Shoemaker 356510aa54
cmd/bad-key-revoker: don't skip certificates where the account has no contacts (#4872) 2020-06-15 10:33:28 -07:00
Roland Bracewell Shoemaker c1fc30020e
Fix bug in how bad-key-revoker resolves contacts (#4833)
admin-revoker uses a dummy registration ID (0) when adding rows to
the blockedKeys table. resolveContacts in bad-key-revoker fails if it
cannot lookup a registration. Don't bother adding the id to the list
of ids to resolve, and add a catch for non-existent registration IDs
to resolveContacts.
2020-06-01 14:32:02 -07:00
Roland Bracewell Shoemaker 63aa8acbeb
Fix bad-key-revoker emailing corner case (#4810)
Fixes a corner case where we would still send emails to the original
revokers contact address if they didn't have any extant certificates
associated with the account that did the revoking.
2020-05-18 11:53:17 -07:00
Roland Bracewell Shoemaker 087e91934d
Fix bad-key-revoker select (#4806)
Adds a missing LIMIT, and adds a test case that catches the previous problem.
2020-05-07 13:05:20 -07:00
Roland Bracewell Shoemaker 70ff4d9347
Add bad-key-revoker daemon (#4788)
Adds a daemon which monitors the new blockedKeys table and checks for any unexpired, unrevoked certificates that are associated with the added SPKI hashes and revokes them, notifying the user that issued the certificates.

Fixes #4772.
2020-04-23 11:51:59 -07:00