8 ms·
Sshuttle - tunnel all your traffic through ssh
- iuguy 16y agoHow does this compare to OpenSSH VPN and Socks Support[1]? [1] - http://wiki.enigmacurry.com/OpenSSH http://wiki.enigmacurry.com/OpenSSH
- deleted 16y ago[deleted]
- SageRaven 16y agoVery much different. He explains it in the article quite clearly. No need to manually configure clients to use the proxy, as it uses the client's firewall to forward connections.
- jrockway 16y agoBut plain OpenVPN uses the normal IP routing machinery to send stuff over the VPN, which is even easier.
- mike-cardwell 16y agoTo use OpenVPN you have to install extra software on the server and edit configuration files and set up keys. Not sure how that is easier?
- jrockway 16y agoThe setup cost is higher, true, but the performance is better. TCP-over-TCP does not work well.
- burgerbrain 16y ago"sshuttle assembles the TCP stream locally, multiplexes it statefully over an ssh session, and disassembles it back into packets at the other end. So it never ends up doing TCP-over-TCP. It's just data-over-TCP, which is safe." I haven't bothered to look at how this is actually implemented, so I can't comment on how it actually works.
- pmjordan 16y agoAs far as I know it sets up firewall rules (ipfw/iptables) to redirect certain outgoing TCP connections to a local socket, where they are picked up by the sshuttle service and multiplexed over the ssh connection. at the other end, the stream is demultiplexed into connections again. Definitely no individual packets.
- mike-cardwell 16y agoI've heared the claim that TCP over TCP doesn't work well countless times. I've been using OpenVPN in tcp mode for at least 5 years on a daily basis and never noticed a problem. I've even done SIP over a TCP OpenVPN configuration without a noticeable problem. It makes sense to me that it should perform badly, and it probably does for uses cases with a lot of traffic, but for an average user on a laptop, a TCP based VPN is fine.
- jerf 16y agoIn my experience it depends heavily on what you are doing. When I'm just sending files from one place to another through my SSH VPN, it performs reasonably well. When you actually try to do something interactive, as in, interactive over the network, like a VNC or X connection or even just get intensive enough with a remote vi session, performance can and does randomly tank. sshuttle works far better for that use case. (I stopped using it because it didn't do DNS and I didn't have the time to add that but the commit log implies that has been fixed.)
- apenwarr 16y agoWhat happens is you essentially get "infinite bufferbloat." When there's no packet loss, you end up absolutely filling the transmit buffers at the entry points to the tunnels. The result, as other people have mentioned, is extremely poor interactive performance when you're simultaneously transferring large files. TCP-over-TCP not "broken" in the sense that the sessions will randomly drop or your kernel will crash or anything. It's just that doing it correctly is much better. Mind you, given the prevalence of bufferbloat (mostly caused by misdesigned routers/DSL/cablemodems) nowadays, interactive performance already largely sucks when you're transferring large files. So you might not even notice a difference. Bufferbloat makes me sad :(
- wtallis 16y agoWouldn't TCP Vegas over TCP work relatively well, since Vegas detects congestion using latency instead of dropped packets?
- mike-cardwell 16y ago
- sigil 16y agoVery cool. I wonder how hard it would be to port the muxer core to C, and run it under tcpclient / tcpserver on either end of the ssh connection.
- fs111 16y agoClick the little "fork" button and let us know, what you came up with :-)
- sigil 16y agoMaybe I will. ;) A few years back, I wrote a multiplexer / tunneler similar to Sshuttle in Python for a "Go To My PC" style web service. We wanted to tunnel over ssh, but had problems automating the client key generation and first-time connection. So we went with SSL. That and the cross platform requirement (most clients were running Windows) really took the fun out of it.
- duckyflip 16y agoWould this circumvent the checks Hulu does for example by forcing Flash to always connect directly. i.e using SOCKS Proxy will not work with Hulu but using full VPN will, so how will sshuttle rate ?
- silvestrov 16y agoFull VPN. It supports both TCP and UDP. You just need a ssh account on the remote server.
- aidenn0 16y agoFull VPN, but it doesn't work on windows. Also, if you start streaming Hulu through a shell account, there is a good chance that your shell account provider will notice and possibly get angry.
- bryanlarsen 16y ago+1 for a reference to slirp, which let you turn a dial-in connection to a Unix terminal into a real internet connection back in the days when your University would give you a terminal connection but not a PPP connection.
- hollerith 16y agoI remember SLIRP -- and The Internet Adapter.
- brianjesse 16y agoI used SlipKnot for that -- it converted a shell-dialup at University of Oregon into a SLIP connection that I could use with Netscape 1.0
- hollerith 16y agoSLIP being a "competitor" to PPP.
- nupark2 16y agoI still use slirp to get free tethering on my iPhone.
- bretthopper 16y agoIt's always good when there's only 2 steps to get it working and they work perfectly. Using it over hotel wifi as I'm typing!
- ccarpenterg 16y agoI'm a little confused. I'm outside USA and I want to browse some restricted content for users located outside of the U.S. Can I do this using Sshttle and a VPS?
- spullara 16y agoAll traffic will come from the machine that you are SSH'd into.
- ceejayoz 16y agoTranslation: Yes, if your VPS is in the US.
- ccarpenterg 16y agoYes, It's in the US. I'm not confused anymore.
- leon_ 16y agoyou don't need shuttle > ssh -D localhost:8888 <you@yourvps.com> then enter localhost:8888 as your socks proxy in your web browser.
- nprincigalli 16y agoYes, but you need a server in the US, so you can ssh to it. Just so you know, for anything that works over a socks proxy you can already do that easily with ssh (using the -D switch, check the manpage). You then need to configure your client app to use it (e.g. if doing ssh -D locally, in google's chrome, go to tools -> preferences -> under the hood -> proxy settings -> manual, then fill with localhost and the port number)
- nprincigalli 16y agoJust a little nitpicking, when he talks about TunnelVision, he should have said: And nobody never notified me of any security flaws in my key exchange, Instead of: And nobody ever found any security flaws in my key exchange, Yeah, hell is in the details... Regarding SSHuttle itself, I really liked it! (coming from someone who does all his browsing with ssh -D)
- chopsueyar 16y agoFrom the github.com page This is how you use it: git clone git://github.com/apenwarr/sshuttle on your client machine. You'll need root or sudo access, and python needs to be installed. ./sshuttle -r username@sshserver 0.0.0.0/0 -vv (You may be prompted for one or more passwords; first, the local password to become root using either sudo or su, and then the remote ssh password. Or you might have sudo and ssh set up to not require passwords, in which case you won't be prompted at all.) That's it! Now your local machine can access the remote network as if you were right there. And if your "client" machine is a router, everyone on your local network can make connections to your remote network. You don't need to install sshuttle on the remote server; the remote server just needs to have python available. sshuttle will automatically upload and run its source code to the remote python interpreter. This creates a transparent proxy server on your local machine for all IP addresses that match 0.0.0.0/0. (You can use more specific IP addresses if you want; use any number of IP addresses or subnets to change which addresses get proxied. Using 0.0.0.0/0 proxies everything, which is interesting if you don't trust the people on your local network.) Any TCP session you initiate to one of the proxied IP addresses will be captured by sshuttle and sent over an ssh session to the remote copy of sshuttle, which will then regenerate the connection on that end, and funnel the data back and forth through ssh. Fun, right? A poor man's instant VPN, and you don't even have to have admin access on the server.
- tobylane 16y agoAnyone know of a portable Chrome that I can SSH into home with? Preferably something I can leave on a shared computer, while only I have access to the stunnel. Also, it may need to be able to use port 80, I don't know the filter inside-out.
- chopsueyar 16y agoHow would one go about setting this up with a firmware rewritable consumer-grade router? Can I have a ww-drt install act as a client with Sshuttle and install a public key to require no login?
- wyuenho 16y agoYou can have Python running on the DD-WRT box of course, which will probably drastically slow down your router. You can also generate a public key for the router and append it to a remote host's .ssh/authorized_keys file, but for reason number 1 above, it's probably not a good idea. Now if you have a PC box running Vyatta or pfSense, then you might be able to pull this off with minimum impact.
- chopsueyar 16y agoAny inexpensive and small form-factor recommendations for hardware for pfSense?
- deleted 16y ago[deleted]
- paulv 16y agoIt doesn't do TCP-over-TCP. From the README: sshuttle assembles the TCP stream locally, multiplexes it statefully over an ssh session, and disassembles it back into packets at the other end. So it never ends up doing TCP-over-TCP. It's just data-over-TCP, which is safe.
- hemancuso 16y agoI must read more carefully, I retract my comment.
- askedrelic 16y agoI've been running this for months now and really like it. Really simple to setup and quite flexible.
- davej 16y agoBrilliant. Before this I used `ssh -d` and tunnelled everything through the port with proxifier.app but this is a much nicer (and free) solution!
- ch0wn 16y agoI set up an OpenVPN server for this purpose. This solution is so much easier and elegant, it's not even funny.
- tomjen3 16y agoI tried to setup an openVPN server, but after chasing a rabbit hole of instructions down the craziest URLs with obsolete or missing information I finally gave up. How did you get it to work?
- afhof 16y agohttp://bodhizazen.net/Tutorials/VPN-Over-SSH/ http://bodhizazen.net/Tutorials/VPN-Over-SSH/
- jerf 16y agoPlease actually read the linked articles before replying, and signal some recognition of the fact you have done so in your reply. If you wish to argue that the arguments put forth in the sshuttle README are somehow invalid and that what you linked is still better, please do so, but at the moment it looks like you haven't even read them.
- agj 16y agoThe alternative that predates this is to this is to just tunnel ppp over ssh using pppd: pppd updetach noauth pty "ssh root@example.com pppd nodetach notty noauth" ipparam 192.168.1.100:192.168.1.2 I used this for many years before switching to openvpn. This does require root access on the host to execute pppd however.
- tlrobinson 16y agoNOT all your traffic. This only does TCP. Any DNS, UDP, and other non-TCP IP traffic won't go through the tunnel! I tried sshuttle awhile ago and abandoned it because of this. The only thing worse than no security is a false sense of security.
- fs111 16y agoI personally don't use it for security reasons, but to be able to listen to last.fm easily through a vps in a country, where that is for free. (just one example) Security is never just a software you install, it also depends on you, knowing, what you do.
- tlrobinson 16y agoSure there are other uses. I'm just making sure people know, because it's being advertised as a VPN alternative, and this problem wasn't obvious to me when I first looked at it.
- jerf 16y agoThe commit log seems to imply DNS has been added: https://github.com/apenwarr/sshuttle/commit/0bf0351d9becae3da9379c335b0e71094cde2760 https://github.com/apenwarr/sshuttle/commit/0bf0351d9becae3d... (along with a few subsequent patches) But I have not tried it.
- tianyicui 16y agoI just tried, it does have the ability to route DNS requests through the tunnel. Out of curiosity, is it theoretically possible to route other kinds of traffic over this, e.g. UDP, ICMP(ping)? Thanks.
- tlrobinson 16y agoSure it's possible (see: http://en.wikipedia.org/wiki/IP_over_Avian_Carriers http://en.wikipedia.org/wiki/IP_over_Avian_Carriers). I don't know why they haven't done it yet.
- daemonize 16y agoSocat can do this: first read: http://www.dest-unreach.org/socat/doc/socat-tun.html http://www.dest-unreach.org/socat/doc/socat-tun.html then read: http://www.dest-unreach.org/socat/doc/socat-openssltunnel.html http://www.dest-unreach.org/socat/doc/socat-openssltunnel.ht...
- kqr2 16y agoDoes the TCP over TCP problem occur with socat tunnels?
- deleted 16y ago[deleted]
- apenwarr 16y agoPreviously on HN: http://news.ycombinator.com/item?id=1313083 http://news.ycombinator.com/item?id=1313083
- psn 16y agohttps://github.com/apenwarr/sshuttle/commit/33efa5ac62eaf9cf924de88d2dfde7547ed9e570 https://github.com/apenwarr/sshuttle/commit/33efa5ac62eaf9cf... is the point where I get confused. In a normal tunnel setup, one tunnels at the IP layer, and dumps all IP packets into the tunnel. At the far end of the tunnel, packets are sent onwards based on the far end's routing table. Things like DNS "just work" because everything happens at a layer below TCP and UDP. In this system, he's making it work for each non-tcp using layer 4 protocol separately, leading to weirdness like rewriting /etc/hosts. For tcp, he's nating all traffic locally to a local server, which then multiplexes all incoming traffic into the ssh connection. The remote side then unmultiplexes the data. I don't fully understand how this avoids tcp over tcp. Maybe I'm dumb. [edit: yeah, I'm dumb. the tcp connection is terminated at the local server, the contents are pumped over the ssh connection, and the remote side opens a new tcp connection] I wrote this mostly because I read the readme and went "but how does it work?".
- apenwarr 16y agosshuttle does not (currently) attempt to do anything other than TCP and DNS. UDP ought to be possible (other than that UDP-over-TCP could have similar problems to TCP-over-TCP, ie. that packets are never lost and this could confuse a hypothetical UDP-based congestion control algorithm). ICMP is probably not possible unless we run the server side as root. The "--auto-hosts" option you linked to is not the same as the "--dns" option. auto-hosts doesn't capture DNS at all; instead it just adds to your local /etc/hosts. I use this feature much more than --dns, actually, because unlike --dns, it works great if you have multiple tunnels to different offices open at once. (You get all the hostnames from all the offices.) sshuttle was originally designed to VPN into an office and forward a couple of subnets over. In that case, you often don't want to use the remote DNS server, you just want to know the remote hostnames, because most of your DNS lookups have nothing to do with the remote server. Hence --auto-nets and --auto-hosts. Nowadays it seems like sshuttle is mostly being used to counter things like Firesheep, which means you want to forward all your traffic to a remote server. In that case --dns - which forwards all your port 53 traffic over the VPN - is preferable. We could actually do all the other UDP ports the same way we do --dns. We just don't, because I haven't needed it and nobody else has submitted a patch.
- sandGorgon 16y agoCan I receive postbacks using this ? Explanation - as usual, my company works on a shared LAN which goes through a single internet connection. To test some applications, we have to be able to receive postbacks (on our developer machines) through 3'rd party services. The best way we found was to have an OpenVPN server running somewhere. Each developer connects to the VPN server and receives a private IP-address. All postbacks go to the VPN server and are then routed through nginx to the correct developer machine (on the private IP address). VPN is a pain to setup and configure - can something like this be used instead ? The question really is - how does nginx forward requests to the correct developer machine.
- HerraBRE 16y agoHave you looked at http://pagekite.net/ http://pagekite.net/ ? It's a generic "expose my local HTTP server to the Internet" tool, designed to be really convenient and easy to set up (assuming you already have a local HTTP server). If I understand you correctly, it may be exactly what you are looking for. It's FOSS so if you don't want to use the service (my startup!) you can roll your own. :-) But if you're looking for convenience, the service is probably hard to beat. Come chat on #pagekite on Freenode if you've got any questions!
- sandGorgon 16y agolooks awesome - thanks ! I suppose we will sign up sooner or later - 10 Euro isnt too expensive.
- HerraBRE 16y agoCool! We're actually doing a pilot program right now to try and better understand the needs of web developers who use PageKite, so be in touch if you'd like to be part of that.