-
Notifications
You must be signed in to change notification settings - Fork 60
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
ssh_key_needs_passphrase() doesn't work with OpenSSH-formatted keys #421
Comments
ssh_key_needs_passphrase()
always returns FALSE
I investigated more. I believe the issue is the
I created 4 test keys:
Similarly, searching for
Thus neither of these strategies can distinguish between OpenSSH-formatted keys with and without a passphrase. Requiring "encrypted" leads to false negatives, and requiring lack of "MII" leads to false positives. In case it could be helpful, here are the first 5 lines of the different types of keys:
|
Thanks for investigating this. I think a solution for git2r could be to instead use the credentials package (https://cran.r-project.org/web/packages/credentials/index.html) to help handle the ssh keys. |
@stewid Sounds good! How much work do you anticipate this will be? Will it require breaking changes, or will the new capabilities be able to be added on top of the existing infrastructure? Please let me know how I can help you test and/or implement this. |
Thanks. I don't know how much time will be required to make this refactoring, but hopefully it shouldn't be too much. I would rather we succeed in making this change by adding it on top of the existing infrastructure. I suggest that we keep the I will create a new branch |
I banged my head on this OpenSSH v. PEM encoding issue for quite a while today. For others that come across this problem (OpenSSH format is the standard on much of MacOS installs), an OpenSSH formatted key can be converted to PEM via The symptom of having the OpenSSH formatted private key is for operations (a clone in my case) to fail with a rather ambiguous message of |
The function
cred_ssh_key()
calls the functionssh_key_needs_passphrase()
to determine if a key requires a passphrase. I was informed by @jakejh in workflowr/workflowr#203 (comment) that this function did not work for him. Thus I tested it on Windows and Ubuntu with keys that did or did not require a passphrase. I found thatssh_key_needs_passphrase()
always returnsFALSE
. I also tried this suggestion to check for the stringMII
. However, at least for thessh-keygen
settings I used, this always returnedTRUE
.I used the following line to create the test SSH keys:
Key with passphrase on Windows
Key without passphrase on Windows
Key with passphrase on Ubuntu
Key without passphrase on Ubuntu
The text was updated successfully, but these errors were encountered: