Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Rest mutual auth fix #279

Merged

Conversation

sidheart
Copy link
Contributor

@sidheart sidheart commented Jul 16, 2020

Issue #, if available: #278
Description of changes: Adds configurable auth to REST endpoints

Tests: TestNetServer

Code coverage percentage for this patch: See CodeCov report

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Sid Narayan added 6 commits July 21, 2020 11:12
Previously we had 1 sided TLS on the server side. Data between the
client and server was send over an encrypted channel, but any client
could make requests to the server.

This commit changes the behavior so that only clients with the matching
certificates can make requests to the server when TLS is enabled. This
commit does NOT add support for installing a trust manager. That must be
added in the future.
This commit makes the PerformanceAnalyzerWebServer authenticate clients
if the user specifies a certificate authority. It also properly sets up
the server's identity, so that any clients can authenticate the server.
@sidheart sidheart force-pushed the rest-mutual-auth-fix branch from 67d53d5 to 8894129 Compare July 21, 2020 18:23
@codecov
Copy link

codecov bot commented Jul 21, 2020

Codecov Report

Merging #279 into master will increase coverage by 0.44%.
The diff coverage is 91.30%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #279      +/-   ##
============================================
+ Coverage     66.71%   67.16%   +0.44%     
- Complexity     1869     1882      +13     
============================================
  Files           276      276              
  Lines         12307    12338      +31     
  Branches        982      983       +1     
============================================
+ Hits           8211     8287      +76     
+ Misses         3764     3718      -46     
- Partials        332      333       +1     
Impacted Files Coverage Δ Complexity Δ
...icsearch/performanceanalyzer/CertificateUtils.java 84.21% <88.88%> (+50.06%) 16.00 <3.00> (+8.00)
...formanceanalyzer/PerformanceAnalyzerWebServer.java 73.97% <92.30%> (+52.30%) 9.00 <1.00> (+5.00)
...rch/performanceanalyzer/config/PluginSettings.java 31.25% <100.00%> (+1.25%) 15.00 <1.00> (+1.00)
...csearch/performanceanalyzer/rca/RcaController.java 81.11% <0.00%> (-0.56%) 38.00% <0.00%> (-1.00%)

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 dbd8675...dea63c4. Read the comment docs.

Copy link
Contributor

@ktkrg ktkrg left a comment

Choose a reason for hiding this comment

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

LGTM. One minor whitespace nit.

* ClientAuthConfigurator makes the server perform client authentication if the user has set up a
* certificate authority
*/
private static class ClientAuthConfigurator extends HttpsConfigurator {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: additional space. static class -> static class

@ktkrg
Copy link
Contributor

ktkrg commented Jul 24, 2020

One more thing, can you link the issue by changing #278 in the description to Fixes #278 ?

server.setHttpsConfigurator(new ClientAuthConfigurator(sslContext));


// TODO ask ktkrg why this is necessary
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you plan to wrap up the TODO in this PR or in a follow up ?

@yojs yojs self-requested a review July 27, 2020 17:10
@yojs yojs added the enhancement Enhancements to existing codebase label Jul 27, 2020
@sidheart sidheart merged commit 9152a23 into opendistro-for-elasticsearch:master Jul 27, 2020
@sidheart sidheart deleted the rest-mutual-auth-fix branch July 27, 2020 17:37
@sidheart sidheart linked an issue Jul 30, 2020 that may be closed by this pull request
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Enhancements to existing codebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Configurable Mutual Auth to REST endpoints
3 participants