This repository was archived by the owner on Feb 18, 2025. It is now read-only.
Remove resetting Auth credentials in reverse-proxy#1349
Merged
shlomi-noach merged 3 commits intoopenark:masterfrom May 3, 2021
Merged
Remove resetting Auth credentials in reverse-proxy#1349shlomi-noach merged 3 commits intoopenark:masterfrom
shlomi-noach merged 3 commits intoopenark:masterfrom
Conversation
shlomi-noach
approved these changes
May 3, 2021
Collaborator
shlomi-noach
left a comment
There was a problem hiding this comment.
Thank you for the fix and for the analysis!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related issue: #979
Description
This PR removes setting Auth credentials in reverse-proxy.
@andrein was right about the fact that lines
orchestrator/go/http/raft_reverse_proxy.go
Lines 42 to 45 in d536bc6
reset auth credentials for every request going through
reverse-proxyand therefore provide this request read/write permissions even for areadonlyuser.These lines are unnecessary, because there are 3 basic scenarios:
401 Unauthorized. In this case we shouldn't care about proxying, because it never reaches the proxy."AuthenticationMethod": "multi"and a leader has"AuthenticationMethod": "basic". But that isn't a proxy problem.Testing
During the whole testing both servers had the following configuration:
{ "AuthenticationMethod": "multi", "HTTPAuthUser": "dba_team", "HTTPAuthPassword": "time_for_dinner" }Before fix behaviour (Orchestrator version built from the latest
masterstate):bash-4.2$ curl https://orch-leader:3000/api/forget-cluster/mysql-cluster -k -u readonly:123 {"Code":"ERROR","Message":"Unauthorized","Details":null} bash-4.2$ curl https://orch-follower:3000/api/forget-cluster/mysql-cluster -k -u readonly:123 {"Code":"OK","Message":"Cluster forgotten: mysql-server-1:3306","Details":null}Request to the leader is rejected, because it's executed as
readonly, but the same request sent to the follower is accepted, because its user is implicitly changed todba_teamby reverse-proxy.After fix behaviour:
bash-4.2$ curl -k https://orch-leader:3000/api/forget-cluster/mysql-cluster -u readonly:123 {"Code":"ERROR","Message":"Unauthorized","Details":null} bash-4.2$ curl -k https://orch-follower:3000/api/forget-cluster/mysql-cluster -u readonly:123 {"Code":"ERROR","Message":"Unauthorized","Details":null}Since credentials are not rewritten by reverse-proxy, both requests produce expected results.
To ensure that we didn't break actual functionality, let's execute a valid request through a follower:
bash-4.2$ curl -k https://orch-follower:3000/api/forget-cluster/mysql-cluster -u dba_team:time_for_dinner {"Code":"OK","Message":"Cluster forgotten: mysql-server-1:3306","Details":null}It shows that the request was relayed and executed successfully.