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

[Backport 2.x] [Multiple Datasources] Add TLS configuration for multiple data sources (#6171) #6244

Merged
merged 1 commit into from
Mar 29, 2024

Conversation

cwperks
Copy link
Member

@cwperks cwperks commented Mar 22, 2024

Manual backport of #6171 to 2.x.

opensearch-project#6171)

* Add TLS configuration for multiple data sources

Signed-off-by: Craig Perkins <[email protected]>

* Add to CHANGELOG and add examples commented out in opensearch_dashboards.yml

Signed-off-by: Craig Perkins <[email protected]>

* Add tests and replace instance of any

Signed-off-by: Craig Perkins <[email protected]>

* Add tls config to legacy client

Signed-off-by: Craig Perkins <[email protected]>

* Add test for certificate mode

Signed-off-by: Craig Perkins <[email protected]>

* Respond to PR feedback

Signed-off-by: Craig Perkins <[email protected]>

* Extract readCertificateAuthorities to util file and add more tests

Signed-off-by: Craig Perkins <[email protected]>

---------

Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
(cherry picked from commit a9b400e)
Copy link

codecov bot commented Mar 22, 2024

Codecov Report

Attention: Patch coverage is 83.72093% with 7 lines in your changes are missing coverage. Please review.

Project coverage is 67.27%. Comparing base (fcf1dbb) to head (598fa92).
Report is 1 commits behind head on 2.x.

Files Patch % Lines
...plugins/data_source/server/client/client_config.ts 78.57% 1 Missing and 2 partials ⚠️
...plugins/data_source/server/legacy/client_config.ts 78.57% 1 Missing and 2 partials ⚠️
...s/data_source/server/util/tls_settings_provider.ts 93.33% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##              2.x    #6244   +/-   ##
=======================================
  Coverage   67.26%   67.27%           
=======================================
  Files        3335     3336    +1     
  Lines       64580    64623   +43     
  Branches    10327    10337   +10     
=======================================
+ Hits        43441    43475   +34     
- Misses      18635    18638    +3     
- Partials     2504     2510    +6     
Flag Coverage Δ
Linux_1 31.30% <ø> (ø)
Linux_2 55.39% <ø> (ø)
Linux_3 44.75% <83.72%> (+0.04%) ⬆️
Linux_4 35.31% <ø> (ø)
Windows_1 31.33% <ø> (ø)
Windows_2 55.35% <ø> (ø)
Windows_3 44.75% <83.72%> (+0.05%) ⬆️
Windows_4 35.31% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@zhongnansu zhongnansu left a comment

Choose a reason for hiding this comment

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

lgtm

Comment on lines +288 to +290
# To disregard the validity of SSL certificates for connected data sources, change this setting's value to 'none'.
# Possible values include full, certificate and none
#data_source.ssl.verificationMode: full
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are these explained in a README doc?

Copy link
Member Author

Choose a reason for hiding this comment

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

@AMoo-Miki Where do you think would be best to document this? These settings are already defined for the default opensearch via the settings opensearch.ssl.verificationMode and opensearch.ssl.certificationAuthorities and this PR extends those to datasources. These settings would be commonly used for all configured datasources, although I filed another issue on per datasource configuration.

Here are the analogous entries for default OpenSearch.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Adding some more info to src/plugins/data_source/README would be great. As a user, I find OSD's documentation very inadequate and this small step would help users find answers sooner.

Comment on lines +39 to +41
certificateAuthorities: schema.maybe(
schema.oneOf([schema.string(), schema.arrayOf(schema.string(), { minSize: 1 })])
),
Copy link
Collaborator

Choose a reason for hiding this comment

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

The minSize unnecessarily complicates this; why should we not consider a blank array as undefined?

Copy link
Member Author

@cwperks cwperks Mar 25, 2024

Choose a reason for hiding this comment

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

This is the same as the client for default opensearch. The ways its implemented in this PR handles empty as you describe, so minSize can be removed here, but I had this here to keep it consistent with the other place its defined for default opensearch.

Copy link
Collaborator

Choose a reason for hiding this comment

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

That is great. i think we can progressively enhance these. I am glad to hear that the code can handle that case.

@cwperks
Copy link
Member Author

cwperks commented Mar 26, 2024

@AMoo-Miki Is there anything you'd like me to change in this backport or on main first and then into this backport?

@AMoo-Miki
Copy link
Collaborator

@AMoo-Miki Is there anything you'd like me to change in this backport or on main first and then into this backport?

@cwperks let's deal with it in a separate PR and backport.

@ZilongX ZilongX merged commit 43440c3 into opensearch-project:2.x Mar 29, 2024
85 of 86 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants