fix: Add RequestSharedSecret job if local server should start the exchange#54372
Draft
fix: Add RequestSharedSecret job if local server should start the exchange#54372
Conversation
…hange When the local server is asked to request the shared secret from a remote server the local server refuses to do it if the local server has a higher token and is therefore the one expected to start the shared secret exchange. However, if the local server no longer had a RequestSharedSecret job the local server never started the exchange. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Contributor
#53760 is taking care of removing the jobs. Always clearing the jobs , by server url, when adding a new one also sounds good. I didn't think about that back then. Feel free to give it a test/review/approval or cherry-pick if you have further improvements. |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Follow up to #44771
Related to #39941 (which provides a detailed description of how servers are trusted)
When the local server is asked to request the shared secret from a remote server the local server refuses to do it if the local server has a higher token and is therefore the one expected to start the shared secret exchange. However, if the local server no longer had a
RequestSharedSecretjob the local server never started the exchange.TODO
How to test
overwrite.cli.urlin both servers to the appropriate valueauth.bruteforce.protection.enabledtofalse(this is not needed to test in master as the delays in requests were removed, but it would be still needed to test in the stable branches)$token = $this->secureRandom->generate(16);with$token = 'zzz';inserver/apps/federation/lib/TrustedServers.php
Line 56 in 2a0cb8d
RequestSharedSecretin server 1:occ background-job:list --class 'OCA\Federation\BackgroundJob\RequestSharedSecret'occ background-job:execute ID_FOUND_IN_PREVIOUS_COMMANDRequestSharedSecretjob)$token = 'zzz';with$token = 'aaa';inserver/apps/federation/lib/TrustedServers.php
Line 56 in 2a0cb8d
RequestSharedSecretjob 6 times in server 2Result with this pull request
There is a
RequestSharedSecretjob in server 1 to ask server 2 to request the shared secretResult without this pull request
There are no
RequestSharedSecretjobs (norGetSharedSecretjobs) in any server, so trusting the servers will never complete