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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple authentication methods #825

Merged

Conversation

fmeum
Copy link
Member

@fmeum fmeum commented Jun 1, 2020

馃摙 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

馃摐 Description

Add support for multiple authentication methods by offering password authentication after public key authentication.

Along the way, refactor GitOperation to use a (somewhat) proper builder
pattern. This uncovered that we were previously not using SSHJ for the
case of no authentication, which is now rectified.

馃挕 Motivation and Context

Fixes #333, fixes #548 and fixes #782 if it works.

馃挌 How did you test it?

I lack the setup to test this properly and only verified that SSH public key authentication by itself still works as expected. Password authentication, public key followed by password authentication and no authentication still need testing.

馃摑 Checklist

  • I formatted the code with the IDE's reformat action (Ctrl + Shift + L/Cmd + Shift + L)
  • I reviewed submitted code

馃敭 Next steps

馃摳 Screenshots / GIFs

@msfjarvis msfjarvis self-assigned this Jun 1, 2020
@msfjarvis msfjarvis added this to the 1.9.0 milestone Jun 1, 2020
@msfjarvis
Copy link
Member

msfjarvis commented Jun 2, 2020

I can't get this to work for me. After setting AuthenticationMethods publickey,password in my sshd_config, trying to clone my repository with the SSH Key connection mode fails here

https://github.com/android-password-store/Android-Password-Store/pull/825/files#diff-efe0564ca4779571d8e3340b0d88a26dR43 Ugh, didn't work. GitOperation.kt, line 43.

@fmeum
Copy link
Member Author

fmeum commented Jun 2, 2020

I can't get this to work for me. After setting AuthenticationMethods publickey,password in my sshd_config, trying to clone my repository with the SSH Key connection mode fails here

https://github.com/android-password-store/Android-Password-Store/pull/825/files#diff-efe0564ca4779571d8e3340b0d88a26dR43 Ugh, didn't work. GitOperation.kt, line 43.

Sorry, that require shouldn't have made it in in that form: #826.

@msfjarvis
Copy link
Member

Doesn't throw anymore but still doesn't seem to work, tried both my SSH key as well as password and SSHJ always fails saying all authentication methods were exhausted. I'll try to debug some more on my end...

@msfjarvis
Copy link
Member

uhh

@msfjarvis msfjarvis reopened this Jun 2, 2020
@msfjarvis
Copy link
Member

@FabianHenneke can you rebase this and #807 when you get a chance? I have the weekend off so I'm going to try and create a docker setup to allow me to test this.

@fmeum
Copy link
Member Author

fmeum commented Jun 13, 2020

@FabianHenneke can you rebase this and #807 when you get a chance? I have the weekend off so I'm going to try and create a docker setup to allow me to test this.

Done, but EDCSA keys remain broken for now. Everything else should work as before.

@msfjarvis msfjarvis modified the milestones: 1.9.0, 1.10.0 Jun 17, 2020
@msfjarvis msfjarvis closed this Jun 24, 2020
@msfjarvis msfjarvis reopened this Jun 24, 2020
@msfjarvis msfjarvis changed the base branch from master to develop June 24, 2020 19:00
@msfjarvis msfjarvis removed this from the 1.10.0 milestone Jul 16, 2020
@msfjarvis msfjarvis removed the blocked label Aug 17, 2020
@msfjarvis msfjarvis added this to the 1.12.0 milestone Aug 17, 2020
@msfjarvis
Copy link
Member

@FabianHenneke would you be able to rebase this some time over the next week? Should leave us enough time to be able to review and test this before the September release.

@fmeum fmeum force-pushed the fhenneke_multiple_ssh branch 2 times, most recently from 545e4e7 to c5dd328 Compare September 7, 2020 07:56
@fmeum
Copy link
Member Author

fmeum commented Sep 7, 2020

@FabianHenneke would you be able to rebase this some time over the next week? Should leave us enough time to be able to review and test this before the September release.

Please review and merge #1084 first.
We are currently offering password authentication implicitly after publickey authentication in both possible cases: As a follow-up authentication mode when publickey auth succeeded and as an alternative authentication mode when it failed. I don't think there is an easy way to differntiate between the two without delving into SSHJ internals, so we should first agree on whether this behavior is okay or not.

@msfjarvis
Copy link
Member

@FabianHenneke would you be able to rebase this some time over the next week? Should leave us enough time to be able to review and test this before the September release.

Please review and merge #1084 first.
We are currently offering password authentication implicitly after publickey authentication in both possible cases: As a follow-up authentication mode when publickey auth succeeded and as an alternative authentication mode when it failed. I don't think there is an easy way to differntiate between the two without delving into SSHJ internals, so we should first agree on whether this behavior is okay or not.

I think it's acceptable. I assume we'd only be offering password authentication for servers that do advertise password or keyboard-interactive authentication methods alongside publickey?

@fmeum
Copy link
Member Author

fmeum commented Sep 7, 2020

@FabianHenneke would you be able to rebase this some time over the next week? Should leave us enough time to be able to review and test this before the September release.

Please review and merge #1084 first.
We are currently offering password authentication implicitly after publickey authentication in both possible cases: As a follow-up authentication mode when publickey auth succeeded and as an alternative authentication mode when it failed. I don't think there is an easy way to differntiate between the two without delving into SSHJ internals, so we should first agree on whether this behavior is okay or not.

I think it's acceptable. I assume we'd only be offering password authentication for servers that do advertise password or keyboard-interactive authentication methods alongside publickey?

That should be true based on my understanding of the SSHJ code, but I don't have the setup to test it properly.

@fmeum
Copy link
Member Author

fmeum commented Sep 7, 2020

Maybe we should rethink our AuthMode switches though. If we could make the switches shown depend on whether or not the URL starts with http:// or https://, we could show either a choice between "Password" and "None" (HTTP) or "Public key", "Public key (via OpenKeychain)" or "Password only" (SSH).

@msfjarvis
Copy link
Member

Maybe we should rethink our AuthMode switches though. If we could make the switches shown depend on whether or not the URL starts with http:// or https://, we could show either a choice between "Password" and "None" (HTTP) or "Public key", "Public key (via OpenKeychain)" or "Password only" (SSH).

Should certainly not be impossible, I can take a stab at it. Do you want it to go in with this PR?

@fmeum
Copy link
Member Author

fmeum commented Sep 7, 2020

Maybe we should rethink our AuthMode switches though. If we could make the switches shown depend on whether or not the URL starts with http:// or https://, we could show either a choice between "Password" and "None" (HTTP) or "Public key", "Public key (via OpenKeychain)" or "Password only" (SSH).

Should certainly not be impossible, I can take a stab at it. Do you want it to go in with this PR?

I would prefer to have this go in as is. The other change would be almost purely UI-related while this does not touch the UI at all, so I would prefer them to remain separate.

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
@msfjarvis msfjarvis mentioned this pull request Sep 7, 2020
8 tasks
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
* ux-improvements:
  DecryptActivity: hide menu items until decrypt finishes
  Address review comments
  GitCommandExecutor: cleanup and address build warning
  Hide unsupported authentication methods
  git: re-add back button handling
@msfjarvis
Copy link
Member

I tried cloning from a server which only had password authentication after setting authentication mode to SSH key in the app and did not get prompted for a password, but from my understanding of the changes here, that shouldn't have been the case?

@fmeum
Copy link
Member Author

fmeum commented Sep 8, 2020

I tried cloning from a server which only had password authentication after setting authentication mode to SSH key in the app and did not get prompted for a password, but from my understanding of the changes here, that shouldn't have been the case?

Yes, if that doesn't work and there is nothing else that's wrong here, then I fear sshj doesn't properly deal with multiple auth methods.

Could you send me the sshj log output?

* develop:
  Use same checks as BiometricAuthenticator in UserPreference (android-password-store#1088)
  UX fixups and improvements (android-password-store#1086)
@msfjarvis
Copy link
Member

I tried cloning from a server which only had password authentication after setting authentication mode to SSH key in the app and did not get prompted for a password, but from my understanding of the changes here, that shouldn't have been the case?

Yes, if that doesn't work and there is nothing else that's wrong here, then I fear sshj doesn't properly deal with multiple auth methods.

Could you send me the sshj log output?

Obviously simply taking a log made it behave 馃槕

msfjarvis
msfjarvis previously approved these changes Sep 8, 2020
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
@msfjarvis msfjarvis merged commit 9e0fb93 into android-password-store:develop Sep 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants