medis icon indicating copy to clipboard operation
medis copied to clipboard

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

Open ysya opened this issue 1 year ago • 3 comments

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

image image

ysya avatar Oct 02 '24 07:10 ysya

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

jayjansheski avatar Jan 03 '25 21:01 jayjansheski

@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.

luin avatar Jan 04 '25 02:01 luin

@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.

jayjansheski avatar Jan 04 '25 16:01 jayjansheski