from Hacker News

Making an SSH client the hard way

by darthShadow on 10/27/22, 5:13 PM with 102 comments

  • by PaulWaldman on 10/27/22, 10:12 PM

    > To make this possible, we ported the following to WebAssembly: the Tailscale client, WireGuard®, a complete userspace network stack (from gVisor), and an SSH client.

    Would it be possible to bundle the same into a portable application allowing you to use Tailscale without installing it? My understanding is that currently if you can't install Tailscale on a client you need to use Subnet Router. https://tailscale.com/kb/1109/devices-without-tailscale/

  • by easton on 10/27/22, 6:38 PM

    Could the Tailscale client be packaged as an extension so I can visit sites on my Tailnet without having to install a client? Sometimes I want to visit a "internal" site without having to install the client, if I'm using a temporary box for something. I'm not sure how much more work would have to be done, might have to dig into the open source pieces of this.
  • by vngzs on 10/27/22, 6:18 PM

    This is really cool and fun, but is this a safe way to run SSH clients?

    If, say, the adblock Chrome extension you're using gets bought by a malware operator and backdoored[0], now it also has SSH and VPN access.

    [0]: https://www.wired.co.uk/article/fake-chrome-extensions-malwa...

  • by kybernetyk on 10/28/22, 8:09 AM

    >To make this possible, we ported the following to WebAssembly: the Tailscale client, WireGuard®, a complete userspace network stack (from gVisor), and an SSH client.

    Wow, and they're proud of it.

  • by chatmasta on 10/27/22, 9:44 PM

    Cool feature! I was just looking at boringtun last night and wondering if it could compile to WASM, to get a virtualized network interface in the browser.

    Did you experiment with the new WebTransport API [0] at all? It's only supported in Chromium browsers, but seems promising for this kind of use case.

    [0] https://chromestatus.com/feature/4854144902889472

  • by amluto on 10/27/22, 6:27 PM

    I can't shake the feeling that Tailscale's SSH authentication mechanism is at the wrong layer of the stack. It appears to work by looking at the (source, dest) IP address pair and mapping that to a Tailscale identity. But this may mean that any user or anyone who can initiate TCP connections from an authenticated user's IP can authenticate to the destination over Tailscale SSH.

    If Tailscale's client was a userspace construct bound to a specific user SSH program, maybe fine. But Tailscale's client is a regular VPN client. What happens if you connect to the Tailscale VPN, open a malicious but sandboxed app of some sort, and that app connects to the target on TCP port 22.

    For all that it's a seriously unfinished product, Cloudflare's SSH offering seems better thought out. Perhaps Tailscale should find a way to issue a short-lived certificate and use that in addition?

    (It looks like regular sshd could almost be convinced to handle this. If the SSH_CONNECTION environment variable were passed to the AuthorizedPrincipalsCommand helper or if the source and destination were available as '%' tokens, then AuthorizedPrincipalsCommand could do the Tailscale tuple lookup and use it as a second factor in addition to a short-lived certificate (or regular SSH key or whatever). I bet openssh would accept a patch for this.)

  • by gunapologist99 on 10/27/22, 10:55 PM

    This significantly increases the threat model for your remote servers to include all sorts of remote attacks through the web, including:

      * garden-variety web attacks (i.e., XSS, CRSF, etc)
    
      * attacks that might become viable against the browser (for example, Mobile Safari has a history of vulnerabilities)
    
      * various attacks against the backend web server (API attacks)
    
      * attacks against the WASM layer
    
      * CDN injections
    
      * Tailscale's backend (various types of injections, timing attacks, or deeper attacks on Tailscale's infrastructure like the nightmares of HeartBleed, Shellshock, Meltdown, etc)
    
    That's probably a very incomplete list.

    Realistically, this essentially (actually, literally) opens a remote root shell into your entire infrastructure through a web page, with apparently nothing more than matching an IP address pair (https://news.ycombinator.com/item?id=33361837) to authenticate.

    What could go wrong?

    This design with its loose coupling between authenticated user and IP addresses for high-value targets makes me view Tailscale's security model in a whole new light.

  • by aliqot on 10/28/22, 4:21 AM

    I wouldn't be the target market for this, however more power to them. I understand that to an extent we should never roll our own, so to speak, however, I think that we should not put all of our eggs in one basket. In that regard, I think that once the beginning kinks are ironed out it will be a better thing and we should ultimately embrace these types of endeavors.

    Let me say again, though I admire it, I'd never use this. I like to sleep soundly, as irrational as that may be.

  • by dekhn on 10/28/22, 4:04 PM

    I just learned there's a POSIX kernel in Go that can actually run apps. https://www.usenix.org/conference/osdi18/presentation/cutler

    I think this should be compiled with WASM and deployed via web page. Then we can explore the idea of browser-hosted POSIX kernels.

  • by Spivak on 10/27/22, 8:41 PM

    > To make this possible, we ported the following to WebAssembly: the Tailscale client, WireGuard®, a complete userspace network stack (from gVisor), and an SSH client.

    I love that they were clearly inspired by fly.io. Warms my heart that a random blog post with a good idea can spread like this.

  • by heliophobicdude on 10/27/22, 7:05 PM

    Hi Mihai! Great work! I would love to see where this goes!

    Forgive my ignorance but is there any sort of native client besides the browser running in the background to help with websocket to tcp? Or a tunnel to a cloud service to help there?

  • by skybrian on 10/27/22, 7:37 PM

    In the old days, people said you shouldn't write crypto in JavaScript because it was somehow insecure. Have those concerns gone away with WebAssembly and https everywhere?
  • by ice3 on 10/28/22, 7:47 AM

    Interesting, I could see this as a nice replacement for Gravitational Teleport.

    One of the things that Teleport lacks (IMO) is Wireguard

  • by cynix on 10/28/22, 11:41 AM

    Will Tailscale SSH support FreeBSD any time soon?
  • by Scarbutt on 10/27/22, 7:31 PM

    But can it run emacs?
  • by dekhn on 10/27/22, 5:43 PM

    Most of the products from tailscale just seem to be "look at the inner platforms we can build that replace the outer platforms".

    Having an SSH client in your browser join your VPN violates all the principles of modern computing.