Just for kicks, I wanted to try using an ECDSA key for ssh authentication. Unfortunately, the OpenSSH bundled with Mountain Lion (10.8) does not support ECDSA keys (nor can one even be generated with ssh-keygen.) The man pages for ssh-keygen and ssh-agent say they support ECDSA, but this is due to a naive man page generation assuming that since the OpenSSL library supports it, OpenSSH will too. Also, a PCI compliant OpenSSH isn’t bundled with OS X Lion (10.7) or older so this will also be useful for those users as well. Thankfully, Homebrew already has a recipe for installing an up-to-date OpenSSH so most of the work of upgrading is already done.
2. Compile and install OpenSSH. I want to use a newer OpenSSL and all its optimizations, which Homebrew will happily provide via an option. Also, to make ssh-agent launchd and keychain compatible, there’s a nice undocumented option to apply the necessary patch before compiling too.
3. Like the caveat notes when brew finishes, you need to update the launchd plist for ssh-agent to use the new Homebrew binary. By replacing /usr/bin/ssh-agent with /usr/local/bin/ssh-agent
$ launchctl stop org.openbsd.ssh-agent $ launchctl unload -w /System/Library/LaunchAgents/org.openbsd.ssh-agent.plist $ sudo vi /System/Library/LaunchAgents/org.openbsd.ssh-agent.plist $ launchctl load -w -S Aqua /System/Library/LaunchAgents/org.openbsd.ssh-agent.plist
4. The SSH_AUTH_SOCK env var needs to be updated for any open or new terminal sessions. It’s best to logout/login or restart because we cannot modify the variables in the user session scope that all new processes inherit from. However, if that’s not an option, can do this instead.
Once the pub key from your new ECDSA key pair is added to .ssh/authorized_keys on your server(s), should be good to go (assuming OpenSSH on your server also supports ECDSA keys.)
Here are openssl speed runs showing considerable improvements in the newer OpenSSL on a Late-2012 rMBP with a 2.9 Ghz i7 (Ivy Bridge):
Just tried all of the following with Mavericks, and afterwards I got from the ssh -v command:
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
Doesn’t seem like it worked, have the instructions changed for Mavericks? I even tried changing the path in /System/Library/LaunchDaemons/ssh.plist as well, but that had no effect.
David
Ah, after adding this to ~/.bash_profile all worked correctly:
# Ensure user-installed binaries take precedence
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
Johan
This actually broke for me as of 10.9.1 and I (so far) haven’t been able to figure out why. the launchd plist exits with “exit 1″. Invoking /usr/local/bin/ssh-agent manually works just fine. I tried getting more debug out of launchd, but this is the most verbose I’ve manage to scrape together:
If I remove the -l flag, launchd starts it but behaves differently: it launches one every 10 seconds.
The reason for me replying here is since I haven’t found any other place where a homebrew openssh dialogue seems to be brewing (ha ha). Anyone else seeing this?
Kip M
This broke for me as of 10.9.1 too. Have you found a way to fix it yet?
Johan
No, but if I find one I’ll post to this thread. (Sorry blog owner for using this as a forum thread)
gidj
There seems to be the same issue being tracked at Homebrew’s Github:
The final remark indicates that the reason for the problem is that Homebrew’s version doesn’t build with a feature needed by launchd. There is not a working solution yet, though.
Pingback: Joseph Barker » HPN-SSH on OSX with Homebrew()