|
|
Subscribe / Log in / New account

OpenSSH 6.7 will bring socket forwarding and more

This article brought to you by LWN subscribers

Subscribers to LWN.net made this article — and everything that surrounds it — possible. If you appreciate our content, please buy a subscription and make the next set of articles possible.

By Nathan Willis
August 27, 2014

The next stable release of OpenSSH, version 6.7, is slated to arrive soon. In addition to the usual bevy of fixes and updates, this release will introduce several new features, and it will be the first release to showcase the project's efforts to refactor the OpenSSH codebase.

Damien Miller put out a call for testing on August 18, asking users to give the "portable" version (that is, the releases not intended for OpenBSD) of the latest OpenSSH snapshots a spin on a variety of platforms. As is usually the case, the new release features several changes to the suite of available ciphers and algorithms (including some removals as well as adjustments to the default settings). But there are also several brand-new additions to OpenSSH functionality that will debut with the upcoming release.

Features

Among the new features is support for Unix domain socket forwarding. This feature allows a Unix domain socket on the local machine to be forward to a remote TCP port, or a remote TCP port to be forwarded to a local Unix domain socket—using the same syntax that OpenSSH supports for forwarding to TCP ports. For example, a remote PostgreSQL database instance could be connected over a secure SSH channel to a Unix domain socket on the local machine with ssh -L/tmp/foo.sock:mydatabase.net:5432 someserver. It is also possible to connect two local Unix domain sockets over an SSH connection.

Several years ago, this functionality was available in a patch set by William Ahern. The last update to Ahern's code, however, was made in 2012 for OpenSSH 6.1. The new feature is a reimplementation of the same work.

A related feature was added to support the Unix domain-socket forwarding. The escape sequence %C can be used in both the LocalCommand and ControlPath arguments of a configuration file. It expands to a unique identifier derived from the SHA-1 hash of (local host, remote user, hostname, port). The other escape sequences (such as %h for remote hostname and %u for local username) are often used with the expectation that, when expanded, they will comprise a unique identifier. However, the addition of Unix domain sockets meant that some possible use cases were bumping up against system pathname maximum lengths (UNIX_PATH_MAX); the hash value of %C is a workaround, providing a fixed-length (40-character) identifier, although it certainly may prove useful in other circumstances as well.

The new release will also expand OpenSSH's support for looking up SSH key fingerprints through DNS. OpenSSH's support for the DNS SSH Fingerprint Publishing (originally described in RFC 4255) included Elliptic Curve DSA (ECDSA) keys (described in the RFC 6594 extension). Version 6.7 will also support keys generated with Ed25519. The Ed25519 keys are not yet described in an official IETF RFC (although there is a draft under development). As the name probably makes clear, the new key type is derived from Daniel J. Bernstein's highly optimized Curve25519, which has been the basis of so much recent cryptography work.

Fixes

Several smaller but still noteworthy changes in 6.7 include the ability to resume interrupted uploads in SFTP connections, a configuration parameter administrators can set to disable the execution of per-user ~/.ssh/rc configuration files, and more informative failure messages (logging user, source address, and port for authentication failures). There are also several bugfixes that may be of interest to some users, such as the fix for a bug that would mistakenly rewrite localhost IP addresses in port-forwarding requests.

Undoubtedly of more general interest, though, are the fixes that target unsafe algorithms and options. Three such fixes are mentioned explicitly in Miller's call-for-testing email. First, RC4 and Cipher-block chaining (CBC) mode have both been removed from the default set of available ciphers and message-authentication code algorithms in sshd. They are now considered unsafe; users who need them for backward-compatibility purposes can re-enable them with sshd_config.

Second, support for TCP wrappers (and the libwrap library) is being removed. Miller noted on the development list in April that the same functionality was already available through sshd_config's Match keyword—and, more importantly, using Match is both more flexible and (because it removes an external dependency) safer for the project in the long run. During the April discussion, it was suggested that patching libwrap support back into OpenSSH 6.7 should be doable without too much trouble, in case there are users who feel they cannot transition to a non-libwrap setup.

Finally, OpenSSH 6.5 and 6.6 both suffered from a bug that would occasionally cause connection failures when using the curve25519-sha256@libssh.org key-exchange method. As a result, version 6.7 disables that key-exchange method when it connects to either of the affected older releases. Unlike the other two backward-incompatible fixes, however, there is no workaround in place for OpenSSH 6.7—though why one would want to reintroduce a bug that intermittently caused connection failures is difficult to imagine.

(Re) Factoring

In addition to the new features and bugfixes, version 6.7 will mark the first release to come from the OpenSSH project's effort to refactor the codebase—with the eventual goal of separating out the core functionality from the client and server code, thus making an OpenSSH library available for use by other applications. The 6.7 release will not be usable in such a "libopenssh" manner; however, it is a first step along the path. The wire-parsing, key-handling, and key-revocation list code has been refactored in time for the new release. The API those components use, though, is far from stable and should not be targeted by other applications.

The eventual goal of the refactoring work is to spare outside applications from having to fork a separate process in order to use OpenSSH functionality. That would make OpenSSH a viable alternative to some existing libraries like libssh. And there are a lot of potential uses for such a library—everything from rsync to SSHFS can make use of SSH tunneling, and OpenSSH is the de facto option for many users. Furthermore, the idea itself is quite old within OpenSSH; the first bug report to request it was opened in 2002.

The project has not set any sort of timeline for when a library version might debut. At the moment, the refactoring process is still going on, although there are unit tests and fuzz tests in the codebase, so interested users can do some experimentation.

Neither is there a release date set yet for OpenSSH 6.7 itself, of course. It will be released when ready. But when it does arrive, the availability of SSH-tunneled Unix domain sockets (along with the rest of the new feature set) will likely establish it as a release many will want to make use of, library or not.

Index entries for this article
SecurityOpenSSH


(Log in to post comments)

OpenSSH 6.7 will bring socket forwarding and more

Posted Aug 28, 2014 15:35 UTC (Thu) by RobSeace (subscriber, #4435) [Link]

The problem with removing libwrap support is that effectively makes things like DenyHosts useless... Unless it's changed to now modify sshd_config instead of hosts.deny, or you have to run some other thing that copies the new entries from hosts.deny into the sshd_config... And, wouldn't you need to hit sshd with SIGHUP after every change to get it to reload its config?

There's really something to be said for the simplicity and centralization of having everything check "/etc/hosts.{allow,deny}" without every server needing their own separate way of blocking hosts... Sure, they can still have their own more flexible and superior methods too, if they like, but I see no reason to remove support for libwrap in addition to those...

OpenSSH 6.7 will bring socket forwarding and more

Posted Aug 28, 2014 16:00 UTC (Thu) by rahulsundaram (subscriber, #21946) [Link]

I would suggest replacing denyhosts with things like fail2ban.

OpenSSH 6.7 will bring socket forwarding and more

Posted Aug 28, 2014 16:02 UTC (Thu) by cortana (subscriber, #24596) [Link]

OTOH there is something to be said for less code--it means fewer bugs/vulnerability, and easier maintenance. Particularly when it comes to a feature that is redundant to what you get from pam_access, iptables, systemd and probably others.

OpenSSH 6.7 will bring socket forwarding and more

Posted Aug 28, 2014 17:26 UTC (Thu) by raven667 (subscriber, #5198) [Link]

I would say that libwrap is useless for modern systems, it was a great stopgap in the early '90s but there are better protocols these days that make more sense. For SSH there is no reason it can't be open to the world as long as your authentication infrastructure is up to the task, elsewhere in LWN there is an article about how kernel.org implemented two-factor authentication for SSH and Git repos which are open to the world. kernel.org has to defend itself against well-funded nation-state attackers, and have notoriously cantankerous developers, their security is probably good enough for your use case.

I think we need to design any new systems to be connected to the whole Internet and think through what that means for security, without relying on crutches like IP-address whitelists and PTR/A record matches.

OpenSSH 6.7 will bring socket forwarding and more

Posted Aug 28, 2014 18:14 UTC (Thu) by RobSeace (subscriber, #4435) [Link]

As anyone who has run a wide open SSH server knows, it's going to get regularly pounded on by automated password-guessing worms who try various common user names... Sure, if you aren't even allowing password-based logins, you're safe in that they'll never succeed in getting in... But, what they CAN do is effectively DOS you, by tying up all of sshd's configured outstanding unauthed connections, so no legit users can get in until the worm is finished (or if they're lucky enough to squeeze in between the time one worm connection closes and another one can start up)... Plus, they just waste your bandwidth... Better to nip them in the bud ASAP and send them packing than to let them keep hammering futilely on the server, IMHO... That's why I've always liked DenyHosts... Fail2ban would probably be a good replacement, using iptables instead of hosts.deny, but I'm just more familiar with DenyHosts having used it for years, and rather like the simple hosts.deny approach over firewall rules... But, I suppose I'll get over it if and when I ever need to use a system running a libwrap-less sshd...

OpenSSH 6.7 will bring socket forwarding and more

Posted Aug 28, 2014 18:54 UTC (Thu) by raven667 (subscriber, #5198) [Link]

You can do rate-limiting at the IPTables level but even that wouldn't work against a dedicated DDoS, but then nothing you do on your end could work against a DDoS, they need to be blocked upstream of your network anyway. There is probably not much value in worrying excessively about possibilities which aren't likely and widespread, there are far more password guessing bots driven by organized crime or nation-states than drive-by DoS'ers and hooligans anymore.

OpenSSH 6.7 will bring socket forwarding and more

Posted Aug 28, 2014 19:36 UTC (Thu) by RobSeace (subscriber, #4435) [Link]

I didn't mean that their intention was to DOS you... I think it's just sloppy bot coding, where they ruthlessly make as many simultaneous connections as possible, each trying different username/password combinations... The DOS is a just side-affect of the password-guessing attempt... I've seen it in action before, where legit users were getting booted when trying to connect, and it turned out some stupid automated attack was managing to hold all the outstanding unauthed connections sshd was configured to allow (I think 10 is the default, so it's really not difficult to hit that limit)... If the attack is coming from a single IP, then the DenyHosts thing works very well at stopping that crap in its tracks very quickly... If it's coming from multiple IPs via a botnet, it's still helpful, and I don't care if a compromised end-user host is blocked, because if they're compromised I don't want them connecting to my server!

Yes, there are other approaches that can work too, as I said, but I just really like the simple hosts.deny approach...

OpenSSH 6.7 will bring socket forwarding and more

Posted Aug 30, 2014 12:59 UTC (Sat) by jsanders (subscriber, #69784) [Link]

I don't know why more people don't use pam_abl - it doesn't have all this messy handling of iptables and cleanly prevents logins.

OpenSSH 6.7 will bring socket forwarding and more

Posted Oct 8, 2014 18:17 UTC (Wed) by smurf (subscriber, #17840) [Link]

pam_abl does not make sense if you don't even allow password logins.

Using password logins on the open Internet is not a good idea without additional safety measures; anybody who watches you type (or has installed a keylogger) can now grab your login.

OpenSSH 6.7 will bring socket forwarding and more

Posted Aug 28, 2014 17:59 UTC (Thu) by josh (subscriber, #17465) [Link]

I'm really looking forward to libopenssh. It's painful to fork/exec ssh and control it, and reimplementations like Python's paramiko don't provide compatibility with things like ~/.ssh/config.

(A similar problem applies to dhclient and dnsmasq versus the built-in DHCP client and server in systemd-networkd. We need more libraries.)

OpenSSH 6.7 will bring socket forwarding and more

Posted Sep 4, 2014 12:10 UTC (Thu) by mgedmin (subscriber, #34497) [Link]

Paramiko supports at least a subset of ~/.ssh/config, which is what lets me use Fabric to control machines that need a ProxyCommand to access.

OpenSSH 6.7 will bring socket forwarding and more

Posted Oct 7, 2014 14:34 UTC (Tue) by nix (subscriber, #2304) [Link]

Note also <http://marc.info/?l=openssh-unix-dev&m=13982939112129...> and the next post in the thread, giving a 'Match exec'-in-sshd implementation of tcp-wrappers.


Copyright © 2014, Eklektix, Inc.
This article may be redistributed under the terms of the Creative Commons CC BY-SA 4.0 license
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds