Commit Graph

17 Commits

Author SHA1 Message Date
Aaron Gable 212a66ab49
Update go versions in CI and release (#7971)
Update from go1.23.1 to go1.23.6 for our primary CI and release builds.
This brings in a few security fixes that aren't directly relevant to us.

Add go1.24.0 to our matrix of CI and release versions, to prepare for
switching to this next major version in prod.
2025-02-19 14:37:01 -08:00
Aaron Gable 6ae6aa8e90
Dynamically generate grpc-creds at integration test startup (#7477)
The summary here is:
- Move test/cert-ceremonies to test/certs
- Move .hierarchy (generated by the above) to test/certs/webpki
- Remove our mapping of .hierarchy to /hierarchy inside docker
- Move test/grpc-creds to test/certs/ipki
- Unify the generation of both test/certs/webpki and test/certs/ipki
into a single script at test/certs/generate.sh
- Make that script the entrypoint of a new docker compose service
- Have t.sh and tn.sh invoke that service to ensure keys and certs are
created before tests run

No production changes are necessary, the config changes here are just
for testing purposes.

Part of https://github.com/letsencrypt/boulder/issues/7476
2024-05-15 11:31:23 -04:00
Samantha 9f2a27e03b
grpc: Consolidate various testdata hierarchies (#7456)
TLS credential tests use `test/grpc-creds` instead of various
hierarchies in `testdata` directories.
2024-04-29 16:56:18 -07:00
Aaron Gable 294d1c31d7
Use error wrapping for berrors and tests (#5169)
This change adds two new test assertion helpers, `AssertErrorIs`
and `AssertErrorWraps`. The former is a wrapper around `errors.Is`,
and asserts that the error's wrapping chain contains a specific (i.e.
singleton) error. The latter is a wrapper around `errors.As`, and
asserts that the error's wrapping chain contains any error which is
of the given type; it also has the same unwrapping side effect as
`errors.As`, which can be useful for further assertions about the
contents of the error.

It also makes two small changes to our `berrors` package, namely
making `berrors.ErrorType` itself an error rather than just an int,
and giving `berrors.BoulderError` an `Unwrap()` method which
exposes that inner `ErrorType`. This allows us to use the two new
helpers above to make assertions about berrors, rather than
having to hand-roll equality assertions about their types.

Finally, it takes advantage of the two changes above to greatly
simplify many of the assertions in our tests, removing conditional
checks and replacing them with simple assertions.
2020-11-06 13:17:11 -08:00
Samantha 9c6a67db38
grpc: replacing error assertions with errors.As (#5143)
Part of #5010
2020-10-26 15:25:38 -07:00
Roland Bracewell Shoemaker 75b034637b
Update travis go versions (remove 1.14.1, add 1.15rc1) (#5002)
Fixes #4919.
2020-08-04 12:13:09 -07:00
Jacob Hoffman-Andrews cdb0bddbd8
Prefix error names with "Err" (#4755)
Staticcheck cleanup: https://staticcheck.io/docs/checks#ST1012
2020-04-08 17:19:35 -07:00
Daniel McCarney 3319246a97 Dev/CI: Add Go 1.11.1 builds (#3888)
Resolves https://github.com/letsencrypt/boulder/issues/3872

**Note to reviewers**: There's an outstanding bug that I've tracked down to the `--load` stage of the integration tests that results in one of the remote VA instances in the `test/config-next` configuration under Go 1.11.1 to fail to cleanly shut down. I'm working on finding the root cause but in the meantime I've disabled `--load` during CI so we can unblock moving forward with getting Go 1.11.1 in dev/CI. Tracking this in https://github.com/letsencrypt/boulder/issues/3889
2018-10-19 09:38:20 -07:00
Jacob Hoffman-Andrews dbcb16543e Start using multiple-IP hostnames for load balancing (#3687)
We'd like to start using the DNS load balancer in the latest version of gRPC. That means putting all IPs for a service under a single hostname (or using a SRV record, but we're not taking that path). This change adds an sd-test-srv to act as our service discovery DNS service. It returns both Boulder IP addresses for any A lookup ending in ".boulder". This change also sets up the Docker DNS for our boulder container to defer to sd-test-srv when it doesn't know an answer.

sd-test-srv doesn't know how to resolve public Internet names like `github.com`. Resolving public names is required for the `godep-restore` test phase, so this change breaks out a copy of the boulder container that is used only for `godep-restore`.

This change implements a shim of a DNS resolver for gRPC, so that we can switch to DNS-based load balancing with the currently vendored gRPC, then when we upgrade to the latest gRPC we won't need a simultaneous config update.

Also, this change introduces a check at the end of the integration test that each backend received at least one RPC, ensuring that we are not sending all load to a single backend.
2018-05-23 09:47:14 -04:00
Roland Bracewell Shoemaker a7cd4fb2c7 Don't wrap errors we return from boulder/grpc/creds.ClientHandshake (#2590)
The gRPC client reconnect code needs to be able to check if a error is temporary so that it can decide if it should attempt to reconnect or just fail and kill the client[1]. By wrapping the error we were receiving in our TLS handshake code we were removing the existing `Temporary` interface on the error. This meant that if a client attempted to reconnect to a server that was in the process of being shutdown, the client would consider that server permanently dead and never retry.

Fix is simple: don't wrap errors that we pass back into the gRPC internals so that they can be properly inspected.

[1]: aefc96d792/clientconn.go (L783)
2017-03-01 11:27:03 -08:00
Jacob Hoffman-Andrews 3abb9d1780 Make client certificate errors more verbose. (#2451)
Echo the expected list of names and the received list of names.

Also, change the unittest to use its own testdata directory rather than
borrowing.
2016-12-29 14:52:12 -08:00
Roland Bracewell Shoemaker 43bcc0b167 Empty gRPC whitelist fix (#2376)
`grpc/creds:serverTransportCredentials.validateClient` is meant to ignore the check if the `acceptedSANs` map it is constructed with is `nil`. This never happens as the map is constructed using `make(map[string]struct{})` meaning it can never be `nil`.

Instead start with a `nil` map and only populate it if we have `ClientNames` to whitelist.

Fixes #2375.
2016-12-05 08:26:19 -08:00
Daniel bcc389d109
Fixes gofmt -s diffs 2016-11-30 13:30:03 -05:00
Daniel McCarney d8c10149dd Updates `google.golang.org/grpc` to v1.0.3. (#2359)
This PR updates our GRPC library dep. to v1.0.3. It's likely we can update to v1.0.4 without much effort but on a first attempt it seems that the SupportPackageIsVersion3 to SupportPackageIsVersion4 change might cause some headaches so I started with 1.0.3.

The grpc/creds.go serverTransportCredentials and clientTransportCredentials needed two new funcs (Clone and OverrideServerName) to conform to the updated credentials.TransportCredentials interface.

It's tempting to remove grpc/creds.go clientTransportCredentials entirely now that the TLSCredentials from upstream has a OverrideServerName function we can use, but unfortunately it only supports one hostname and must be called a-head of ClientHandshake that we still need clientTransportCredentials for our use-case. I tried this and failed, so clientTransportCredentials remains in bgrpc/creds/creds.go.

Per CONTRIBUTING.md I've verified the unit tests pass:

daniel@XXXXXX:~/go/src/google.golang.org/grpc$ git show -s
commit b7f1379d3cbbbeb2ca3405852012e237aa05459e
Merge: 33731fd bac9e1d
Author: Qi Zhao <toqizhao@gmail.com>
Date:   Mon Oct 17 16:02:05 2016 -0700

    Merge pull request #903 from improbable-io/blocking-graceful-shutdown-fix
    
    Make concurrent Server.GracefulStop calls all behave equivalently.

daniel@XXXXXX:~/go/src/google.golang.org/grpc$ go test ./...
ok  	google.golang.org/grpc	0.215s
ok  	google.golang.org/grpc/benchmark	0.017s
?   	google.golang.org/grpc/benchmark/client	[no test files]
?   	google.golang.org/grpc/benchmark/grpc_testing	[no test files]
?   	google.golang.org/grpc/benchmark/server	[no test files]
?   	google.golang.org/grpc/benchmark/stats	[no test files]
?   	google.golang.org/grpc/benchmark/worker	[no test files]
?   	google.golang.org/grpc/codes	[no test files]
ok  	google.golang.org/grpc/credentials	0.041s
?   	google.golang.org/grpc/credentials/oauth	[no test files]
?   	google.golang.org/grpc/examples/helloworld/greeter_client	[no test files]
?   	google.golang.org/grpc/examples/helloworld/greeter_server	[no test files]
?   	google.golang.org/grpc/examples/helloworld/helloworld	[no test files]
?   	google.golang.org/grpc/examples/route_guide/client	[no test files]
?   	google.golang.org/grpc/examples/route_guide/routeguide	[no test files]
?   	google.golang.org/grpc/examples/route_guide/server	[no test files]
ok  	google.golang.org/grpc/grpclb	0.047s
?   	google.golang.org/grpc/grpclb/grpc_lb_v1	[no test files]
?   	google.golang.org/grpc/grpclog	[no test files]
?   	google.golang.org/grpc/grpclog/glogger	[no test files]
?   	google.golang.org/grpc/health	[no test files]
?   	google.golang.org/grpc/health/grpc_health_v1	[no test files]
?   	google.golang.org/grpc/internal	[no test files]
?   	google.golang.org/grpc/interop	[no test files]
?   	google.golang.org/grpc/interop/client	[no test files]
?   	google.golang.org/grpc/interop/grpc_testing	[no test files]
?   	google.golang.org/grpc/interop/server	[no test files]
ok  	google.golang.org/grpc/metadata	0.004s
?   	google.golang.org/grpc/naming	[no test files]
?   	google.golang.org/grpc/peer	[no test files]
ok  	google.golang.org/grpc/reflection	0.029s
?   	google.golang.org/grpc/reflection/grpc_reflection_v1alpha	[no test files]
?   	google.golang.org/grpc/reflection/grpc_testing	[no test files]
?   	google.golang.org/grpc/stress/client	[no test files]
?   	google.golang.org/grpc/stress/grpc_testing	[no test files]
?   	google.golang.org/grpc/stress/metrics_client	[no test files]
ok  	google.golang.org/grpc/test	94.693s
?   	google.golang.org/grpc/test/codec_perf	[no test files]
?   	google.golang.org/grpc/test/grpc_testing	[no test files]
ok  	google.golang.org/grpc/transport	12.574s
2016-11-29 11:07:10 -08:00
Daniel McCarney 6c983e8c9e Implements client whitelisting for gRPC. (#2307)
As described in #2282, our gRPC code uses mutual TLS to authenticate both clients and servers. However, currently our gRPC servers will accept any client certificate signed by the internal CA we use to authenticate connections. Instead, we would like each server to have a list of which clients it will accept. This will improve security by preventing the compromise of one client private key being used to access endpoints unrelated to its intended scope/purpose.

This PR implements support for gRPC servers to specify a list of accepted client names. A `serverTransportCredentials` implementing `ServerHandshake` uses a `verifyClient` function to enforce that the connecting peer presents a client certificate with a SAN entry that matches an entry on the list of accepted client names

The `NewServer` function from `grpc/server.go` is updated to instantiate the `serverTransportCredentials` used by `grpc.NewServer`, specifying an accepted names list populated from the `cmd.GRPCServerConfig.ClientNames` config field.

The pre-existing client and server certificates in `test/grpc-creds/` are replaced by versions that contain SAN entries as well as subject common names. A DNS and an IP SAN entry are added to allow testing both methods of specifying allowed SANs. The `generate.sh` script is converted to use @jsha's `minica` tool (OpenSSL CLI is blech!).

An example client whitelist is added to each of the existing gRPC endpoints in config-next/ to allow the SAN of the test RPC client certificate.

Resolves #2282
2016-11-08 13:57:34 -05:00
Roland Bracewell Shoemaker e187c92715 Add gRPC client side metrics (#2151)
Fixes #1880.

Updates google.golang.org/grpc and github.com/jmhodges/clock, both test suites pass. A few of the gRPC interfaces changed so this also fixes those breakages.
2016-09-09 15:17:36 -04:00
Roland Bracewell Shoemaker 92e0704b1b Allow gRPC clients to connect to multiple backends (#1918)
Fixes #1917 and #1755, also updates google.golang.org/grpc to b60d3e9e.
2016-06-15 16:50:56 -07:00