keepcalculator

06 Numbers and Powers

Tailscale Self-Signed Certificate Warning Fix

Card No. 06·85934 · Updated · Standard formula, shown below

Yes, one Tailscale command can remove self-signed certificate warnings for your Tailscale services: tailscale cert. This command obtains a valid Let’s Encrypt TLS certificate for your Tailscale machine’s MagicDNS name, and once configured, browsers and clients will no longer show the ‘Your connection is not private’ warning.

Background: Why You See the Warning

When you run a web server on a Tailscale machine (like a Raspberry Pi, a home NAS, or a cloud VM) and access it via its Tailscale IP or MagicDNS name, the server typically uses a self-signed certificate. Browsers treat self-signed certificates as untrusted because no certificate authority (CA) has vouched for the identity of the server. The warning appears because the browser cannot verify that the server is who it claims to be, leaving you vulnerable to man-in-the-middle attacks if you proceed without caution.

Tailscale’s MagicDNS assigns each machine a name like my-server or my-server.tailnet-name.ts.net. These names are unique within your tailnet, and Tailscale can automatically obtain a publicly trusted certificate for them—without you needing to open any ports or expose your machine to the internet.

How the Tailscale Cert Command Works

The tailscale cert command leverages the ACME (Automatic Certificate Management Environment) protocol to request a certificate from Let’s Encrypt. Here’s the key insight: Tailscale already proves ownership of the MagicDNS name by responding to the ACME HTTP-01 challenge on the machine itself. Because Tailscale controls the DNS record for your machine, it can automatically complete the challenge without any manual configuration.

The command is simple:

tailscale cert your-machine.your-tailnet.ts.net

This outputs two files: your-machine.your-tailnet.ts.net.crt (the certificate) and your-machine.your-tailnet.ts.net.key (the private key). You then point your web server (like nginx, Caddy, or Apache) to these files.

Step-by-Step: Getting Rid of the Warning

Here is the exact process to eliminate the warning for a typical web server:

  1. Enable MagicDNS in the Tailscale admin console (it’s usually on by default).
  2. Run the cert command on the machine running your web server:
    tailscale cert your-machine.your-tailnet.ts.net
  3. Configure your web server to use the generated .crt and .key files. For example, in nginx, you’d set:
    ssl_certificate /path/to/your-machine.your-tailnet.ts.net.crt;
    ssl_certificate_key /path/to/your-machine.your-tailnet.ts.net.key;
  4. Reload your web server and access the service via the MagicDNS name (e.g., https://your-machine.your-tailnet.ts.net). The warning should be gone.

If you want the certificate to auto-renew, add a cron job or systemd timer to run tailscale cert periodically (Let’s Encrypt certificates are valid for 90 days).

Common Problems and Misconceptions

A frequent issue is that the command fails with an error like cert: Let's Encrypt rate limit or no DNS name. This usually happens if MagicDNS is disabled or if you’re using a custom domain that isn’t a MagicDNS name. The tailscale cert command only works for names ending in .ts.net (your tailnet’s MagicDNS suffix).

Another misconception: you don’t need to open any firewall ports. The ACME challenge is handled internally by Tailscale, so your machine can be completely behind NAT or a firewall.

If you’re using a custom domain (like example.com) pointed at your Tailscale machine, the tailscale cert command won’t work directly. You’d need to use a reverse proxy with a separate ACME client (like Certbot) and configure DNS-01 challenges, which is more involved.

Comparison: tailscale cert vs. Other Methods

There are several ways to get a trusted certificate for a Tailscale service:

  • tailscale cert: Simplest for MagicDNS names. No port forwarding, no external DNS management. Auto-renewal is manual but easy.
  • Reverse proxy with Caddy: Caddy automatically obtains and renews certificates for any domain, including custom ones, but requires a public IP or a DNS challenge setup.
  • Self-signed certificates: Free and easy, but browsers warn. You can install the self-signed cert on each client to suppress the warning, but that’s tedious and not scalable.
  • Tailscale Serve: This is a built-in feature that can proxy HTTPS traffic and automatically manages certificates for you. It’s even simpler than manually running tailscale cert.

If you’re using Tailscale Serve, you might not need to run tailscale cert at all—Serve handles the certificate automatically. However, tailscale cert gives you more control if you’re using a custom web server configuration.

Safety and Security Considerations

Using a valid Let’s Encrypt certificate ensures that traffic between your browser and your Tailscale machine is encrypted and authenticated. This is especially important when accessing sensitive services like a home NAS or a development server over the internet (even through Tailscale).

One caveat: the certificate is only valid for the MagicDNS name, not for the raw IP address. So always access your service via the hostname, not the IP, to avoid a warning.

Also, keep your private key secure. Anyone with the key can impersonate your server. Tailscale’s default file permissions are usually restrictive, but double-check that only the user running the web server can read the key.

Frequently Asked Questions

Does tailscale cert work on Windows or macOS?

Yes, the tailscale cert command works on all platforms where the Tailscale client runs, including Windows, macOS, Linux, and BSD. The syntax is identical.

How long is the certificate valid, and does it auto-renew?

Let’s Encrypt certificates are valid for 90 days. Tailscale does not automatically renew them; you need to set up a cron job or systemd timer to re-run tailscale cert before expiry. The command is idempotent and will reuse the same files.

Can I use tailscale cert with a custom domain?

No, tailscale cert only works for MagicDNS names ending in .ts.net. For a custom domain, you’ll need a reverse proxy with an ACME client that supports DNS-01 challenges (like Certbot with a DNS plugin) or use Tailscale Serve with a custom domain (which requires you to set up the DNS records yourself).

What if I get a rate limit error from Let’s Encrypt?

Let’s Encrypt has rate limits per domain and per IP. If you hit a rate limit, wait a few hours and try again. Avoid requesting certificates for the same name too frequently. If you’re testing, use the staging environment if Tailscale exposes that option, but the standard command is fine for normal use.

Will this fix the warning for all my services?

Only for services that use the generated certificate. If you have multiple services on different ports, you can use the same certificate for all of them as long as they share the same hostname. For different hostnames, you’ll need to run tailscale cert for each one.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →