brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: put a tests block in your Tailscale policy file

Network and access
~/tips/tip-tailscale-acl-tests

"tests": [

Adds checks to the policy file that reject any change breaking an access rule you wrote down.

A policy file that cannot be saved when it breaks your own rules is a feature I would want everywhere.

The tests section holds assertions about who can reach what. Tailscale runs them every time the policy changes, and if one fails the update is rejected with an error naming the failing test.

"tests": [
  {
    "src": "[email protected]",
    "proto": "tcp",
    "accept": ["example-host-1:22"],
    "deny": ["192.0.2.3:443"]
  }
]

Each entry is host:port with one numeric port. The host can be a Tailscale IP, a host alias, a user, a group, a tag or a service. The src can be a user, group, tag or host. For ICMP use "proto": "icmp" and port 0.

The deny lines are the useful ones. They lock in what must never work, like a database port from the guest group, so a later edit cannot quietly open it.

Caveat: CIDR ranges and * wildcards are not valid in tests. SSH rules have their own sshTests block with accept, check and deny lists of usernames.

Treat the block like a unit test for your network. I would write the deny lines while calm, not at midnight with an access rule half edited.

Further reading: Tailnet policy file syntax, On this site: use action check in a Tailscale SSH rule for a re-login, On this site: an exit node needs a grant to autogroup:internet, not to itself

More Network and access tips scp -3 alice@server-a:/var/backups/db.sql.gz bob@server-b:/srv/restore/ tailscale exit-node suggest tailscale lock sign nodekey:1abddef1 tlpub:abcdef12 wg genpsk > peer1.psk Table = off All Network and access tips (163) All topics

Link