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

Add admin authentication to dashboards api/status #2117

Merged
merged 3 commits into from
May 13, 2022

Conversation

zelinh
Copy link
Member

@zelinh zelinh commented May 12, 2022

Signed-off-by: Zelin Hao [email protected]

Description

Fixed the authentication for api/status

Issues Resolved

Part of #2112

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@zelinh zelinh requested a review from a team as a code owner May 12, 2022 23:36
@codecov-commenter
Copy link

codecov-commenter commented May 12, 2022

Codecov Report

Merging #2117 (3130b96) into main (28d5c7b) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##               main    #2117   +/-   ##
=========================================
  Coverage     94.21%   94.21%           
  Complexity       25       25           
=========================================
  Files           204      204           
  Lines          3943     3943           
  Branches         29       29           
=========================================
  Hits           3715     3715           
  Misses          222      222           
  Partials          6        6           
Impacted Files Coverage Δ
...rkflow/integ_test/service_opensearch_dashboards.py 96.00% <100.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 28d5c7b...3130b96. Read the comment docs.

@zelinh zelinh force-pushed the change-sec-auth branch from a1b561d to 655aa1e Compare May 12, 2022 23:45
@@ -68,7 +68,7 @@ def url(self, path=""):
def get_service_response(self):
url = self.url("/api/status")
logging.info(f"Pinging {url}")
return requests.get(url, verify=False, auth=("kibanaserver", "kibanaserver") if self.security_enabled else None)
return requests.get(url, verify=False, auth=("admin", "admin"))
Copy link
Member

Choose a reason for hiding this comment

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

This is not correct you should not change the behavior of how to handle enabled security plugin, rather than only focus on the api/status I think.

Copy link
Member

Choose a reason for hiding this comment

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

Also need @cliu123 to chime in on whether api/status requires admin:admin, or kibanaserver:kibanaserver is enough.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, kibanaserver:kibanaserver is good enough. Basically, any valid credential will go through authentication here. There is no authorization enforced here, so it doesn't matter what roles a user has. As long as the credential provided is valid, request goes through.

Copy link
Member

Choose a reason for hiding this comment

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

Hey @cliu123 the kibanaserver user is commented out on default setup
https://github.com/opensearch-project/security/blob/main/securityconfig/config.yml#L71
So correct me if i'm wrong kibanaserver:kibanaserver wont work I guess, unless we enable the right role for the index?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Thanks @cliu123 for the clarification here.
@zelinh please restore.

Thanks.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks all for the inputs here. Reverted the changes here on integ test.
@peterzhuamazon Please help review again.

mock_requests_get.assert_called_once_with(mock_url_result, verify=False, auth=("kibanaserver", "kibanaserver"))
mock_requests_get.assert_called_once_with(mock_url_result, verify=False, auth=("admin", "admin"))
Copy link
Member

Choose a reason for hiding this comment

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

Same as above.

Copy link
Member

@peterzhuamazon peterzhuamazon left a comment

Choose a reason for hiding this comment

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

Some questions, block for now until it is cleared.

@peterzhuamazon peterzhuamazon merged commit 918d4b3 into opensearch-project:main May 13, 2022
@peterzhuamazon peterzhuamazon deleted the change-sec-auth branch May 13, 2022 19:09
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.

[Question] How to approach api/status api/reporting/stats route authentication addition in future releases
5 participants