blink icon indicating copy to clipboard operation
blink copied to clipboard

Cannot Import SSH key

Open leepa opened this issue 8 years ago • 40 comments

Whenever I load the app, go to Keys -> Add -> Import from Clipboard the app, with no error, generates a new key.

This confused me a for while.

The key works in Terminus (it's a basic RSA key) and having no idea why it doesn't work it not helpful. The app should really tell me what's going on or error.

To clarify, I have pasted the exact same contents of the clipboard into another app and it works fine. In fact said key works everywhere else other than Blink.

leepa avatar Jun 05 '18 07:06 leepa

Hi @leepa,

Thank you for you feedback. We definitely should improve that flow.

yury avatar Jun 05 '18 11:06 yury

I’m experiencing the same issue as well.

archite avatar Jun 11 '18 05:06 archite

Hi @archite and @leepa.

It is UI a little bit confusing, New Key Screen after import from clipboard is actually screen for set a name for the key.

Or I missing something?

May be we should rename import from clipboard to create from clipboard?

yury avatar Jun 11 '18 07:06 yury

I indeed thought that but then it generated a new key and wiped what I imported.

leepa avatar Jun 11 '18 07:06 leepa

This is true for me too. I am unable to import SSH keys. Only generating new ones. When trying to import them it just generates a new 2048 bit key. Even copying between different Blink instances does not work. Unfortunately, this renders Blinks useless to me 😢

sandrinr avatar Oct 13 '18 17:10 sandrinr

Hi @sandrinr,

New version with the fix will be on next week.

yury avatar Oct 14 '18 17:10 yury

This doesn't seem fixed to me. I'm using the app version that hit the App Store today (Nov 2, 2018). Importing a private key from the clipboard seems to work, but ssh'ing to the host does not work. The key and host IP address are being copied from another iOS ssh app, where it all does work. The first time, it asks if I want to save things to the system, and I say yes. Then I just get the blink prompt back. Subsequent ssh commands just instantly give me the ssh prompt back w/o any error messages. Kind of frustraing - app doesn't do anything! Am I missing something?

brianjdoherty avatar Nov 02 '18 23:11 brianjdoherty

Hi Brian! Are you using version 12.1? We had an issue today with v12.0 that was preventing ssh keys from being used. We patched super quickly on 12.1, it is already approved and we are just waiting for it to be propagated to everyone (I can see it in my iPhone but not iPad). Let us know if that fixed the issue. Thanks!

carloscabanero avatar Nov 03 '18 00:11 carloscabanero

  • Blink: 12.2
  • iOS: 12.1
  • Device: iPhone X

I too have run into problems with importing a password protected ssh keys via [Config > Keys > Import from clipboard]. Here is a brief and (hopefully) replicatable description:

I wanted to have a password protected ssh key, but Blink's config GUI doesn't appear to have a way of creating a password protected key. So I figured "not a problem, I'll create the key on the command line and import it into GUI via the clipboard."

  1. I created a new password protected key:

    blink> ssh-keygen -t ed25519 -C 'Blink Test Key' -f ~/.ssh/id_ed25519
    # Enter non-blank Password x2
    
  2. Tested the key by connecting to my Mac:

    I had to use iCloud to deliver the public key to the mac, since ssh-copy-id only works with [Config > Keys] (see #554):

    blink> cp ~/.ssh/id_ed25519.pub ~/iCloud
    # Authorise the key on the Mac with: 
    # cat ~/Library/Mobile\ Documents/iCloud\~com\~carloscabanero\~blinkshell/Documents/id_ed25519.pub >> ~/.ssh/authorized_keys
    blink> ssh USER@MAC_IP
    # Enter ssh key password from Step 1 (above)
    me@MyMac:~ $ sw_vers
    ProductName:    Mac OS X
    ProductVersion: 10.13.6
    BuildVersion:   17G65
    
  3. Finally, I tried to import the key into [Config > Keys]:

    blink> cat ~/.ssh/id_ed25519 | pbcopy
    blink> config
    # Goto [Config > Keys > Import from clipboard]
    # Enter ssh key password from Step 1 (above)
    

    Resulted in:

    Invalid key Clipboard content couldn't be validated as a key

Since there is no way of creating password protected keys or keys with and expiry date from within the app, I would say that it is pretty essential that such keys could be imported from the clipboard.

--

PS: Interestingly, the above process works just fine for importing unencrypted keys, ie: keys with a blank password.

UrsaDK avatar Nov 21 '18 14:11 UrsaDK

Hi @UmkaDK,

Thank you for reproducible steps. Working on that.

Side note: Blink stores keys in Secure Enclave so password protection for keys is rudimental since its main purpose to protected your key in file system and not authorize you on server.

You can add extra layer of protection to Blink with "Auto Lock".

yury avatar Nov 21 '18 14:11 yury

Hi @UmkaDK v12.5 should be ok.

yury avatar Feb 10 '19 16:02 yury

Thanks @yury! I'll try to update tonight and give it another go.

UrsaDK avatar Feb 13 '19 07:02 UrsaDK

@yury, fix confirmed! Importing ed25519 key from ~/.ssh into the config now works as expected.

However, simply upgrading the app is not enough. You need to close (exit) the old session and open a new one in order to do it.

UrsaDK avatar Feb 18 '19 07:02 UrsaDK

Hi. This is still broken.

I have an iPhone X and an iPad Pro. I go into my Mac, I open ~/.ssh/id_rsa, copy the text inside. I then open my iPhone/iPad and confirm that the private key is in the clipboard by pasting into an iMessage chat. I then go into Blink.sh and "import from clipboard". I then have a key whose RSA fingerprint is not correct (different to the one on GitHub). It also does not work when I try to ssh/mosh into my servers.

raubreywhite avatar Jun 08 '19 22:06 raubreywhite

Hi @raubreywhite,

Can you check again with 12.9? we parse keys with OpenSSH, so we can read all keys...

yury avatar Jul 04 '19 06:07 yury

I had this problem too. A workaround to fix it is to reinstall Blink. I’ve got Blink 12.9, iPad Air 2, iOS 12.3.1. My host is an AWS lightsail instance.

THE PROBLEM: Blink has been installed for several months.

  • I put my key on the clipboard.
  • In Blink I created a key via ‘Install from clipboard’ then I created my host using this key. When I tried to ssh to the host it said ‘Host key for server changed / (it said the key fingerprint) / For security reason connection will be stopped’.
  • I immediately started Coda (iOS), created a new key from the clipboard, created a host using this key. I could ssh to the host fine.

THE WORKAROUND: I uninstalled Blink, reinstalled it. I can now create a key from the clipboard, create a host using this key, then ssh and mosh to the host fine.

peterhop avatar Jul 07 '19 09:07 peterhop

Hi @peterhop,

Can it be that uninstall/install is actually version upgrade? Because we reimplemented import keys using openssh.

yury avatar Jul 07 '19 14:07 yury

Good point.

No, the uninstall/install was not a version upgrade. I’d upgraded to Blink 12.9 immediately after it was released a few days ago and I only saw the problem in Blink 12.9.

I’m happy now. Maybe it was a glitch on my iPad. How about I wait a few weeks and see how it is then. And you can know if others report the problem.

peterhop avatar Jul 07 '19 22:07 peterhop

I still cannot import ed25519 keys no matter what. Tried reinstalling the app but it says it’s invalid

aalmenar avatar Sep 01 '19 19:09 aalmenar

Hi @aalmenar,

How do you generate key? Can you generate key for me?

yury avatar Sep 01 '19 19:09 yury