-
-
Notifications
You must be signed in to change notification settings - Fork 645
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
Improve SSH behavior in cider-connect #1544
Comments
If someone is going to tackle this, I'd suggest looking into tramp too. Tramp is Emacs' default interface to ssh (and other protocols), and many aspects of Emacs (besides just visting files) are already integrated with it, like It might be overkill for us to offer this integration, but it might also be that tramp has some functions/variables we can reuse for deciding what ports to sniff. |
Perhaps using tramp is the way to... I'm not sure...
|
Is there a way to avoid this behavior? I usually open an SSH connection with port forwarding if I want a secure interaction with a remote REPL. Now I'm in a situation where I don't want SSH and yet Edit: After looking at the source, this looks like it happens automatically when the direct connection fails. |
@Frozenlock maybe I misunderstood, but it looks like you're experiencing a genuine bug, while the current issued is really just a slightly related feature request. If that's the case, Could you file a separate issue describing how to reproduce your problem? |
Emacs crashing is indeed a bug unrelated to this issue. However, I'd still prefer to have a way to disable the automatic SSH fallback, which is pertinent for this issue. |
I see. Thanks for explaining. 👍 |
I also have a bit of trouble getting cider to avoid using ssh. When I run For now, I'm working around this by defining a function for each remote host that I commonly connect to. The functions call (defun my-cider-connect-foo ()
(interactive)
(cider-connect "foo" foo-port "/path/to/local/git/repo")) And then I use Like @Frozenlock, in my situation I basically never want |
Having the same issue. Dockerized clojure process running on a container on my dev machine, with repl open on 55555... Connecting to it from emacs on the host, I see "nREPL: Establishing SSH tunneled connection ..." How do I make it NOT ssh? |
Ok, just reporting. I figured out how to connect to a dockerized figwheel running an nrepl directly. In my case it was listening to the localhost connections only. Had this in the
To make it listen on all interfaces, add this to figwheel configuration: |
Seems I missed the last few comments. We should solve this simply by introducing a configuration option. |
…a failed direct connection This behavior was confusing for some users and couldn't be manually configured. Now the behavior is configurable via the new defcustom `nrepl-use-ssh-fallback-for-remote-hosts` and is disabled by default.
I've pushed a commit that changes the default behavior and furthermore - makes it configurable via a new defcustom. Try it out! |
I'm using If I instead put in the IP address directly, it asks for port number and the direct connection works fine. If I use a made-up hostname it's never seen before, it properly asks for port number, tries direct connection, fails, and then doesn't try SSH. |
@Hodapp87 It just tries a direct connection first and ssh afterwards (if the fallback is enabled). Are you saying that known hosts are not handled properly? If that's the cause this should be a different issue. |
Sorry, I said that wrong. I meant that I had disabled The behavior goes away if I remove the host in question from |
Yeah, this certainly seems like an unrelated problem, or a feature - after all of something is an ssh host we should probably treat it as such. :-) |
It's definitely a problem, not a feature, that cider-connect refuses to connect directly to a host simply because sometime in the past I connected to it from SSH. I mention |
I am assigning myself to this one but it might take months till I get down to it. I am guessing there is probably not much urgency anyhow. For the record, I think SSH tunneling should happen only on the following occasions:
I also would like to see a manual page with various patterns for remote connection that people use. It's hard to make any UI design decisions without having a full understanding of those. Particularly configurations for local and tunneled connections to virtualbox and docker containers would be useful as test cases for cider developers. |
There are more ways to SSH to a host than whatever emacs library could have anticipated. For example, my company use Kerberos, there's no SSH key, nor explicit password involved. Whatever SSH thingy you guys do here does not work. As @Hodapp87 suggested, there is simply no reason to mess with SSH for doing cider-connect. Trying to be smart here is just premature optimization. |
I'm in the same boat, would prefer cider never do anything ssh-related. It just slows things down by introducing network calls that block the UI, and sometimes fails when my ssh configuration is nonstandard.
One idea would be to add an option to disable using ssh for inferring remote ports. I drafted #2506 to test this idea, and it works for me. I'm not sure if there are other problematic ssh areas, such as the tramp calls in Anyway, here's one easy idea that gets us some (most?) of the way there. With this PR, we'd be able to do this to disable most ssh stuff: (setq nrepl-use-ssh-fallback-for-remote-hosts nil
cider-use-ssh-to-infer-remote-nrepl-ports nil) |
Btw, |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution and understanding! |
This issues been automatically closed due to lack of activity. Feel free to re-open it if you ever come back to it. |
As per the discussion in #1142, we should improve how and when CIDER decides it needs to try an SSH connection to a remote host in
cider-connect
.The preferred option seems to be to do 2 things:
'(~/.ssh/known_hosts ~/.ssh/config)
. It's value would default to'(~/.ssh/config)
.cider-sniff-for-ports-when-connected-only
and use(file-remote-p file nil t)
to check if there is already an emacs connection open outside of cider to that server.This should serve to make
cider-connect
's behavior less surprising for users. Currently it tries to SSH to any hostname in~/.ssh/known_hosts
which is often incorrect behavior and is difficult to debug in those cases.The text was updated successfully, but these errors were encountered: