OpenSSH Patch Extends Tunneling Under OpenBSD
Jonatan Wallmander writes "We've written a small howto as well as produced a simple patch for OpenSSH that improves tunneling functionality in the ssh client on the OpenBSD platform (this should be OK on other platforms with some tweaking). It's a simple hack but works very good for us. We can have different IPs on the same BSD machine tunnel different hosts ... Without the patch you can only have one tunnel per BSD machine since it listens on INADDR_ANY.. Now all my computers on the LAN can access remote servers securely as if they were in the same room provided by a single BSD server. :)"
I got educated on an earlier Slashdot story of how (a) how nice and easy it was to set up an encrypted tunnel using ssh instead of IPSec or a weird proprietary VPN product, (b) how TCP over TCP is a fundamentally bad idea and people were compensating by periodically restarting the tunnel service afresh to work around it.
How's the performance of this setup and does it address any of those problems?
"Provided by the management for your protection."
I read the paper, and found it to be a very elegant solution to the problem. I, too, have wished to have multiple tunnels on the same port. I only hope that this patch makes it into OpenSSH (and OpenSSH-portable, of course). I think it'll need some testing, but it seems like a good idea well executed.
Check out my eclectic infosec blog at InfoSecPotpou
This is an excelent idea and better yet sounds like it will work to bridge the OS gap. But is this considered a VPN? And if so should I be concerned about "The Long Arm" if I attempt it with a node in a state that prohibates such.
Computer science is a grab bag of tenuously related areas thrown together by an accident of history, like Yugoslavia.
The OpenSSH sources list a "null" cipher, but I have had no success in establishing a connection using it. Is there a trick to it, or do I need to patch the sources to get a connection that sends in plaintext?
(Why? The traffic is already encrypted via IPSEC; I just want to use SSH's cool port-forwarding apparatus and its authentication, and don't want to pay for for encrypting twice.)
Ditto. Keep up the good work. I'm new to BSD (from Linux/Solaris) but I've been very impressed so far.
I don't wish to be pedantic, and it doesn't compromise the understandability of the article, but in the drawing under chapter 3 (The basic solution), the "brown" OpenBSD file server is available to the Windows PC as .200, and NOT .5 as suggested. :-) ) gets mapped to 127.0.0.1:139 (but on the OTHER end of the tunnel - thus the brown box).
The green OpenBSD box just does a simple port forwarding (from its own 139 to port 139 on 127.0.0.1 seen from the other endpoint's perspective) and makes it available non-loopback-only via the "-g" option (which btw won't work if you don't have "GatewayPorts yes" in your sshd_config file, and the last time I checked this was not exactly well documented). Therefore, 192.168.0.200:139 (actually 0.0.0.0:139, esp. without this patch
The next example is correct (and shows the use of the patch).
Just my 0.02
Vacuum cleaners suck. Kings rule.
I didn't know that there were any states that had outlawed VPN's. Do tell!
TCP over TCP is a fundamentally bad idea
There may be some theoretical basis to this mantra, but in the real world it doesn't apply. I develop a product that uses TCP/TCP communications and it transfers hundreds of gigs a week from dozens of sites without any performance problems.
I think the way the real world works around the theoretical problems is that it's not really possible to maintain a TCP connection on the 'net for a long period of time unless you control the entire path. In my case, customer sites are always rebooting their routers, NAT boxes, etc. and connections rarely last longer than a day, often only several hours.
Fortunately, Unix has nice mechanisms for keeping things up, i.e. inittab.
My God, it's Full of Source!
OUTSIDE_IP=$(dig +short my.ip @outsideip.net)
I'm reprinting something from an AC which got stuck at 0 despite being informative. I've dropped the first sentence.
cut here
1. yes "TCP over TCP" is a bad effect. This is what happens when you tunnel an unreliable protocol (like IP encapsulated in PPP) over a reliable protocol (like TCP with something like SSH or SSL on top) The problem is that packet loss ends up causing retransmits both from the encapsulated TCP sessions and from the SSH/SSL layer on top. So you end up with a situation where it works perfectly when you're getting near zero packet loss, but as soon as there's even a moderate amount of packet loss the entire connection falls apart. Often the only way to recover from this is to restart the tunnel.
2. However, THIS ARTICLE ISN'T ABOUT THAT. It's using ssh'd builtin TCP forwarding to tunnel the data. So instead of "TCP-over-TCP" it's "TCP-to-TCP-to-TCP". At to point in the connection are there two TCP state machines both competing to retransmit. I'm sorry if this doesn't make much sense in text - I really need a whiteboard to explain it properly.
The short version is that the "TCP-over-TCP" problem is basically confined to schemes where they try to tunnel a PPP session over SSH (in order to get a full VPN). Just using SSH's port forwarding is _fine_.
Protocol overhead is obvious.. the real issue that people talk about is to do with how TCP deals with congestion... you end up with 2 layers of protocol trying to deal with a problem when only one needs to.. leading to some interesting issues... (things can theoretically get really slow)
The OpenSSH client has the nice feature of being able to act as a SOCKS4 proxy to dynamically build tunnels through a connection. What this means is that you don't have to specify every single forwarding when starting ssh, but you can use a socksified client to connect to ssh(1) and establish further tunnels on an as-needed basis.
Now, my (proprietary) software needed for this project is not socksified. What now? Ah! PFs rdr rules! (Also possible with IPFilter, IPFW (FreeBSD), IPChains...)
My client's private network address does not clash with the ones I use, so I set up my OpenBSD router to redirect TCP packets destined for the client's network to a local port. From there, transproxy (/usr/ports/www/transproxy) picks up the connection, and forwards it through the ssh(1) SOCKS4 proxy to the appropriate machine on the client's network.
The only thing left was to copy the client's private DNS zone over to my internal nameserver to be able to resolve names properly, and e voila!, I had my (almost) transparent ssh-based VPN.
The currect version of transproxy doesn't support SOCKS4, but I've submitted patches to the author. In the meantime, you can find my patches here.
Scott
"Hokey religions and ancient weapons are no match for a good blaster at your side, kid."
Can't you just tunnel to a different local port and use port forwarding or redir to map 139 on the proper interface to whatever you connected the tunnel to? It seems the patch is unnecessary...
--Quentin