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

SSH config with branching #502

Open
unleashit opened this issue Mar 20, 2025 · 4 comments
Open

SSH config with branching #502

unleashit opened this issue Mar 20, 2025 · 4 comments

Comments

@unleashit
Copy link

unleashit commented Mar 20, 2025

xpipe doesn't seem to handle branching within an SSH config. For example:

Host 1.1.1.1 #example
  Match User user1
     IdentityFile path\to\key
     Port 2222
  Match User user2
    IdentityFile path\to\key
    Port 2223

The use case here is for example to have a normal SSH user, and then another for a service/container like GItlab or Gitea that require their own additional SSH server.

Currently, the host shows up in new pipe, but the discovery for the sub connections fails with:

io.xpipe.core.process.ProcessOutputException: Shell opener command was unsuccessful:
ssh: connect to host <redacted> port 22: Connection refused
at io.xpipe.core.process.ProcessOutputException.withPrefix(ProcessOutputException.java:29)
at io.xpipe.ext.proc.util.e.cf(SourceFile:192)
at io.xpipe.ext.proc.n.p(SourceFile:1689)
at io.xpipe.ext.proc.ssh.o.p(SourceFile:113)
at io.xpipe.ext.proc.n.D(SourceFile:587)
at io.xpipe.ext.proc.n.start(SourceFile:276)
at io.xpipe.app.ext.ShellSession.start(ShellSession.java:30)
at io.xpipe.core.store.SingletonSessionStore.startSessionIfNeeded(SingletonSessionStore.java:54)
at io.xpipe.app.ext.ShellStore.getOrStartSession(ShellStore.java:27)
at io.xpipe.app.util.ScanDialogComp.lambda$onUpdate$3(ScanDialogComp.java:100)
at io.xpipe.app.util.BooleanScope.executeExclusive(BooleanScope.java:22)
at io.xpipe.app.util.ScanDialogComp.lambda$onUpdate$4(ScanDialogComp.java:97)
at io.xpipe.app.util.ThreadHelper.lambda$runFailableAsync$1(ThreadHelper.java:45)
at io.xpipe.app.util.ThreadHelper.lambda$wrap$0(ThreadHelper.java:22)
at java.lang.VirtualThread.run(VirtualThread.java:329)

It tries to connect on port 22, which is not open. I also tried giving each branch an explicit HostName, but that didn't work.

I'm not sure if this would be complicated to implement. I haven't tried manually creating connections to each of these, but I will and maybe that can be a workaround.

@crschnick
Copy link
Member

Can you try whether https://github.com/xpipe-io/xpipe-ptb works for you, I fixed a few things relating to that

@unleashit
Copy link
Author

Thanks so much for your efforts, but so far it didn't fix it for me. With the above config, it still tries to connect on port 22 when discovering connections. I played around with the SSH config and tried for example:

Host 1.1.1.1
  Port 2222 # Attempting to set a default port for the find avail connections process...
  Match User user1
     IdentityFile path\to\key
     Port 2222
  Match User user2
    IdentityFile path\to\key
    Port 2223

SSH sessions work fine for both users/ports in the terminal, but not with xpipe.

Perhaps the problem is because there is no default User for the "find available connections" session. I don't think (AFAIK) I can set one in the SSH config and still have the matching work.

That said, I found I was able to create the connections manually just fine. So if you have bigger priorities, it's really not a problem. Its mainly a matter of aesthetics so the connections appear automatically, in the right place and without and error when auto exploring a config file.

@crschnick
Copy link
Member

So just to confirm, you added the SSH config connection and configured it like this?

Image

It should now connect with user1@<host name>.

@unleashit
Copy link
Author

Ah, for some reason I didn't think to add the user there. Before, I think it found it automatically from the config. Anyway, it's working now, thanks again! We can close the issue unless you want to keep it open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants