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

Failed to clone repository .... Underlying error: Failed to start SSH session [Especially Github repo] #153

Closed
snakelab opened this issue Jan 12, 2018 · 45 comments

Comments

@snakelab
Copy link

Hi folks,

i am getting this error at trying to clone a git repo via ssh-key which i had uploaded:

Failed to clone repository .... Underlying error: Failed to start SSH session: Unable to exchange encryption keys

Does anyone here have a tip for me?

thanks

hartmut

@mssun
Copy link
Owner

mssun commented Jan 20, 2018

Which key algorithm are you using?

@snakelab
Copy link
Author

snakelab commented Jan 22, 2018

hi, thanks for your help. My key is 2048 SHA256 RSA
This ist the error-message:
whatsapp image 2018-01-22 at 22 51 33

@infinisil
Copy link

Getting the same error here, same key type (which is the default for ssh-keygen)

I get the following error from sshd:

Jan 27 07:49:57 paul sshd[8630]: Unable to negotiate with 178.197.226.88 port 21947:
  no matching key exchange method found. Their offer: diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1 [preauth]

@snakelab
Copy link
Author

snakelab commented Feb 2, 2018

I dont use a password with the key, maybe this is a problem?!

@infinisil
Copy link

infinisil commented Feb 2, 2018

Well I know what's the problem and it might be a serious security concern. According to Mozilla's security guidelines, these are the recommended sshd options:


KexAlgorithms [email protected],ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group-exchange-sha256
Ciphers [email protected],[email protected],[email protected],aes256-ctr,aes192-ctr,aes128-ctr
MACs [email protected],[email protected],[email protected],hmac-sha2-512,hmac-sha2-256,[email protected]

And everything else should be considered insecure. Apparently the ssh library used in passforios doesn't support any of those! Especially SHA1 is considered broken. My distro (NixOS) has set these options as default, that's why it didn't work.

The problem ultimately lies in the libssh2 version being too old since the latest one supports the necessary algorithms (libssh2 is used by libgit2 which is used by objective-git which is used to clone the repository).

@mssun I suggest you to update some versions in hoping to get a more recent libssh2

@snakelab To fix this for now, you need to have access to the git server and add the following to your sshd_config:

KexAlgorithms +diffie-hellman-group14-sha1
MACs +hmac-sha1

Edit: Actually this doesn't seem to work for me (the + syntax i mean), I have to change the declaration of KexAlgorithms and MACs to include the ones mentioned instead, not sure why. Which means my config has now this in it:

KexAlgorithms [email protected],diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1
Ciphers [email protected],[email protected],[email protected],aes256-ctr,aes192-ctr,aes128-ctr
MACs [email protected],[email protected],[email protected],hmac-sha2-512,hmac-sha2-256,[email protected],hmac-sha1

infinisil added a commit to infinisil/system that referenced this issue Feb 2, 2018
infinisil added a commit to infinisil/system that referenced this issue Feb 2, 2018
@mssun
Copy link
Owner

mssun commented Feb 4, 2018

@infinisil Thanks. I didn't notice this cause before. I found that objective-git points to the libssh2 (libssh2 @ f1cfa55) which is five years old.

@snakelab
Copy link
Author

snakelab commented Feb 5, 2018

great work. As adding this algos is not an option for me, could it be fixed in passforios?!

@awmartin
Copy link

Is there a workaround for this? My host discontinued support for some of these key exchange methods, making passforios useless as-is.

@posix4e
Copy link

posix4e commented Feb 25, 2018

Same github just broke me

@awmartin
Copy link

@posix4e
Copy link

posix4e commented Feb 25, 2018

I just had to switch to gitlab

@jtunison
Copy link

jtunison commented Mar 1, 2018

Looks like libssh2 version got bumped in objective-git on Feb 15: libgit2/objective-git@17112f5

But no objective-git release since then...

@jtunison
Copy link

jtunison commented Mar 1, 2018

See also #164

@snakelab
Copy link
Author

snakelab commented Mar 2, 2018

This issue seems to have quite an impact to the project here, so i also opened an issue at the objective-git project and got good news:

libgit2/objective-git#641 (comment)

So it seems that passforios just need to update the objective-git libs and we all would be happy!!!!
Please just do it.... thanks @mssun

@mssun
Copy link
Owner

mssun commented Mar 2, 2018 via email

@tobiastom
Copy link

Just for the record: this will most likely not add Ed25519 support, as that is not supported by libssh2 for now: libssh2/libssh2#39

@supermarin
Copy link

any updates on this?

@mssun
Copy link
Owner

mssun commented Mar 25, 2018

Hi all, I'm trying to close this issue today. The only thing I can do is to use the master branch of objective-git. I don't know why I cannot use it via carthage. (libgit2/objective-git#646) Do you guys know why this could happen?

@snakelab
Copy link
Author

Please send me a invite to testflight: [email protected]

@snakelab
Copy link
Author

snakelab commented Apr 1, 2018

Hi @mssun, it is so sad, but it is not working for me ... i got the same error at using ssh-key for my repo ... :-/

@savyajha
Copy link

savyajha commented Apr 8, 2018

Has there been any progress on this? Using pass with bad encryption is worse than not using it at all. :/

@yishilin14
Copy link
Collaborator

@savyajha We are still waiting for a new ObjectivePGP release. Someone guy has been working on it.
libgit2/objective-git#643
libgit2/objective-git#645
libgit2/objective-git#648

@savyajha
Copy link

savyajha commented Apr 8, 2018

Oh wow. This is going to take a while, then. No worries, and thanks for letting me know. :)

@johnmee
Copy link

johnmee commented Apr 9, 2018

Major bummer. So if my repo is on github is there a (temporary) workaround?

eg: If I put it somewhere that is not github (my own server) and loosen the permitted algorithms, will that let me push passwords from the phone again?

@yishilin14
Copy link
Collaborator

A temporary workaround suggested by @raxod502 in #170

Temporary workaround for me is to host my repository on GitLab rather than GitHub. (Actually, I have it on both, with GitLab mirroring automatically.)

GitLab Documentation - Repository mirroring: https://docs.gitlab.com/ee/workflow/repository_mirroring.html

@yishilin14 yishilin14 changed the title Failed to clone repository .... Underlying error: Failed to start SSH session Failed to clone repository .... Underlying error: Failed to start SSH session [Especially Github repo] Apr 9, 2018
@snakelab
Copy link
Author

@mssun Hi bob, why don't you try this version with a newer openssl bib:

https://github.com/tiennou/objective-git/commits/master

@mssun
Copy link
Owner

mssun commented Apr 25, 2018

@snakelab Did you mean this: https://github.com/tiennou/objective-git/commits/update/libgit2-0.27?

It seems that supporting latest openssl lib is still work-in-progress.

@snakelab
Copy link
Author

Well, i mean this issue:
libgit2/objective-git#648
where tiennou mentioned the update to the new ssl lib....

@mssun
Copy link
Owner

mssun commented Apr 30, 2018

@snakelab Thanks. I tried to build with the master branch and got an error. I have reported to the upstream: libgit2/objective-git#654

@phatblat
Copy link

phatblat commented May 3, 2018

@mssun Let me know if libgit2/objective-git#655 resolved your issues building master with Carthage

@mssun
Copy link
Owner

mssun commented May 3, 2018

@phatblat it works. Thanks.

@snakelab
Copy link
Author

@mssun is a new release coming??

@mssun
Copy link
Owner

mssun commented May 29, 2018

@snakelab Due to an issue of objective-git, we still cannot use the latest release for now. Thanks.

@jakerobers
Copy link

Adding link for convenience. It looks like it will get merged soon: libgit2/objective-git#645

@mssun
Copy link
Owner

mssun commented Jun 4, 2018

@snakelab Thanks, I'm following this PR.

@savyajha
Copy link

Asked for the linked PR to get merged, seeing as their holdup seems to have been fixed. Hopefully we'll get a fix to that issue that's blocking the upgrade of objective-git here.

@mssun
Copy link
Owner

mssun commented Jun 16, 2018

Hi all, I'm releasing a test flight because of the merged PR "Update libgit2 to 0.27" (libgit2/objective-git#645). Please help me test if everything works well. Thank you!

@raxod502
Copy link
Contributor

I can now clone repositories from GitHub with the latest update. Thanks!

@savyajha
Copy link

Using it on a private server, it works with the Mozilla OpenSSH guidelines. Thank you!

@snakelab
Copy link
Author

@mssun thanks for releasing this issue - it is also working for me now!

@delegacy
Copy link

Checked that the latest test flight app can synchronize with my GitHub repo now!

@OkanEsen
Copy link

Do we have any info on when we can expect this change to be pushed to production? Is there something we can do to help?

Thank you for your hard work @mssun!

@KjellConnelly
Copy link

I'm having the same error... is this being pushed to the App Store? If not, can you add me to testflight?

@pbnsilva
Copy link

pbnsilva commented Aug 1, 2018

Any ETA on app store release ?
Thanks for your work.

@yishilin14
Copy link
Collaborator

Version 0.5.0 (commits: 824b959) should have fixed the problem in this issue.

  • Testflight: Jun 16
  • App Store: about a month ago

If you guys are unable to clone via SSH, I think it is because of some other reasons (e.g., problematic setup, unsupported key algorithms, unsupported key format).

Please fire a new issue with more detailed information for further discussion/suggestions/debugging purposes.

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

No branches or pull requests