Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: A simple SSH VPN client (github.com/ivanilves)
113 points by ivanilves on July 23, 2017 | hide | past | favorite | 26 comments



How is it different from sshuttle, which does not need remote root?

https://github.com/apenwarr/sshuttle

Edit: xiringuito uses the SSH tun/tap feature, which does TCP-over-TCP tunneling (which performs badly[1]). sshuttle instead multiplexes the TCP streams over a single connection by capturing them and opening a new TCP session at the remote end. This means it does not need root permissions on the remote side, since it does not need any raw sockets or even create tap devices.

The SOCKS proxy and the port forwards (-L, -R etc) work similarly, it's just the tunnel feature which should be avoided since it forwards whole packets.

[1]: http://sites.inka.de/bigred/devel/tcp-tcp.html


Well, there are some differences between sshuttle and xiringuito:

1) xiringuito is great for UDP. I had issues with RTP streams (UDP, random ports) running over sshuttle , though they run perfectly over SSH tun/tap.

2) I can run low-level non-TCP, non-UDP, IP protocols like OSPF over tunnels I create with tun/tap.

3) xiringuito does not require python. Not everybody loves python.

Overally I am a fan of sshuttle, but the way it's made prevented me from using it in a few cases, so I created xiringuito ;)


Yeah sshuttle has basically got the "simplest VPN" problem completely closed up IMO.


Does sshuttle still cause occasional kernel panics on MacOS? (This is a real question, not a troll - I haven't used sshuttle for several years and it was a known issue among my colleagues at the time)


shuttle is pretty good. I like to use it with tproxy on the client side which lets both tcp/udp work on both v4 & v6


This creates an Auto closing SSH Tunnel (Tunnel will close if Chrome exits) to a remote ssh server and redirect to localhost on port 7070 and launch Chrome Portable using local port 7070 as socks 5 proxy

The following command is for cygwin on Windows.Can be customised for Mac OS or Linux

ssh -o StrictHostKeyChecking=no -C -f -q -D 7070 username@servername sleep 10 ; "/cygdrive/c/PortableApps/GoogleChromePortable/GoogleChromePortable.exe" --proxy-server="socks5://localhost:7070" &


Probably shouldn't turn off StrictHostKeyChecking. SSH will prompt to confirm the fingerprint if needed.


You might also want to pass --host-resolver-rules="MAP * 0.0.0.0 , EXCLUDE localhost" to Chrome to avoid leaking DNS queries [1].

Edit: typo

[1]: https://www.chromium.org/developers/design-documents/network...


ssh has a SOCKS4/5 client/server built in, so why not use it?

   ssh -D [bind_address:]port <server>


Not every application supports SOCKS natively. The other options are transparent, with the option of declaring subsets to route over the tunnel.


I use ssh -D along with https://github.com/darkk/redsocks to get system wide transparent tunneling working. Using iptables you can do per user, process etc. Works with every application :)


You can configure most systems to use SOCKS everywhere


While most systems have a system-level dialog to enter in SOCKS proxy information, it's still typically up to the application to obey that setting, and most outside of web browsers don't.

There are some applications out there (e.g., tsocks) that hook the relevant system calls, but I find them quite annoying to use. (You need still something to trigger them, to say "this connection should be proxied") I've also had issues with proxy applications whose system call hooks fail to implement the system call. (E.g., one would return from connect immediately with success, every time, prior to the connection actually being established. When the connection failed to establish, the send/recv call would fail. The application would immediately loop back to re-establishing the connection. This caused an infinite loop, since the first DNS entry it was encountering was never going to work; it would have skipped it when the connect() call failed, but then, the connect call wasn't failing.)


I know it’s possible macOS


I use 'tsocks' for application that doesn't support sock proxy natively.


Another approach is to run a localhost-interface only web proxy on the remote system and ssh -L 127.0.0.1:3128:127.0.0.1:3128 remotehost ... which replicates the remote proxy port on your local system.


Yes... But not all apps are web ;) We should also think about ones using non-HTTP TCP and UDP.


Well you can use SOCKS or OpenVPN over SSH quite easy too. However, in my experience these are are less reliable, at least in China for GFW.


Why on Earth would you run OpenVPN through ssh? That makes zero sense. It's like running ssh through ssh.

OpenVPN is pretty much the ultimate VPN that can do anything and handle any situation. It is indistinguishable from regular web SSL traffic and can run on any port via TCP or UDP. It can even run in routed (TUN) or promiscuous (TAP) mode!

Once you've got OpenVPN setup there's no need to tunnel with ssh since OpenVPN is your tunnel.

I used to run an OpenVPN ISP named VPNOut many years ago. I had CTOs from large organizations begging me to tell them all the IPs I used so they could block it because apparently employees were using my service to access things that were normally blocked inside their corporate networks. Even to this day that problem exists: If you configure iptables to forward all ports to an OpenVPN daemon on both TCP and UDP you can get around basically any form of blocking that isn't IP-based. You can even do some tricks to make it look like regular web traffic for the initial SSL preamble to get around "intelligent" firewalls!

OpenVPN is the best!


I like OpenVPN too. However, there are times when one size doesn't fit all. For example, opening another service to the public is not always a good idea. GFW is programmed to profile and periodically kill OpenVPN traffic flows. OpenVPN under many configurations is MITMable, SSH much less so. The list goes on.


OpenSSH and OpenVPN have nearly identical attack vectors with regard to MITM. In a default configuration, both require an upfront exchange of public keys (SSH at time of first-connection; OpenVPN at time of first-configuration).

In fact, because OpenVPN requires the client to obtain the server's certificate ahead of time out of band, and SSH instead relies on the end user typing "yes" after manually comparing a fingerprint, it could be argued OpenVPN is less susceptible to a MITM attack.

edit: Additionally, from past experiences linking up cn-north-1 with us-east-1, individual SSH tunnels fail constantly. individual VPN sessions fail constantly. The only way we were able to make life livable between the two was by way of BGP across a combination of ipsec and openvpn tunnels. (different tunnels, mind you; not layered)


They are not identical in attack vectors, and OpenVPN has many more capabilities to resist MITM and other attacks, and it resists network failure much more.

OpenSSH uses the SSH protocol and username/password and public keys for auth.

OpenVPN auth uses TLS key exchange, pre-shared keys, and username/password, and uses IPSec's ESP protocol for transport, with custom work to handle multiplexing connections. It can verify HMAC on all packets. It tunnels layer 2 or 3. It won't swap sensitive memory and can utilize SELinux. Since OpenVPN can use static keys and a UDP transport, it can resist network partition much better than OpenSSH.

Of course IPSec is much better than either of them. If you have to do all your tunneling in userland, OpenVPN is a more secure method, but if you don't have tun/tap device access, OpenSSH will get you by with port forwarding (which is what its SOCKS tunnel is, if you don't use its tun/tap device or pppd).


OpenSSH and OpenVPN have nearly identical attack vectors with regard to MITM.

Perhaps in theory, but in practice I would argue otherwise. Why?

Most SSH configurations require key verification and are rarely modified otherwise.

By contrast many OpenVPN configurations, statistically, have MITMable keys, and as they tend to be written from scratch the likelihood of these configurations in the wild is much higher.

With regards to SSH tunnel longevity, try specifying the ServerAliveInterval and ServerAliveCountMax options.


What is "GFW" in this context?


GFW here is short for the "great firewall of China" [0]. It's truly a PITA.

[0] https://en.wikipedia.org/wiki/Great_Firewall


https://github.com/ivanilves/xiringuito/issues/42

`sshuttle` & `xiringuito` differences well explained (I hope).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: