machine icon indicating copy to clipboard operation
machine copied to clipboard

on OSX generic driver keep asking the ssh key passphrase

Open mnencia opened this issue 11 years ago • 7 comments

The generic driver is unusable with OSX if you have a passphrase protecting your key. It keeps asking for the passphrase and the output of ssh trying to add the key to the keyring confuses docker-machine.

After several attempt to find the issue I finally found this report:

http://apple.stackexchange.com/a/26252/96741

It looks like that OSX keychain doesn't like to have a rsa key without the corresponding .pub file

Executing the following command, while waiting for the input of the passphrase, fixes the issue:

ssh-keygen -y -f $HOME/.docker/machine/machines/$MACHINE_NAME/id_rsa > $HOME/.docker/machine/machines/$MACHINE_NAME/id_rsa.pub

The easiest fix here is to generate that file while importing the key.

mnencia avatar Aug 27 '15 15:08 mnencia

This happens on both, OSX and Linux. I tried on both .. on both keep asking for password, even if I don't want.

I tried your solution as well, but I got this as a response: load failed

marlonpp avatar Sep 14 '15 23:09 marlonpp

+1

ioriiod0 avatar Nov 26 '15 05:11 ioriiod0

Thanks mnencia, that worked for me.

jamesabbottsmith avatar Dec 22 '15 00:12 jamesabbottsmith

@mnencia @marlonpp Have you created the machine with or without --generic-ssh-key. If you do without, then docker-machine will rely on identities in ssh-agent and that should do the job.

dgageot avatar Dec 22 '15 08:12 dgageot

I have my passphrase of the key (~/.ssh/id_rsa) in my OSX Keychain. The generic driver copies this key to the docker machine config folder and then ssh asks for the passphrase again. It seems that Keychain stores the passphrase together with the key file location. If the file is copied it asks again. But two days ago, there was a commit 8524a4e that enables BatchMode for ssh and ssh won't never ask for the passphrase of the key copy. This makes the generic driver broken on OSX (at least for keys with passphrase).

Why does the generic driver copies the key at all? Some people may have stored the key on an external flash storage and don't want it copied somewhere they are not aware of.

benediktarnold avatar Dec 31 '15 17:12 benediktarnold

@benediktarnold Have you tried using the ssh-agent?

Here's what the generic driver says:

Interaction with SSH Agents

When an SSH identity is not provided (with the --generic-ssh-key flag), the SSH agent (if running) will be consulted. This makes it possible to easily use password-protected SSH keys.

Note that this usage is only supported if you're using the external SSH client, which is the default behaviour when the ssh binary is available. If you're using the native client (with --native-ssh), using the SSH agent is not yet supported.

dgageot avatar Jan 26 '16 08:01 dgageot

Closing. Support of passphrase protected ssh keys in the generic driver involves using the ssh-agent.

dgageot avatar Feb 12 '16 06:02 dgageot