Extract gRPC TLS configuration into a shared package#1840
Extract gRPC TLS configuration into a shared package#1840yurishkuro merged 10 commits intojaegertracing:masterfrom
Conversation
Signed-off-by: Yuri Shkuro <ys@uber.com>
Signed-off-by: Yuri Shkuro <ys@uber.com>
Signed-off-by: Yuri Shkuro <ys@uber.com>
jpkrohling
left a comment
There was a problem hiding this comment.
Is this ready for review? If so, what's the deal with the commented out tests?
Signed-off-by: Yuri Shkuro <ys@uber.com>
Signed-off-by: Yuri Shkuro <ys@uber.com>
Signed-off-by: Yuri Shkuro <ys@uber.com>
| flags.String(collectorTLSCA, "", "Path to a TLS CA file used to verify the remote server. (default use the systems truststore)") | ||
| flags.String(collectorTLSServerName, "", "Override the TLS server name we expected in the remote certificate") | ||
| flags.String(agentCert, "", "Path to a TLS client certificate file, used to identify this agent to the collector") | ||
| flags.String(agentKey, "", "Path to the TLS client key for the client certificate") |
There was a problem hiding this comment.
Now:
$ go run ./cmd/agent help | grep tls
--reporter.grpc.tls Enable TLS when talking to the remote server(s)
--reporter.grpc.tls.ca string Path to a TLS CA (Certification Authority) file used to verify the remote server(s) (by default will use the system truststore)
--reporter.grpc.tls.cert string Path to a TLS Certificate file, used to identify this process to the remote server(s)
--reporter.grpc.tls.key string Path to a TLS Private Key file, used to identify this process to the remote server(s)
--reporter.grpc.tls.server-name string Override the TLS server name we expect in the certificate of the remove server(s)
Signed-off-by: Yuri Shkuro <ys@uber.com>
Codecov Report
@@ Coverage Diff @@
## master #1840 +/- ##
==========================================
+ Coverage 98.21% 98.44% +0.22%
==========================================
Files 195 197 +2
Lines 9603 9619 +16
==========================================
+ Hits 9432 9469 +37
+ Misses 134 114 -20
+ Partials 37 36 -1
Continue to review full report at Codecov.
|
| flags.Bool(collectorGRPCTLS, false, "Enable TLS for the gRPC collector port") | ||
| flags.String(collectorGRPCCert, "", "Path to TLS certificate for the gRPC collector TLS service") | ||
| flags.String(collectorGRPCKey, "", "Path to TLS key for the gRPC collector TLS cert") | ||
| flags.String(collectorGRPCClientCA, "", "Path to a TLS CA to verify certificates presented by clients (if unset, all clients are permitted)") |
There was a problem hiding this comment.
now:
$ go run ./cmd/collector help | grep grpc.tls
--collector.grpc.tls Enable TLS on the server
--collector.grpc.tls.cert string Path to a TLS Certificate file, used to identify this server to clients
--collector.grpc.tls.client-ca string Path to a TLS CA (Certification Authority) file used to verify certificates presented by clients (if unset, all clients are permitted)
--collector.grpc.tls.client.ca string (deprecated) see --collector.grpc.tls.client-ca
--collector.grpc.tls.key string Path to a TLS Private Key file, used to identify this server to clients
Signed-off-by: Yuri Shkuro <ys@uber.com>
Signed-off-by: Yuri Shkuro <ys@uber.com>
Signed-off-by: Yuri Shkuro <ys@uber.com>
Sorry, I pushed as WIP to show @backjo the approach I was taking. It's now ready for review. |
| } | ||
| } else { | ||
| require.Error(t, err) | ||
| assert.Contains(t, err.Error(), test.expectedError) |
There was a problem hiding this comment.
There was a problem hiding this comment.
That function performs exact comparison of the error message. Since the error is wrapped multiple times, the message consists of multiple segments. I don't know or care what the underlying stdlib error was, I only care about the substring introduced by the code under test.
) * Extract TLS flags and cert loading logic Signed-off-by: Yuri Shkuro <ys@uber.com> * Rename package Signed-off-by: Yuri Shkuro <ys@uber.com> * Refactor grpc Signed-off-by: Yuri Shkuro <ys@uber.com> * Repair tests Signed-off-by: Yuri Shkuro <ys@uber.com> * Refactor gRPC server in collector Signed-off-by: Yuri Shkuro <ys@uber.com> * Add ShowCA option Signed-off-by: Yuri Shkuro <ys@uber.com> * Switch options order Signed-off-by: Yuri Shkuro <ys@uber.com> * Separate client and server TLS options Signed-off-by: Yuri Shkuro <ys@uber.com> * Update usage Signed-off-by: Yuri Shkuro <ys@uber.com> * Rename test, add filepath.Clean Signed-off-by: Yuri Shkuro <ys@uber.com> Signed-off-by: Jonah Back <jonah@jonahback.com>
Part of #1837
Moves TLS configuration from gRPC client (agent) and server (collector) into a shared package
pkg/config/tlscfg. This allows fewer unit tests to be written for the call sites, since all error handling of TLS certificates loading is covered in the new package.