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

[BUG] Can't sync on server with ssh #782

Closed
martini97 opened this issue May 15, 2020 · 18 comments · Fixed by #825
Closed

[BUG] Can't sync on server with ssh #782

martini97 opened this issue May 15, 2020 · 18 comments · Fixed by #825
Assignees

Comments

@martini97
Copy link

Describe the bug
My remote server uses publickey and password for ssh authentication (it was using OTP as well, but since it looks like this project does not support it, I've disabled it for my passtore user). When I try to sync my password store I get this message:

An error occurred during a Git operation
Error occurred during the sync operation,
Please check the FAQ for possible reasons why this error might occur.Message from jgit:
Attempt to get length of null array
Caused by:
null

To Reproduce
Steps to reproduce the behavior:

  1. Setup server to use public key and password for ssh auth
  2. Add server info on git server settings (I can't choose both SSH key and password, so I marked SSH key)
  3. Try to sync the repo
  4. See error

Expected behavior
Sync passwords

Device information (please complete the following information):

  • Device: Motorola G5
  • OS: 8.1.0
  • App version: 1.7.2
@msfjarvis
Copy link
Member

We currently only support RSA keys for authentication, is your key using ED25519?

@msfjarvis msfjarvis added this to the v1.8.0 milestone May 15, 2020
@msfjarvis msfjarvis self-assigned this May 15, 2020
@martini97
Copy link
Author

We currently only support RSA keys for authentication, is your key using ED25519?

I'm using the key generated on the app, it's a RSA

@martini97
Copy link
Author

For debugging I've disabled password, so for now this user should only require the SSH key for login in, but I'm still getting an error:
image
Looking at my sshd logs I get:

May 15 19:18:09 <my host> sshd[496949]: Connection from <my phone ip> port 49106 on <my server ip> port <my ssh port> rdomain ""
May 15 19:18:10 <my host> sshd[496949]: Accepted key RSA SHA256:<my ssh key> found at /home/<my user>/.ssh/authorized_keys:2
May 15 19:18:10 <my host> sshd[496949]: Postponed publickey for <my user> from <my phone ip> port 49106 ssh2 [preauth]
May 15 19:18:10 <my host> sshd[496949]: Accepted key RSA SHA256:<my ssh key> found at /home/<my user>/.ssh/authorized_keys:2
May 15 19:18:10 <my host> sshd[496949]: Partial publickey for <my user> from <my phone ip> port 49106 ssh2: RSA SHA256:<my ssh key>
May 15 19:18:10 <my host> sshd[496949]: error: Received disconnect from <my phone ip> port 49106:3: com.jcraft.jsch.JSchException: Auth fail [preauth]
May 15 19:18:10 <my host> sshd[496949]: Disconnected from authenticating user <my user> <my phone ip> port 49106 [preauth]

@msfjarvis
Copy link
Member

I just tried using a key generated in-app and it worked for me. If you're using the default port, then the path should probably be relative to $HOME. Try dropping the ~ and if that helps I'll adjust the logic.

@martini97
Copy link
Author

I've removed the ~ from the path, it didn't work, I've also tried generating a new key pair and still got the same error. Maybe it could be an issue with the keys permissions or the lib? I've also tried generating a key on my machine and importing it on the app, and it has issues identifying the key.

@msfjarvis
Copy link
Member

I've removed the ~ from the path, it didn't work, I've also tried generating a new key pair and still got the same error. Maybe it could be an issue with the keys permissions or the lib? I've also tried generating a key on my machine and importing it on the app, and it has issues identifying the key.

Pretty unlikely that it's an app problem, otherwise I'd be able to reproduce it in some manner. Both Linux generated and APS generated SSH keys work as intended for me so I'm a bit lost on what could be causing it.

@fmeum
Copy link
Member

fmeum commented May 17, 2020

Is it possible that JGit simply can't deal with multiple AuthMethods? Based on the logs, it does seem to send the public key, bit maybe chokes on the password then?

@msfjarvis
Copy link
Member

Is it possible that JGit simply can't deal with multiple AuthMethods? Based on the logs, it does seem to send the public key, bit maybe chokes on the password then?

The SSH part is handled by Jsch which makes this an even likelier situation. I'll try to confirm it on my end.

@msfjarvis msfjarvis removed this from the v1.8.0 milestone May 24, 2020
@msfjarvis
Copy link
Member

Sorry about the delay with this. I can't seem to reproduce this problem, but I do see a blurb about keyboard-interactive authentication in the Jsch docs so I'll probably implement that since #333 also requested that feature.

@msfjarvis msfjarvis added this to the 1.9.0 milestone May 24, 2020
@imr0
Copy link

imr0 commented May 24, 2020

Hi,
I am having a similar issue since updating to 1.8.0 and also present with 1.8.1. I have a gitlab repository for the passwords and upon trying to sync, I get
org.eclipse.jgit.errors.NoRemoteRepositoryException [insert repo path]: not found.
The repository path is the correct one and I had no issues pre-1.8.0 and works from the desktop with regular git operations.

@msfjarvis
Copy link
Member

msfjarvis commented May 24, 2020

Hi,
I am having a similar issue since updating to 1.8.0 and also present with 1.8.1. I have a gitlab repository for the passwords and upon trying to sync, I get
org.eclipse.jgit.errors.NoRemoteRepositoryException [insert repo path]: not found.
The repository path is the correct one and I had no issues pre-1.8.0 and works from the desktop with regular git operations.

That's weird... Can you hop on our Gitter room and test a couple APKs for me?

Edit: imr0's issue was caused by configuration changes between 1.7.x and 1.8.x which I've assisted him in fixing.

@msfjarvis msfjarvis modified the milestones: 1.9.0, 1.10.0 Jun 21, 2020
@msfjarvis msfjarvis assigned fmeum and unassigned msfjarvis Jun 21, 2020
@msfjarvis msfjarvis removed this from the 1.10.0 milestone Jul 16, 2020
@jfxtle
Copy link

jfxtle commented Aug 10, 2020

I can not configure correctly on the Repository information page. So what is the format of the Username and Server URL and Repo path on this page? Assuming the remote Repo is on the github.com, is the following example correct?

Server Protocol:ssh
Username:myname
Server URL:github.com:22
Repo path:git@github.com:myname/mypasswordrepo.git
Authentication Mode:ssh key

@fmeum
Copy link
Member

fmeum commented Aug 10, 2020

I can not configure correctly on the Repository information page. So what is the format of the Username and Server URL and Repo path on this page? Assuming the remote Repo is on the github.com, is the following example correct?

Server Protocol:ssh
Username:myname
Server URL:github.com:22
Repo path:git@github.com:myname/mypasswordrepo.git
Authentication Mode:ssh key

Could you try the following and report back whether it worked?

Server Protocol: ssh
Username: git
Server URL: github.com
Port: (empty)
Repo Path: myname/mypasswordrepo.git
Authentication Mode: SSH key

@msfjarvis We might want to go back to a single "Repo URL" field and maybe persist it as Base64 to work around Android limitations. Thinking about its atomic parts is just not what users are used to, it seems.

@msfjarvis
Copy link
Member

@msfjarvis We might want to go back to a single "Repo URL" field and maybe persist it as Base64 to work around Android limitations. Thinking about its atomic parts is just not what users are used to, it seems.

There's no 'going back', as the app has always had split parts, but yes we'd certainly do our users a great service by making the entire thing a single URL field.

@fmeum
Copy link
Member

fmeum commented Aug 10, 2020

There's no 'going back', as the app has always had split parts, but yes we'd certainly do our users a great service by making the entire thing a single URL field.

Well, then we can even sell it as a new feature. I don't think it would require much effort: We would replace the split fields in the config activity by a single one that by default is populated with the repo URL calculated by the current logic. As soon as a user makes an edit to it, it's simply persisted as a string and the logic isn't used anymore. This would require leaving the logic in, but would allow seamless migration. I'm somewhat busy atm, but will look into it when I have time.

@msfjarvis
Copy link
Member

msfjarvis commented Aug 10, 2020

There's no 'going back', as the app has always had split parts, but yes we'd certainly do our users a great service by making the entire thing a single URL field.

Well, then we can even sell it as a new feature. I don't think it would require much effort: We would replace the split fields in the config activity by a single one that by default is populated with the repo URL calculated by the current logic. As soon as a user makes an edit to it, it's simply persisted as a string and the logic isn't used anymore. This would require leaving the logic in, but would allow seamless migration. I'm somewhat busy atm, but will look into it when I have time.

I can work on this today. @Skrilltrax has offered to take this up.

@jfxtle
Copy link

jfxtle commented Aug 10, 2020

I can not configure correctly on the Repository information page. So what is the format of the Username and Server URL and Repo path on this page? Assuming the remote Repo is on the github.com, is the following example correct?
Server Protocol:ssh
Username:myname
Server URL:github.com:22
Repo path:git@github.com:myname/mypasswordrepo.git
Authentication Mode:ssh key

Could you try the following and report back whether it worked?

Server Protocol: ssh
Username: git
Server URL: github.com
Port: (empty)
Repo Path: myname/mypasswordrepo.git
Authentication Mode: SSH key

@msfjarvis We might want to go back to a single "Repo URL" field and maybe persist it as Base64 to work around Android limitations. Thinking about its atomic parts is just not what users are used to, it seems.

Thank you very much, the example you gave is correct, I successfully cloned github.com Repo. In fact, I used to configure it correctly, but this time I forgot again. This is a simple and very useful program. Thank you again.

@fmeum
Copy link
Member

fmeum commented Aug 11, 2020

@msfjarvis @Skrilltrax I have some time today and an idea how to resolve this properly, so you don't have to work on it.

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 a pull request may close this issue.

5 participants