Tailscale package

Hello folks,

I started using tailscale for my devices and I was wondering if it’s possible to install it on Turris Omnia too.

I have found there is a package for OpenWrt already: [OpenWrt Wiki] package: tailscale Is there a way to include it to the official Turris packages? Or can I somehow side-load it safely (meaning it won’t be unistalled everytime I do an upgrade)?

Thank you

1 Like

I have it installed to the mSATA, under /srv. It’s a manual thing and updating it requires downloading, unpacking, updating a symlink and a reboot for some reason I didn’t bother to troubleshoot. It’s been working for months though, happy to share my setup if you’d like.

Hey @cassianoleal, that would be great, thanks in advance. I’m trying to make it work at least inside LXC but so far now luck. I’m having issues with /dev/net/tun but no solutions I have found so far worked for me. Also running it natively makes more sense to me.

Hi, sorry it took me a bit to respond. :slight_smile:

First things first, most of the credit goes to this: How I set up Tailscale on my WiFi router

To reproduce my implementation, follow these steps:

  1. Install packages

    opkg update
    opkg install ca-bundle kmod-tun
    
  2. Create file /etc/updater/conf.d/userlist-tailscale.lua with the contents below. This will avoid the packages above being uninstalled the next time the updater runs.

    Install("ca-bundle")
    Install("kmod-tun")
    
  3. Enable external storage on Turris. This mounts the SSD under /srv

  4. Create directory to hold binaries: mkdir /srv/tailscale

  5. Create script below in /srv/tailscale/install-version.sh:

    #!/usr/bin/env bash
    set -euo pipefail
    
    install_path=$(dirname "${BASH_SOURCE[0]}")
    
    if [ -z "${1:-}" ]; then
      echo "Usage: ${install_path}/install-version.sh VERSION"
      exit 1
    fi
    version=$1
    
    trap "popd >/dev/null" EXIT
    pushd "${install_path}" >/dev/null
    
    if $(stat "tailscale_${version}_arm" >/dev/null 2>&1); then
      echo "Version ${version} is already installed!"
      exit 1
    fi
    
    curl -LO "https://pkgs.tailscale.com/stable/tailscale_${version}_arm.tgz"
    tar zxvf tailscale_${version}_arm.tgz
    rm tailscale_${version}_arm.tgz
    stat current >/dev/null 2>&1 && rm current
    ln -s tailscale_${version}_arm current
    
    echo "Please reboot router to start using the new version."
    
  6. Make script executable: chmod +x /srv/tailscale/install-version.sh

  7. Install tailscale: /srv/tailscale/install-version.sh VERSION where VERSION is in the format e.g. 1.24.2.

  8. Test that the binaries are functional: /srv/tailscale/current/tailscale version

  9. Create the init script in /srv/tailscale/init-script.sh (this is exactly the one from the blog post, with paths adjusted):

    #!/bin/sh /etc/rc.common
    
    # Copyright 2020 Google LLC.
    # SPDX-License-Identifier: Apache-2.0
    
    USE_PROCD=1
    START=80
    
    start_service() {
      /srv/tailscale/current/tailscaled --cleanup
    
      procd_open_instance
      procd_set_param command /srv/tailscale/current/tailscaled
    
      # Set the port to listen on for incoming VPN packets.
      # Remote nodes will automatically be informed about the new port number,
      # but you might want to configure this in order to set external firewall
      # settings.
      procd_append_param command --port 41641
    
      # OpenWRT /var is a symlink to /tmp, so write persistent state elsewhere.
      procd_append_param command --state /etc/tailscale/tailscaled.state
    
      procd_set_param respawn
      procd_set_param stdout 1
      procd_set_param stderr 1
    
      procd_close_instance
    }
    
    stop_service() {
      /srv/tailscale/current/tailscaled --cleanup
    }
    
  10. Make it executable: chmod +x /srv/tailscale/init-script.sh

  11. Symlink and enable the init script:

    ln -s /srv/tailscale/init-script.sh /etc/init.d/tailscale
    /etc/init.d/tailscale enable
    
  12. Join tailnet: /srv/tailscale/current/tailscale up

At this point your router should be part of the tailnet!

When a new version comes out, just re-run the install-version.sh script with the new version as an argument, and reboot router.

Let me know how this works for you, or if you work out why a reboot is needed! :smiley:

Edit: fixed bug in install-version.sh
Edit 2: Added /etc/updater/conf.d/userlist-tailscale.lua

2 Likes

Thanks a lot. I’ve read the blog post and followed your instructions and have it working now, including exit node & subnets (which is what I wanted to have primarily).

I just noticed that your installation script has a small bug in it, it’s on the line where you check if the version is already downloaded, there is a hard-coded number there, it should be replaced with ${version} too.

Also, in the blog post there is a note about /etc/upgrade/keep.d/tailscale, have you added into your system too? Is it needed with TO? I’ve added it just to be on the safe side, just omitting the last two lines as the binaries in our case are under /srv which I expect is not touched by upgrades at all.

Edit: I also use custom DNS and I want this to be ignored in case of TO, so I’ve added --accept-dns=false to the tailscale up command.

1 Like

Ah, good catch on the version thing. I’ve fixed it in the post above in case someone else tries it as well.

I haven’t done anything about the updates because as you said it’s under /srv which is left alone anyway.

I did think about symlinking the binaries to /usr/bin or similar. If you do that it might be a good idea to do the keep thing but I never felt the need. I just cd into its directory on the rare occasions I need to run it.

Glad it’s working!

1 Like

Actually, I just re-checked /srv/updater/conf.d and I do have a file userlist-tailscale.lua there with these contents:

Install("ca-bundle")
Install("kmod-tun")

This will ensure those packages never get uninstalled by the updater. I’ll update the other post now as well.

1 Like

Tailscale was added for OpenWrt 21.02 and newer versions, and thus you can already find it in our development branches. What we are using for now is OpenWrt 19.07, where the tailscale is not presenting, and we tried to backport it, but there are some compile issues, which we need to investigate to fix it which currently does not have a high priority.

If you want to try development branches, please proceed with: Early access - Turris Documentation