What it is
About 726 words
Tailscale for Backstage keeps a Tailscale tailnet policy in the Backstage software catalog. You describe the policy as catalog entities, and Backstage puts the policy file together, shows it, and writes it to the GitHub repository that applies it to your tailnet.
Not affiliated with Tailscale Inc.
This is a community plugin by SpechtLabs. It is not made, endorsed or supported by Tailscale Inc. "Tailscale" is a trademark of Tailscale Inc.
Where the policy comes from
A tailnet policy file has sections: groups, hosts, tagOwners, grants, ssh, nodeAttrs, autoApprovers, tests and sshTests, plus top-level settings. The plugin fills each of them from the catalog:
| Section | Comes from |
|---|---|
groups | Backstage Groups with the specht-labs.de/tailnet-group annotation, and the logins of their Users |
hosts | the policy entity's spec.hosts |
tagOwners | Tailscale entities of spec.type: tag |
grants | Tailscale entities of spec.type: grant, and (with catalogGrants: true) grants made from APIs that Components consume across the tailnet |
ssh | Tailscale entities of spec.type: ssh |
nodeAttrs | Tailscale entities of spec.type: nodeAttr |
autoApprovers | Tailscale entities of spec.type: autoApprovers |
tests, sshTests | Tailscale entities of spec.type: test |
| anything else | the policy entity's spec.settings, written as it is |
Each kind: Tailscale entity is one piece of the file and has an owner, like any other catalog entity. The catalog validates it and relates it to its policy, its owner, its system and the entities it's about. From catalog to policy file walks through the whole path.
What you get
A policy console at /tailscale, and the same console as a Policy tab on each policy entity. It has:
- an access map of every grant, with destinations grouped by what they are (Services, peer meshes, capability targets, autogroups, devices, everything) and capability grants drawn as dashed lines;
- grants, Tailscale SSH, groups, tags, hosts, node attributes, auto approvers and tests, each linked to the entity it comes from;
- Preview access: pick a user, group or tag and see what it reaches, or pick a destination and see who reaches it;
- the rendered policy file, with each entity's lines highlighted;
- health checks: selectors that don't resolve, devices reached without a reason, capabilities or Services on every port.
Cards on entity pages. A Component, API, Resource, Group or User shows how it is on the tailnet: what it reaches, who reaches it, SSH into and out of it, its tags. A Tailscale entity shows the rule it is and the lines it renders to.
Publishing. Every hour the rendered file goes to a GitHub repository, as a pull request kept up to date or as a direct push. Applying the file to the tailnet stays with that repository, for example with Tailscale's GitOps action.
A local check. backstage-tailscale-diff renders a policy from local checkouts of your catalog repositories and compares it with a policy file, so you can check a change before you push it.
The packages
| Package | Install into | What it does |
|---|---|---|
@spechtlabs/backstage-plugin-tailscale-backend | packages/backend | Renders the policies, serves /api/tailscale, publishes to GitHub. Ships the backstage-tailscale-diff command. |
@spechtlabs/backstage-plugin-catalog-backend-module-tailscale | packages/backend | Adds kind: Tailscale to the catalog: validation and relations. |
@spechtlabs/backstage-plugin-tailscale | packages/app | The page, the Policy tab and the entity cards. |
@spechtlabs/backstage-plugin-tailscale-common | (a dependency of the others) | The entity model and its validation, the relations, the port syntax and the API types. |
The backend packages use Backstage's new backend system, and the frontend package uses the new frontend system. There is no export for the legacy frontend.
What it doesn't do
The plugin never talks to the Tailscale API. It doesn't read your tailnet's devices, and it doesn't apply the policy. It writes a file to a GitHub repository, and whatever applies that repository's file to the tailnet (the GitOps action, a CI job, a person) stays in charge of what goes live.
Publishing only targets GitHub.com: the backend calls https://api.github.com, so GitHub Enterprise Server repositories aren't supported.
