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

Failed to open the file when select ssh key or ssh config #311

Open
ysya opened this issue Oct 2, 2024 · 3 comments
Open

Failed to open the file when select ssh key or ssh config #311

ysya opened this issue Oct 2, 2024 · 3 comments

Comments

@ysya
Copy link

ysya commented Oct 2, 2024

always shows "Failed to open the file." when I try to use ssh tunnel and select key or config file.

image image
@jayjansheski
Copy link

jayjansheski commented Jan 3, 2025

I'm having this problem also, even though the key works with other applications (like Postico, for example).

Name: production redis
Host: master.{redacted}.rped8o.usw2.cache.amazonaws.com
Password: {blank}
Username: {blank}

Enable SSL: not checked
Mode: SSH Tunnel
SSH Host: ec2-{redacted}.us-west-2.compute.amazonaws.com
User: ubuntu
Password: {blank}
Private Key: /Users/me/.ssh/prod-keypair.pem

➜ ls -lah /Users/me/.ssh/prod-keypair.pem
-rw-------@ 1 me  staff   387B Aug 20 13:29 /Users/me/.ssh/prod-keypair.pem

Medis Version 2.15.1 (3126)
macOS version 15.1.1 (24B2091)
Apple Silicon

EDIT:
I downloaded the non-app-store version, and that seems to connect just fine, so I'm guessing it's some kind of sandboxing problem? Though I did even try to move a copy of the key into the sandbox as part of my troubleshooting (to no avail)

EDIT 2: Added 'Apple Silicon' to specs

@luin
Copy link
Owner

luin commented Jan 4, 2025

@jayjansheski 👋 Good to know the issue has gone with a non-sandbox version!

Did you recently upgrade the OS? There have been reports of the same issue, most of which were caused by an OS upgrade. The issue can be resolved by clearing the current file selection in Medis and reselecting the file. Let me know if that doesn't work for you.

@jayjansheski
Copy link

jayjansheski commented Jan 4, 2025

@luin Actually I spoke too soon! While the UI in the non-sandboxed version said 'connected', it wasn't really connected. I did some troubleshooting (I hope it's clear I'm not complaining, just trying to be helpful):

  • Sandboxed version shows connection errors; Non-sandboxed version shows 'connected to {name}` but isn't really connected
  • Using native SSH tunneling in Medis: Results in NIOCore.IOError after 30-60 second timeout
  • Using external SSH tunnel (ssh -L) with Medis configured for direct connection: Works immediately and reliably

Working configuration:

  1. Open ssh tunnel in Terminal:
    ssh -L 63790:master.{redacted}.rped8o.usw2.cache.amazonaws.com:6379 -J my-jumphost my-webserver -N

  2. Medis settings:
    Host: localhost
    Port: 63790
    Enable SSL: checked (no certificates needed)
    Mode: Standalone

So the issue seems to be with Medis's SSH tunnel implementation, not with its Redis or TLS handling. The same Redis connection works perfectly when the SSH tunnel is handled externally.

Here are the ~/.ssh/config settings for my-jumphost and my-webserver:

Host my-jumphost
  HostName {redacted}.us-west-2.compute.amazonaws.com
  User ubuntu
  IdentityFile ~/.ssh/prod-keypair.pem
  ForwardAgent yes
  
Host my-webserver
  HostName ip-{redacted}.us-west-2.compute.internal
  User ubuntu
  IdentityFile ~/.ssh/prod-keypair.pem
  ProxyJump my-jumphost

Happy to provide more information if you need it.

Edit: To answer your question, I update the OS whenever there's an update. I only downloaded the app on this version of the OS, so I don't know if it would have worked on previous version. Clearing the file and re-selecting it didn't do the trick, unfortunately.

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

No branches or pull requests

3 participants