Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TLS support for HTTP API of Query server #2337

Merged
merged 39 commits into from
Jan 19, 2021
Merged

TLS support for HTTP API of Query server #2337

merged 39 commits into from
Jan 19, 2021

Conversation

rjs211
Copy link
Contributor

@rjs211 rjs211 commented Jul 9, 2020

Which problem is this PR solving?

Short description of the changes

  • Similar to PR TLS support for gRPC Query server #2297 .

  • independent TLS flags are exposed for gRPC and HTTP endpoints, enabling the user to provide different set of key, cert, CA-Cert , etc for each communication channal.

  • provides the option of enabling TLS/mTLS in none, either one or both of HTTP and gRPC endpoints.

  • forces the user to use dedicated HTTP and gRPC ports if TLS is enabled in any of the endpoints.

Signed-off-by: rjs211 <srivatsa211@gmail.com>
Signed-off-by: rjs211 <srivatsa211@gmail.com>
@rjs211 rjs211 requested a review from a team as a code owner July 9, 2020 07:18
@rjs211 rjs211 requested a review from jpkrohling July 9, 2020 07:18
Copy link
Contributor

@jpkrohling jpkrohling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As @yurishkuro mentioned in Gitter, there's a bug in the current code, causing the flags to not be exposed. You'll need to add the following to the flags.go, #AddFlags method:

	tlsGrpcFlagsConfig.AddFlags(flagSet)
	tlsHttpFlagsConfig.AddFlags(flagSet)

Please, fix the naming of the properties and vars as well: gRPC should be always GRPC and Http should be HTTP. Other than that, looks good to me.

cmd/query/app/flags.go Outdated Show resolved Hide resolved
cmd/query/app/flags.go Outdated Show resolved Hide resolved
cmd/query/app/flags.go Outdated Show resolved Hide resolved
cmd/query/app/flags.go Outdated Show resolved Hide resolved
cmd/query/app/flags.go Outdated Show resolved Hide resolved
cmd/query/app/server_test.go Show resolved Hide resolved
cmd/query/app/server_test.go Show resolved Hide resolved
cmd/query/app/server_test.go Show resolved Hide resolved
@jpkrohling
Copy link
Contributor

We may want to hold on merging this before #2338 is sorted out.

Signed-off-by: rjs211 <srivatsa211@gmail.com>
Signed-off-by: rjs211 <srivatsa211@gmail.com>
@yurishkuro
Copy link
Member

Please describe if/how you performed the real integration test that uses certificates. Would be nice to add those to the suite of integration tests in the CI.

Signed-off-by: rjs211 <srivatsa211@gmail.com>
Signed-off-by: rjs211 <srivatsa211@gmail.com>
Signed-off-by: rjs211 <srivatsa211@gmail.com>
Signed-off-by: rjs211 <srivatsa211@gmail.com>
@tcolgate
Copy link
Contributor

tcolgate commented Jul 13, 2020 via email

@rjs211 rjs211 closed this Jul 15, 2020
@rjs211 rjs211 reopened this Jul 15, 2020
@codecov
Copy link

codecov bot commented Jul 15, 2020

Codecov Report

Merging #2337 (1bee20f) into master (e788e55) will increase coverage by 0.08%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2337      +/-   ##
==========================================
+ Coverage   95.73%   95.81%   +0.08%     
==========================================
  Files         216      216              
  Lines        9593     9615      +22     
==========================================
+ Hits         9184     9213      +29     
+ Misses        336      332       -4     
+ Partials       73       70       -3     
Impacted Files Coverage Δ
cmd/query/app/flags.go 100.00% <100.00%> (ø)
cmd/query/app/server.go 97.12% <100.00%> (+8.59%) ⬆️
...lugin/sampling/strategystore/adaptive/processor.go 99.07% <0.00%> (-0.93%) ⬇️
plugin/storage/integration/integration.go 77.34% <0.00%> (-0.56%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e788e55...1bee20f. Read the comment docs.

jpkrohling
jpkrohling previously approved these changes Oct 22, 2020
Copy link
Contributor

@jpkrohling jpkrohling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I'll leave it open for a day, to see if other maintainers want to review it as well.

cmd/query/app/flags.go Show resolved Hide resolved
cmd/query/app/server.go Outdated Show resolved Hide resolved
cmd/query/app/server.go Outdated Show resolved Hide resolved
@jpkrohling
Copy link
Contributor

@rjs211 are you still interested in working on this one?

@mergify mergify bot dismissed jpkrohling’s stale review November 10, 2020 18:39

Pull request has been modified.

@davidcmitchell
Copy link

@rjs211 Are you still working on this issue?

@rjs211
Copy link
Contributor Author

rjs211 commented Jan 7, 2021

I had finished this task and all the test cases had passed. I had received one approval and was waiting for a second one. I see now that in the meantime the branch is our of date with master. I'll start working on this again.

@rjs211 rjs211 requested a review from jpkrohling January 7, 2021 23:41
@jpkrohling
Copy link
Contributor

Is this ready for a review?

@rjs211
Copy link
Contributor Author

rjs211 commented Jan 12, 2021

Yes. It is. There weren't any merge conflicts. Ready for review.

@jpkrohling
Copy link
Contributor

I'll take another look tomorrow! Thanks for working on this one.

@jpkrohling
Copy link
Contributor

Sorry, didn't have time to look into this yet, but should be able to look at this at most early next week.

Copy link
Contributor

@jpkrohling jpkrohling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you like to give a final review, @yurishkuro ? From my perspective, this can be merged already.

@yurishkuro yurishkuro mentioned this pull request Jan 19, 2021
5 tasks
@yurishkuro yurishkuro merged commit f22db05 into jaegertracing:master Jan 19, 2021
@yurishkuro
Copy link
Member

@rjs211 thanks! Could you add another PR that describes these changes in the CHANGELOG? This change is not as straightforward as the PR title implies, due to the tricky handling of separate ports.

yurishkuro added a commit to jaegertracing/documentation that referenced this pull request Jan 19, 2021
bhiravabhatla pushed a commit to bhiravabhatla/jaeger that referenced this pull request Jan 25, 2021
* Added TLS for HTTP (consumer-query) server

Signed-off-by: rjs211 <srivatsa211@gmail.com>

* Add testcase of error in TLS HTTP server creation

Signed-off-by: rjs211 <srivatsa211@gmail.com>

* Minor refactoring of properties and vars

Signed-off-by: rjs211 <srivatsa211@gmail.com>

* Exposing flags for HTTP and GRPC with TLS config

Signed-off-by: rjs211 <srivatsa211@gmail.com>

* minor refactoring of comments

Signed-off-by: rjs211 <srivatsa211@gmail.com>

* Changed TLS server to use tlsCfg instead of injection

Signed-off-by: rjs211 <srivatsa211@gmail.com>

* Create test for HTTP server with TLS and MTLS

Signed-off-by: rjs211 <srivatsa211@gmail.com>

* Removing checks to avoid race condition

Signed-off-by: rjs211 <srivatsa211@gmail.com>

* Adding testdata of certificates and keys of CA, server & client

Signed-off-by: rjs211 <srivatsa211@gmail.com>

* Changing the names of keys and certificates

Signed-off-by: rjs211 <srivatsa211@gmail.com>

* Coverage increase and cleanup

Signed-off-by: rjs211 <srivatsa211@gmail.com>

* removing redundant certif/keys set  and using previously available set

Signed-off-by: rjs211 <srivatsa211@gmail.com>

* Added helper function to serve HTTP server

Signed-off-by: rjs211 <srivatsa211@gmail.com>

* Modify cmux and tests for secure HTTP and GRPC

Signed-off-by: rjs211 <srivatsa211@gmail.com>

* Fixing testscases for safe re-use

Signed-off-by: rjs211 <srivatsa211@gmail.com>

* Use common certificate flags for GRPC and HTTP

Signed-off-by: rjs211 <srivatsa211@gmail.com>

* Use common certificate flags for GRPC and HTTP

Signed-off-by: rjs211 <srivatsa211@gmail.com>

* tempCommit

Signed-off-by: rjs211 <srivatsa211@gmail.com>

* Using same tlsCfg structure for server

Signed-off-by: rjs211 <srivatsa211@gmail.com>

* Removing reduntant code, added comments, using correct port for testing

Signed-off-by: rjs211 <srivatsa211@gmail.com>

* modified test-cases for dedicated ports with TLS

Signed-off-by: rjs211 <srivatsa211@gmail.com>

* remove redundant test, created error var

Signed-off-by: rjs211 <srivatsa211@gmail.com>

* remove redundant test, created error var

Signed-off-by: rjs211 <srivatsa211@gmail.com>

* removed code repitition, added comment

Signed-off-by: rjs211 <srivatsa211@gmail.com>

* added table-based tests for QueryOptions port allocation

Signed-off-by: rjs211 <srivatsa211@gmail.com>
@rjs211
Copy link
Contributor Author

rjs211 commented Jan 27, 2021

@yurishkuro Hello, and apologies for delayed response. My personal laptop was under repair. I was looking at the entries in https://github.com/jaegertracing/jaeger/blob/master/CHANGELOG.md and they seem to be one liners without much detail. Could you please show me an example where some logic is explained?

Would writing a documentation help? If so, could you please direct me to the correct place to write the same? Thanks.

@yurishkuro
Copy link
Member

See, for example, the Breaking Changes section in https://github.com/jaegertracing/jaeger/blob/master/CHANGELOG.md#1200-2020-09-29

We don't need to explain the logic, but what is changing and how those changes affect users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

gRPC with TLS doesn't work with cmux in mixed mode
5 participants