Commit Graph

5382 Commits

Author SHA1 Message Date
Samantha 401d862354
mail: Rename RecoverableSMTPError to BadAddressSMTPError (#5479)
Rename `RecoverableSMTPError` to `BadAddressSMTPError`. The former
implies that an operation resulting in this error can be retried.
2021-06-15 11:04:56 -07:00
Samantha 205223abbc
notify-mailer: Improve terminology consistency and general cleanup (#5485)
### Improve consistency
- Make registration `id` an `int64`
- Use `address`, `recipient`, and `record` terminology
- Use `errors.New()` in place of `fmt.Errorf()`
- Use `strings.Builder` in place of `bytes.Buffer`
- Use `errors.Is()` when checking for sentinel errors
- Remove unused (duplicate) `cmd.PasswordFile` in `config`
- Remove unused `cmd.Features` in `config`

### Improve readability
- Use godoc standard comments
- Replace multiple calls to `len(someVariable)` with `totalSomeVariable`

Part of #5420
2021-06-15 10:09:19 -07:00
Andrew Gabbitas b5aab29407
Make boulder-observer HTTP User-Agent configurable (#5484)
- Make User-Agent configurable in config file
- Fix README example
- Add tests
2021-06-14 11:08:18 -06:00
Aaron Gable d61be404d1
Run CI for commits and PRs to release branches (#5475)
In normal operation, Boulder does not have release branches, only
release tags. However, when we need to add hotfix commits on top of an
old release, we create a release branch, merge the commits there, and
then produce a new tag pointing at the tip of that branch. These release
branches are documented[1] to be named `refs/heads/release-branch-*`.
Therefore, we should run CI for PRs targeting, and new commits on, those
release branches.

[1] https://github.com/letsencrypt/boulder-release-process#when-main-is-dirty
2021-06-11 12:45:53 -07:00
Samantha d574b50c41
CA: Deprecate field ECDSAAllowedAccounts (#5477)
- Remove field `ECDSAAllowedAccounts` from CA
- Remove `ECDSAAllowedAccounts` from CA tests
- Replace `ECDSAAllowedAccounts` with `ECDSAAllowListFilename` in
  `test/config/ca-a.json` and `test/config/ca-b.json`
- Add YAML allow list file at `test/config/ecdsaAllowList.yml`

Fixes #5394
2021-06-11 12:13:01 -07:00
Aaron Gable 52ba25f3a5
cert-checker: allow 1s of slop in validity periods (#5471)
We are in the process of reducing our validity periods by one second,
from 90 days plus one second, to exactly 90 days. This change causes
cert-checker to be comfortable with certificates that have either of
those validity periods.

Future work is necessary to make cert-checker much more robust
and configurable, so we don't need changes like this every time we
reduce our validity period.

Part of #5472
2021-06-08 21:39:29 -07:00
Aaron Gable 6fb1d606f7
Package ct-test-srv into .deb (#5465)
Because ct-test-srv is lives in `//test` instead of in `//cmd`, it is not
included by default in the set of objects which are bundled into the
.deb and .rpb packages produced by the Makefile (although it is
compiled by the `make build` command). Add it to the set of files
bundled into the .deb, for the sake of our SREs.
2021-06-08 13:49:03 -07:00
Aaron Gable ff8c3c40f0
Update zlint to v3.2.0 (#5442)
Update zlint from v3.1.0 to v3.2.0:
https://github.com/zmap/zlint/compare/v3.1.0...v3.2.0
This update contains no breaking changes, and has no effect
on our issuance.

This transitively updates the zcrypto and publicsuffix-go libraries
as well:
9cf5beac...ea3fdbd5
d67cf1da...f2f762ef

Fixes #5430
2021-06-08 13:02:09 -07:00
Samantha 6955df0f56
contact-auditor: Add tool to audit registration contacts (#5425)
Add tool to audit subscriber registrations for e-mail addresses that
`notify-mailer` is currently configured to skip.

- Add `cmd/contact-auditor` with README
- Add test coverage for `cmd/contact-auditor`
- Add config file at `test/config/contact-auditor`

Part of #5372
2021-06-07 14:21:54 -07:00
Samantha a27054132b
mail: Reconnect when connection reset by peer (#5461) 2021-06-07 13:30:44 -06:00
Aaron Gable 64c9ec350d
Unify protobuf generation (#5458)
Create script which finds every .proto file in the repo and correctly
invokes `protoc` for each. Create a single file with a `//go:generate`
directive to invoke the new script. Delete all of the other generate.go
files, so that our proto generation is unified in one place.

Fixes #5453
2021-06-07 08:49:15 -07:00
Andrew Gabbitas 870a8df689
Move endpoint and tracing to top of HandlerFunc (#5460)
Move the logEvent.Endpoint and .Slug assignment as well as tracing to the
top of the HandlerFunc so a return cannot happen before the assignment.
Fixes cases where the endpoint is blank in logs in certain error cases.

Fixes: #5432
2021-06-03 16:53:25 -06: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
Andrew Gabbitas b3d8337ca9
Log endpoint and slug for all requests to wfe (#5455)
Log endpoint and slug for all requests to wfe

Set logEvent.endpoint and slug so requests to "/" and 404 paths are logged

Fixes: #5432
2021-06-03 11:19:10 -06:00
Aaron Gable 6629b49376
Fix grpc test proto generation (#5452)
The //grpc/test_proto/generate.go file was not generating the protos
in its own directory, it was regenerating the VA protos. Therefore the
generated files were out of date, and were relying on an old version
of the go proto library, which we can now remove from our direct deps.

Part of #5443
Part of #5453
2021-06-02 16:19:25 -07:00
Andrew Gabbitas 5b235bd8eb
Change ra.UpdateRegistration sig to match grpc (#5449)
Change ra.UpdateRegistration sig to match grpc

Fixes: #5403
2021-06-01 11:55:33 -06:00
Aaron Gable 7455a8a32d
Make RevokeCertificateWithReg wrappers passthroughs (#5445)
Update the signature of the RA's RevokeCertificateWithReg
method to exactly match that of the gRPC method it implements.
Remove all logic from the `RevokeCertificateWithReg` client
and server wrappers. Move the small amount of checking they
were performing directly into the server implementation.

Fixes #5440
2021-06-01 08:42:32 -07:00
Aaron Gable 1f0f59883c
Honeycomb: emit sample rate 1 instead of 0 (#5448)
The sampling rate integer is used by the span collector to estimate
"how many spans does this span actually represent". This allows accurate
volume comparisons: for example, if you sample successful requests at
a rate of 1/100 and error requests at a rate of 1/10, the trace query
interface will know to scale its query results by those respective
values in order to arrive at accurate error rate estimates.

Previously, this code was returning a sample rate integer of 0 to
indicate that the span was selected for sampling due to an extraordinary
circumstance. This was wrong. This change updates the sample rate int
to be 1, indicating that every such span which exhibited this feature
was sampled, and represents only itself.
2021-06-01 08:42:14 -07:00
Andrew Gabbitas 6b45dce5f1
Make ra.UpdateRegistration wrapper pass-through (#5431)
Part of: #5403
Fixes: #5398
2021-05-28 15:18:54 -06:00
Aaron Gable 02b6ea1489
Honeycomb: don't transmit gRPC client spans (#5446)
Add a test to the Honeycomb SamplerHook which never sends
spans which have a "meta.type" of "grpc_client". 

This field and value are set automatically by the Honeycomb gRPC
client interceptor, and can't be set by application code (any fields
set by application code have "app." prepended to their name).

Never sending these spans reduces our visibility into in-datacenter
network latency, but also reduces the number of spans sent by
roughly 50%.
2021-05-28 09:36:01 -07:00
Aaron Gable e3d194f4b0
Honeycomb: Use a deterministic SamplerHook (#5433)
Switch from using the honeycomb beeline's built-in sampling
to a sampler hook which bases its sampling decisions on a
hash of the trace ID. This allows us to do "deterministic"
sampling, where every span in a given trace will either be
sent or not (since the trace ID is the same across all spans
in a trace), giving us more complete traces.

This preserves the same simple (single integer) configuration
of the sample rate. The sample rate can be set differently for
different boulder components (e.g. 1 at the WFE, 100 at the 
RA, and 1000 at the nonce-service), but the sampling rate
denominator should only increase towards the leaves of a
gRPC request path.
2021-05-27 13:13:54 -07:00
Aaron Gable 229377aabc
Simplify gRPC interceptors (#5435)
Use the built-in grpc-go client and server interceptor chaining
utilities, instead of the ones provided by go-grpc-middleware.
Simplify our interceptors to call their handlers/invokers directly,
instead of delegating to the metrics interceptor, and add the
metrics interceptor to the chains instead.
2021-05-26 10:19:11 -07:00
Aaron Gable 38a1a1beb0
Update goque and simplify go.mod (#5441)
Update goque to its latest commit, which is an actual go module:
4044bc29...d6185101
Unfortunately, it still requires a commit hash (rather than just
a version number) due to issue https://github.com/beeker1121/goque/issues/21.

This removes the need for multiple indirect dependencies to be included
in our go.mod file. It also transitively updates goleveldb:
https://github.com/syndtr/goleveldb/compare/714f901b...v1.0.0
2021-05-26 10:15:37 -07:00
Aaron Gable 773c98875b
Remove PasswordConfig's in-config option (#5434)
We never really want to be using in-config passwords
anyway, so remove this option.

Fixes #5426
2021-05-26 10:14:13 -07:00
Samantha 41adb1de6f
id-exporter: UX and database query improvements (#5429)
A small collection of bug fixes, code cleanup, terminology standardization,
flag descriptor updates, and comment formatting that wasn't within the
scope of #5389.

- Set database transaction isolation level to `READ UNCOMMITTED` by
  default
- Add flag `-use-default-isolation-level` to use database default
  instead
- Replace database query used for method `findIDs`
- Replace database query used for method `findIDsForHostnames`
- **Bugfix:** reject `hostnamesFile` with zero entries
- **Bugfix:** use database settings provided in the configuration file
- **Terminology:** standardize on hostname(s) instead of domain(s)
- **Terminology:** update method and function comments to godoc standard
- **Terminology:** rename method `findIDsForDomains` to `findIDsForHostnames`

Fixes #5419
2021-05-25 11:20:57 -07:00
Aaron Gable 9abb39d4d6
Honeycomb integration proof-of-concept (#5408)
Add Honeycomb tracing to all Boulder components which act as
HTTP servers, gRPC servers, or gRPC clients. Add many values
which we currently emit to logs to the trace spans. Add a way to
configure the Honeycomb integration to our config files, and by
default configure all of our tests to "mute" (send nothing).

Followup changes will refine the configuration, attempt to reduce
the new dependency load, and introduce better sampling.

Part of https://github.com/letsencrypt/dev-misc-tickets/issues/218
2021-05-24 16:13:08 -07:00
Jacob Hoffman-Andrews b8f2edafb5
Roll back go-sql-driver to 1.5.0. (#5428)
This caused performance problems in production. We haven't yet bisected
to figure out exactly what commits in 1.6.0 cause the problem.
2021-05-21 16:19:54 -07:00
Samantha 4ad7e09658
id-exporter: Gather example hostnames in addition to IDs (#5418)
- Add support for gathering hostnames in addition to IDs
- Add flag `-with-example-hostnames`
- Add test for new `-with-example-hostnames` code path
- Add types to handle results with a `hostname` field
- Refactor the JSON marshaling and file writing as methods
  of the new `idExporterResults` type
- Refactor `main` to account for the `-with-example-hostnames`
  code path and add comments
- Update usage text to reflect the addition of `hostname` as a
  JSON field
- Update tests to reflect refactoring
- Remove inaccessible code path and corresponding test for
  `-outfile` being an empty string

Fixes #5389
2021-05-21 13:29:14 -07:00
Andrew Gabbitas 59bab8bac4
Make core.Registration.CreatedAt a *time.Time (#5422)
* Make core.Registration.CreatedAt a *time.time

Fixes: #5421
2021-05-21 13:44:56 -06:00
Phil Porada b01be4678f
Remove libtool-ltdl dependency in the Makefile (#5427)
- Remove irrelevant `libtool-ltdl` dependency from Makefile for
  both `deb` and `rpm`
2021-05-20 14:28:30 -07:00
Aaron Gable 40f9e38088
Add lower, faster duplicate certificate rate limit (#5401)
Add a new rate limit, identical in implementation to the current
`CertificatesPerFQDNSet` limit, intended to always have both a lower
window and a lower threshold. This allows us to block runaway clients
quickly, and give their owners the ability to fix and try again quickly
(on the order of hours instead of days).

Configure the integration tests to set this new limit at 2 certs per 2
hours. Also increase the existing limit from 5 to 6 certs in 7 days, to
allow clients to hit the first limit three times before being fully
blocked for the week. Also add a new integration test to verify this
behavior.

Note that the new ratelimit must have a window greater than the
configured certificate backdate (currently 1 hour) in order to be
useful.

Fixes #5210
2021-05-17 14:50:29 -07:00
Samantha 1f19eee55b
CA: Fix startup bug caused by ECDSA allow list reloader (#5412)
Solve a nil pointer dereference of `ecdsaAllowList` in `boulder-ca` by
calling `reloader.New()` in constructor `ca.NewECDSAAllowListFromFile`
instead.

- Add missing entry `ECDSAAllowListFilename` to
  `test/config-next/ca-a.json` and `test/config-next/ca-b.json`
- Add missing file ecdsaAllowList.yml to `test/config-next`
- Add missing entry `ECDSAAllowedAccounts` to `test/config/ca-a.json`
  and `test/config/ca-b.json`
- Move creation of the reloader to `NewECDSAAllowListFromFile`

Fixes #5414
2021-05-17 14:41:15 -07:00
Jacob Hoffman-Andrews 1bc10f6f42
Update go-sql-driver and yaml.v2. (#5411)
go-sql-driver: v1.5.0 --> v1.6.0
yaml.v2: v2.2.4 --> v2.4.0

These updates are required by other upcoming changes,
so landing them separately first.
2021-05-17 08:17:55 -07:00
Andrew Gabbitas 401df1c48a
Remove go1.16.2 from ci matrix (#5417)
Fixes #5416
2021-05-14 11:04:25 -07:00
Samantha f99b055aa8
Test: merge db-common.sh into db-create.sh (#5410)
Fixes #5331
2021-05-11 11:26:19 -07:00
Andrew Gabbitas 9d99bb4471
Reject too-long CNs at new-order time (#5409)
Fixes #5391
2021-05-10 16:01:37 -07:00
Samantha 8912c7c24d
CA: Load and reload ECDSA allow list from a file (#5392)
- Add field `ECDSAAllowListFilename` to `config.CA`
- Move ECDSA allow list logic from `boulder-ca/main.go` to new file
  `ca/ecdsa_allow_list.go`
- Add field `ecdsaAllowList` to `certificateAuthorityImpl`
- Update units test to account for changes to `certificateAuthorityImpl`
- Move previous allow list unit tests to `TestDeprecatedECDSAAllowList`
- Add `TestECDSAAllowList` units tests

Fixes #5361
2021-05-10 13:19:46 -07:00
Aaron Gable 81bb7dd571
Add Go 1.16.4 to docker image and CI (#5407)
This minor release contains a security fix for the http package's
Client, Server, and Transport, all of which we use.

CVE-2021-31525
2021-05-06 13:33:07 -07:00
J.C. Jones e5c48f4644
Use the MIN aggregation function for cert-checker's start-of-window (#5406)
Switch from using `ORDER BY` and `LIMIT` to obtain a minimum ID from the
certificates table, to using the `MIN()` aggregation function.

Relational databases are most optimized for set aggregation functions,
and anywhere that aggregations can be used for `SELECT` queries tends to
bring performance improvements. Experimentally this is an
order-of-magnitude improvement in query time. Theoretically the query
optimizer should have constructed the same underlying query from each,
but it didn't.

Partially reverts #5400
Fixes of #5393
2021-05-04 11:49:49 -07:00
J.C. Jones dd4ddfc965
Use dirty reads for cert-checker (#5405)
Explicitly opt in to the least-consistent transaction coherency for the
duration of all cert-checker queries.

The primary risk here is that the windowed table scan across the
certificates table can, on replicas, read a series of rows that aren't
from consistent timesteps. However, the certificates table is
append-only, so in practice this is not a concern, and there is no risk
to enabling the dirtiest of reads, done dirt cheap.

This doesn't impact the length of the window function, so existing
overlap mechanisms to ensure coverage will remain as good as they are
today.

Based on #5400 
Part of #5393
2021-05-04 11:47:52 -07:00
Aaron Gable d59e715c9d
Web: Preserve context from request (#5404)
The `http.Request` object can already have a context associated
with it. If it does, preserve that context rather than creating a new
one. If it doesn't, create a new `context.Background` instead.
2021-04-29 14:20:54 -07:00
Aaron Gable 7bf854fe03
Move OCSP gRPC service to separate file and struct (#5402)
Create a new `ocspImpl` struct which satisfies the interface required
by the `OCSPGenerator` gRPC service. Move the `GenerateOCSP`
method from the `certificateAuthorityImpl` to this new type. To support
existing gRPC clients, keep a reference to the new OCSP service in
the CA impl, and maintain a pass-through `GenerateOCSP` method.
Simplify some of the CA setup code, and make the CA implementation
non-exported because it doesn't need to be.

In order to maintain our existing signature and sign error metrics,
they now need to be initialized outside the CA and OCSP constructors.
This complicates the tests slightly, but seems like a worthwhile
tradeoff.

Fixes #5226
Fixes #5086
2021-04-29 14:20:39 -07:00
Andrew Gabbitas 5457680a9c
ra.NewRegistration: error ContactsPresent mismatch (#5399)
Generate error if ra.NewRegistration receives RPC with
ContactsPresent: false and non-empty Contacts list

Fixes #5396
2021-04-23 18:05:32 -06:00
Andrew Gabbitas 92c5af5807
Add ORDER BY to cert-checker initialID query (#5400)
Fixes: #5393
2021-04-23 14:52:24 -06:00
Andrew Gabbitas 5fdacbeaa6
grpc wrapper removal: Turn ra.NewRegistration into passthrough (#5397)
Turn ra.NewRegistration into passthrough

Fixes #5343
2021-04-23 13:53:22 -06:00
Aaron Gable 30a516737c
Remove CertDER from GenerateOCSPRequest proto (#5388)
No clients nor servers use this field anymore, so it can safely
be removed without breaking deployability.

Fixes #5079
2021-04-20 10:13:51 -07:00
Aaron Gable a19ebfa0e9
VA: Query SRV to preload/cache DNS resolver addrs (#5360)
Abstract out the way that the bdns library keeps track of the
resolvers it uses to do DNS lookups. Create one implementation,
the `StaticProvider`, which behaves exactly the same as the old
mechanism (providing whatever names or addresses were given
in the config). Create another implementation, `DynamicProvider`,
which re-resolves the provided name on a regular basis.

The dynamic provider consumes a single name, does a lookup
on that name for any SRV records suggesting that it is running a
DNS service, and then looks up A records to get the address of
all the names returned by the SRV query. It exports its successes
and failures as a prometheus metric.

Finally, update the tests and config-next configs to work with
this new mechanism. Give sd-test-srv the capability to respond
to SRV queries, and put the names it provides into docker's
default DNS resolver.

Fixes #5306
2021-04-20 10:11:53 -07:00
Jacob Hoffman-Andrews a89b79cb7d
Remove unused methods on bdns.Error (#5395) 2021-04-19 15:30:42 -07:00
Aaron Gable 6e6be607fa
Deprecate StoreIssuerInfo flag (#5386)
This flag is no longer referenced by any code, and can
be safely deprecated.

Part of #5079
2021-04-13 17:18:01 -07:00
Aaron Gable bba0747700
Remove legacy CertDER codepath from orphan-finder (#5387) 2021-04-12 13:20:52 -06:00