kind: Tailscale
About 1110 words
Every field of the kind: Tailscale entity, by spec.type. The catalog module checks the shapes listed under Validation when the catalog processes an entity; an entity that fails is refused with every problem in one message, such as Invalid Tailscale grant: spec.src is required; spec.ip: not ports: tcp:http. References (does this group exist, is this tag declared) are checked later, when the backend renders the policy, and show up as problems.
The envelope
apiVersion: specht-labs.de/v1alpha1
kind: Tailscale
metadata:
name: grant-admins-grafana
namespace: default # optional
title: Admins use Grafana # becomes the comment above the rendered lines
description: … # appended to that comment
spec:
type: grant
# …| Field | Value |
|---|---|
apiVersion | specht-labs.de/v1alpha1 |
kind | Tailscale |
metadata.title, metadata.description | Optional. Rendered as a comment above the entity's lines in the policy file, and shown in the console. |
metadata.annotations | Optional. A tag entity reads specht-labs.de/tailnet-device-reason; see Annotations. |
Fields of every type
| Field | Type | Required | Meaning |
|---|---|---|---|
type | string | yes | policy, grant, ssh, tag, nodeAttr, autoApprovers or test |
target | entity reference | on every type but policy | The policy this entity belongs to. Default kind Tailscale, default namespace the entity's own. |
owner | entity reference | yes | The owner, as on any catalog entity. Default kind Group. |
system | entity reference | no | The System it's part of. Default kind System. |
appliesTo | list of entity references | no | Catalog entities it's about; their pages list it. Default kind Component. |
Validation: target, owner and system must be non-empty strings; appliesTo must be a list of non-empty strings.
policy
The policy file as a whole. Renders the hosts section and every top-level setting.
| Field | Type | Required | Meaning |
|---|---|---|---|
tailnet | string | no | The tailnet's name, such as example.ts.net. Shown in the console, the file's header comment and the pull request title. |
hosts | map of name to address | no | The file's hosts section. |
catalogGrants | boolean | no | true adds grants made from the catalog's tailnet annotations. See Grants from the catalog. |
settings | object | no | Every other top-level key of the file, rendered as written, after all sections. Must not contain groups, hosts, tagOwners, nodeAttrs, autoApprovers, ssh, grants, acls, tests or sshTests. |
publish | object | no | Where the file is published; see below. |
publish:
| Field | Type | Required | Meaning |
|---|---|---|---|
repo | string | yes | owner/name on GitHub.com. Must be listed in tailscale.allowedRepos. |
path | string | yes | The file in the repository. |
flow | pullRequest or push | no | Default pullRequest. |
branch | string | no | The branch the file lands on. Default: the repository's default branch. |
pullRequestBranch | string | no | For pullRequest: the branch Backstage owns and force-pushes. Default backstage/tailscale-<metadata.name>. |
Validation: tailnet is a non-empty string; every hosts value is a string; settings and publish are objects; publish.repo matches owner/name (letters, digits, _, ., -); publish.path is set; publish.flow is pullRequest or push; the branches are strings.
grant
One entry of grants.
| Field | Type | Required | Rendered as |
|---|---|---|---|
src | list of selectors | yes, at least one | src; user: references become logins |
dst | list of selectors | yes, at least one | dst |
ip | list of ports | ip or app | ip |
app | map of capability to list of objects | ip or app | app |
via | list of selectors | no | via |
srcPosture | list of strings | no | srcPosture |
Ports are *, a port (443), a range (1000-2000), or either with a protocol (tcp:443, udp:*). Capability names must look like <domain>/cap/<name>, such as tailscale.com/cap/tsidp.
A svc: name in src is an error: Services are destinations.
ssh
One entry of ssh.
| Field | Type | Required | Rendered as |
|---|---|---|---|
action | accept or check | yes | action |
src | list of selectors | yes, at least one | src |
dst | list of selectors | yes, at least one | dst |
users | list of strings | yes, at least one | users, as written (local user names, autogroup:nonroot and so on) |
checkPeriod | string | no | checkPeriod |
acceptEnv | list of strings | no | acceptEnv |
recorder | list of selectors | no | recorder |
enforceRecorder | boolean | no | enforceRecorder, as written |
tag
One tag of tagOwners.
| Field | Type | Required | Rendered as |
|---|---|---|---|
tag | string | yes | the key: tag: followed by a letter or digit, then letters, digits and hyphens |
owners | list of selectors | yes, at least one | the tag's owners |
A rule that uses a tag needs a tag entity for it in the same policy. Two tag entities for the same tag are an error; the first one by name counts.
nodeAttr
One entry of nodeAttrs.
| Field | Type | Required | Rendered as |
|---|---|---|---|
nodes | list of selectors | yes, at least one | target (the file's name for it; spec.target is the policy) |
attr | list of strings | attr or app | attr |
app | map of capability to list of objects | attr or app | app |
ipPool | list of strings | no | ipPool |
autoApprovers
Part of autoApprovers. Needs at least one of the three fields.
| Field | Type | Rendered as |
|---|---|---|
routes | map of CIDR to list of selectors | autoApprovers.routes |
services | map of svc:<name> to list of selectors | autoApprovers.services; names in lowercase letters, digits and hyphens |
exitNode | list of selectors | autoApprovers.exitNode |
Each list in routes and services needs at least one entry. When several entities approve the same route or Service, the file lists it once with every entity's approvers.
test
Entries of tests and sshTests. Needs at least one of the two fields, each one test or a list of tests.
tests:
| Field | Type | Required | Rendered as |
|---|---|---|---|
src | selector | yes | src; user: references become logins |
proto | string | no | proto |
accept | list of <target>:<port> | accept or deny | accept; the target before the last : is resolved |
deny | list of <target>:<port> | accept or deny | deny; resolved the same way |
srcPostureAttrs is accepted in the entity but not rendered.
sshTests:
| Field | Type | Required | Rendered as |
|---|---|---|---|
src | selector | yes | src |
dst | list of selectors | yes | dst |
accept | list of local users | no | accept |
check | list of local users | no | check |
deny | list of local users | no | deny |
Selectors
Wherever a field takes selectors, these are accepted and checked when the policy renders:
| Selector | Must match |
|---|---|
* | nothing |
group:<name> | a Backstage Group annotated with it, or a Group named <name> |
group:<namespace>/<name> | that Backstage Group |
user:<name>, user:<namespace>/<name> | a Backstage User with specht-labs.de/tailnet-login; rendered as the login |
a login with @ | nothing; rendered as written |
tag:<name> | a tag entity of the same policy |
svc:<name> | nothing |
autogroup:<name> | nothing |
ipset:<name> | a key of the policy's settings.ipsets |
| an IPv4 or IPv6 address or CIDR | nothing |
| any other name | a key of the policy's hosts |
