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

implement SshKeyFromMemory #797

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ccutrer
Copy link
Contributor

@ccutrer ccutrer commented May 9, 2019

fixes gh-796

libgit2 already supports it.

I wrote the tests for it, but was unable to get any of the OnlineTests to work. I'm guessing I probably just don't fully understand what I'm supposed to put in the environment variables. I did test it for reals. And I also tested it with libgit2 not having libssh2 support (since ssh key from memory is an optional feature), and Rugged's extensions still compiles. I did not test it with a libgit2 with libssh2 support, but not support for ssh key from memory (presumably a crypto backend other than openssl?).

fixes libgit2gh-796

libgit2 already supports it.
@ccutrer
Copy link
Contributor Author

ccutrer commented May 9, 2019

I've now tested with libssh2 built against gcrypt. when attempting to use in-memory ssh key without a public key (as you can with OpenSSL), you get Rugged::SshError: Failed to authenticate SSH session: Unable to extract public key from private key.. When I also provide the public key, I get Rugged::SshError: Failed to authenticate SSH session: Unable to send userauth-publickey request

@ccutrer
Copy link
Contributor Author

ccutrer commented May 9, 2019

I'm pretty sure the previous error was because libgcrypt can't handle my private keys at all. When using a libssh2 with openssl, but without ssh memory credentials (???), I get Rugged::InvalidError: this version of libgit2 was not built with ssh memory credentials.. Which seems hugely descriptive to me of the exact problem!

@repo.remotes.create("origin", ENV['GITTEST_REMOTE_SSH_URL'])

@repo.fetch("origin", {
credentials: ssh_key_credential_from_memory
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will work as long as we keep compiling against libssh2 which itself is built aginst openssl, but otherwise we'll start seeing errors in test.

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 this pull request may close these issues.

support ssh keys from memory
2 participants