Tailscale VPN
Tailscale’s website reads:
A secure network that just works
Zero config VPN. Installs on any device in minutes, manages firewall rules for you, and works from anywhere.
gokrazy-based devices are no exception! This guide shows you how to use Tailscale with gokrazy.
Tailscale’s networking will come in handy when accessing your gokrazy server remotely (no static DHCP leases, port-forwarding and DynDNS required!), or even to secure your communication when gokrazy is connected to an unencrypted WiFi network.
Requirements
- Package
tailscale.comv1.56.1 or later (latest version used automatically unless you have the package already in go.mod) - Volume
/perm/needs to be initialized (instructions usegithub.com/gokrazy/mkfsto initialize) to persist authentication over reboots.
Step 1. include the tailscale packages
Add the Tailscale daemon tailscaled and CLI tailscale Go packages to your
gokrazy instance:
Step 2. set command-line flags
Then, open your instance’s config.json in your editor:
And configure Package config: Command-line flags for Option A or Option B:
Option A: interactive authentication
Option B: unattended authentication with auth key
Alternatively, navigate to Tailscale console and open Settings / Keys. Generate auth key.
Include the key to tailscale flags:
Then, deploy as usual:
Step 3. authenticate (interactive only)
Skip this step if you are using option B with auth key.
- Navigate to your gokrazy web interface with browser using the URL displayed
by the
gokCLI. - Open the service
/user/tailscaleand find the login URL. - Open the link with browser and log in to Tailscale and authorize the client.
Step 4. disable key expiry (optional)
You are now connected to Tailscale and you can access your gokrazy instance over Tailscale.
Note
Tailscale requires re-authentication periodically. You can disable key expiry from Tailscale console for the gokrazy instance to not require login every 3 months.
Optional: Using gokrazy as a Tailscale subnet router
To allow hosts in your Tailnet to access devices in your network other than your gokrazy appliance, you can set up Tailscale as a subnet router.
Starting Tailscale version v1.64, IP forwarding is automatically enabled on Gokrazy.
Optional: Accessing gokrazy using Tailscale SSH
To access the gokrazy appliance using SSH authenticating using Tailscale, you can enable Tailscale SSH.
Note that Tailscale SSH needs to be allowed by your Tailnet ACL. You can configure to allow, for example, each user to access their own devices using Tailscale SSH, or define which hosts users can access.
Optional: Tailscale network for other programs
Before Tailscale v1.56.1, Tailscale used Userspace networking mode on gokrazy, meaning you needed to use Tailscale as an HTTP proxy to establish outgoing connections into your tailnet.
With Tailscale v1.56.1 and newer, programs running on gokrazy can connect to other devices in your tailnet without extra steps! 🎉 DNS resolution and TCP connections work out of the box.
Optional: Tailscale Go listener
Before Tailscale v1.56.1, Tailscale used Userspace networking mode on gokrazy, meaning you needed to use the tsnet package if you wanted to restrict a listener to Tailscale.
With Tailscale v1.56.1 and newer, you can listen on Tailscale addresses and use LocalClient.WhoIs to obtain the remote identity:
- Deploy this program to your gokrazy device
- Open the listening address in your browser, e.g. http://gokrazy.monkey-turtle.ts.net:8111
- Specify the
--allowed_userflag to verify that tailscale authentication works as expected