-
-
Notifications
You must be signed in to change notification settings - Fork 270
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 auth keys, just very painful outside of ssh-agent. #911
Comments
Thanks for reporting these. Most of these are LibGit2.jl problems or possibly libgit2 problems. |
More of a Julia issue than a Pkg issue, but I just wanted to point out that in light of the above and how quickly |
I've been wanting to work on this but I haven't had the time lately |
Per libgit2/pygit2#836 (comment), generating a new SSH key passing |
We should detect if a key doesn't have that right and if so give a better message |
It is quite inconvenient when working with registries and repos sitting in an Enterprise GitHub which always requires SSH keys. For now I need to launch julia with |
For the record, repeated queries for "Private key location" does not necessarily indicate a failure of providing the key as such, only that something, anything, went wrong during authentication. Debugging is tricky but see #1516 (comment) for a way of forcing |
I have found Edit:
A key stored in OpenSSL PEM format, which libssh2 understands, can be recognized by starting with
whereas a key stored in OpenSSH format begins with
|
Perhaps not directly relevant, but I have found that keychain (available on most distros) makes dealing with SSH agents drastically simpler. So much so, in fact, that this has no longer seemed like much of an issue to me. Still, it would be great if Pkg could use command-line git which just respects the |
I'm just a regular old user with my ssh key sitting in I'm sure it's nice for Just a small gripe on an otherwise best-in-class package manager! |
There are plenty of "regular old users" who will either have multiple keys in It's been quite a long time and I still don't see any solution to this that's any better than using an agent manager like |
Folks, if you have complaints, please open issues on libgit2. If libgit2 does whacky stuff when talking over SSH or doesn't respect your SSH key setups, there's nothing we can do about it. Venting here has zero effect since we are not about to start adding major features to the libgit2 project. These hands are already quite full. |
For what it’s worth, Rust’s package manager can use system git to avoid this issue: rust-lang/cargo#2078 (comment). Cargo has a thread tracking this issue here: rust-lang/cargo#2078 Falling back to system git would seem the most user friendly. It does seem better to have this fixed in libgit2 rather than have everyone write a workaround. |
I'm working on adding a system git fallback for 1.6, so that might address this. |
Yeah, I don't understand what's going on over in |
My interpretation is that libgit2 is essentially developed by GitHub for GitHub and they don't care about anything that doesn't affect their use cases. In particular, anything regarding end-users using libgit2 on their personal systems is a non-priority for the project. Which is in stark contrast with the git project, where that is the only priority. Perhaps an uncharitable view, but in the years that we've used the library, that seems to be the way things pan out. |
If that's a correct interpretation it sounds like a good reason to abandon it entirely in favor of command line git, if that's practical. |
I've made the case for that on pkg-dev calls, but there are very legitimate concerns in the other direction:
So I think the best approach is probably to use both:
I'm working on this, but I'm stuck in incredibly tedious stdlibs plumbing work that's necessary just to be able to replace the current ramshackle download functionality with something sane: JuliaLang/julia#37686, JuliaLang/julia#37340, JuliaLang/julia#37611, JuliaLang/julia#37763. All that noise is just to be able to add Downloads and Tar as stdlibs so that we can download and extract things consistently everywhere. Every time someone proposes that they want to add a new stdlib, I just laugh a world-wearied jaded little laugh and think "if only they had any idea how awful adding stdlibs actually is, they would not think this was a good idea". |
Having the system git as a fallback (or as an option via some kind of configuration) for fetching things from the internet is perfectly fine. However, we use LibGit2 for much more than just that. In those cases, having a proper Julian API with types having nice |
Going forward there are only three things we will be using git for in Pkg as far as I can tell:
The first requires only two very high-level git operations: |
In particular, there are no more situations where we would have to do git operations that don't hit the network (which, slow as exec is on Windows, it's still faster than a network RTT). Yes, we used to do lots of little local git operations, but Pkg3 got rid of all of that. Where do you see us doing that sort of thing anymore? |
Some examples: we use it to check if a certain tree hash is in a cached git repo when we add by a branch or commit. We use it for diff support in status output. We use it to checkout a subdir of a repo ( Lines 623 to 626 in f1430b5
Those lines above are something that I think would be quite a lot harder using the git command line.
People host their own registries on GitHub or other git host services and I don't think that is a feature we can just break. Having to implement your own Pkg server is a significant step up in complexity over just setting up LocalRegistry.jl, especially since you then have to serve all packages. |
That's fine and the tarball can still be acquired from a git repo. The thing I don't want to support is having the registry be a git clone or a tarball locally. I'd prefer to only support it being a tarball. |
Do they do something significantly different from https://github.com/GunnarFarneback/LocalRegistry.jl/blob/7f26935a56cfc16e9cbed8fe316df5276280cd06/src/LocalRegistry.jl#L339 ? |
Hi @StefanKarpinski - do you think this is something that could still get into 1.6? |
No: The 1.6 release has been feature frozen for months and is entering the release candidate phase. Using SSH without using ssh-agent is just a world of pain in general, even outside of libgit2. Fortunately, ssh-agent exists, is excellent, solves all of these problems, and there's no good reason not to use it. |
For me this : ssh-keygen -m PEM -t ed25519 -C "[email protected]" worked. |
I keep getting: error: GitError(Code:ERROR, Class:SSH, Failed to authenticate SSH session: Unable to open public key file) when giving path to the ssh key file. in the pkg command line |
The easiest way to get around such problems is usually to set the environment variable |
|
Reading through the comments in this issue should give some enlightenment. The summary is that Julia internally uses libgit2, which gets its ssh functionality from libssh2, which is infamously less capable than command line ssh. |
This is a meta-issue for just how problematic it is to try and do anything with SSH auth outside of ssh-agent.
ssh-agent really shouldn't be the only way to do this, or even the standard way.
This is kinda an expansion upon JuliaLang/julia#29851
In Pkg3 it shows up in 2 places
~/.julia/registries
that uses ssh auth[email protected]
I used to be able to produce all these same issues in julia 0.6 if I had a package git repo that was using ssh auth/transport. It is generally less bad in Pkg3, since seperate eviroments and
dev --local
and alsoupdate
not doinggit pull
cuts down on it a lot.I am just going to list problems,
and this can be broken up into sub-issues
(I feel like some of these already have issues, and those can be cross-refed).
To be clear I have not managed to successfully use SSH auth since at least julia 0.5.
But I did largely stop trying at that point and only started again today.
For now, excluding ssh-agent, because for other reasons I don't use that.
everything works fine for my keys when using the git commandline client
I have both public key and private key in same folder.
all are
chmod +400
1. Here are a list of ways of providing the key that it does not work
and just cause the query message
"Private key location for '[email protected]' : "
to be asked againI believe this is probably related to libgit2/pygit2#836
(but see point 4, no error messages so IDK)
1a. Providing any answer to the query message the query for private key location including all combinations of
id_rsa
or a path to a key with a less standard name (eg.id_github_rsa
)Basically, that input never seems to do anythign useful
1b. having your key in
~/.ssh/id_rsa
. This is the SSH default, so it should just work.1c. Setting
SSH_PUB_KEY_PATH
andSSH_KEY_PATH
doesn't work.1d. specifying the key for the URL
.ssh/config
Other issues
2.
SSH_PUB_KEY_PATH
andSSH_KEY_PATH
are not documented.they are mentioned occationally on Discourse etc.
given they don't work AFAICT, documenting them seems low priority.
This is tracked in LibGit2: refuses to use private key, document ENV julia#29851
3. the private key location query line does not support
readline
functionality. It is a raw text input and so pressing up inserts control characters.4. No error messages are displayed ever.
5.
.ssh/config
is not respected.ssh/config
than specify the keys. Like aliasing hostnames and suchgit
respects it.I would appreciate it if people could point me at corresponding sub-issues already open in Pkg3/Julia/LibSSH/LibGit2 etc.
The text was updated successfully, but these errors were encountered: