From ace89a0e23c3fc860501a652f7e2ed404ee0d5dd Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Wed, 11 Nov 2026 14:16:00 +0000 Subject: [PATCH] types: regenerate config docs for tailsql --- docs/ref/config-example.yaml | 14 +++++ docs/ref/configuration-options.md | 66 ++++++++++++++++++++++++ hscontrol/types/config_docs_generated.go | 3 ++ nix/options.generated.nix | 18 +++++++ 4 files changed, 101 insertions(+) diff --git a/docs/ref/config-example.yaml b/docs/ref/config-example.yaml index de757ac14..21e90715e 100644 --- a/docs/ref/config-example.yaml +++ b/docs/ref/config-example.yaml @@ -418,6 +418,20 @@ auto_update: # clients. enabled: false +# [tailsql](https://github.com/tailscale/tailsql), a read-only SQL web UI over +# the headscale database, served as the node `tailsql` with `tag:tailsql` on +# headscale's own tailnet. Headscale mints its credential, joins it in memory +# and re-joins it if the node is deleted. Nobody can query it until the policy +# lists `"tag:tailsql": []` in `tagOwners` and a grant to `tag:tailsql` gives +# `ip` `tcp:80` (and `tcp:443` with `dns.certificates`) and `app` +# `{"tailscale.com/cap/tailsql": [{"src": ["headscale"]}]}`. +tailsql: + # Runs tailsql. It needs `database.type` sqlite. + enabled: false + # Holds the node's identity. Losing it registers a new node, `tailsql-1`, and + # leaves the old one for an admin to delete. + state_dir: /var/lib/headscale/tailsql + # How the headscale CLI reaches the server: the local `unix_socket` without # authentication, or a remote `cli.address` with `cli.api_key`. The CLI reads # these keys from its own configuration, such as diff --git a/docs/ref/configuration-options.md b/docs/ref/configuration-options.md index 3943ff53a..1a866ad3a 100644 --- a/docs/ref/configuration-options.md +++ b/docs/ref/configuration-options.md @@ -3128,6 +3128,72 @@ Makes auto-update the default for clients that have not chosen locally. Clients services.headscale.settings.auto_update.enabled = true; ``` +## `tailsql` { #tailsql data-toc-label="tailsql" } + +[tailsql](https://github.com/tailscale/tailsql), a read-only SQL web UI over the headscale database, served as the node `tailsql` with `tag:tailsql` on headscale's own tailnet. Headscale mints its credential, joins it in memory and re-joins it if the node is deleted. Nobody can query it until the policy lists `"tag:tailsql": []` in `tagOwners` and a grant to `tag:tailsql` gives `ip` `tcp:80` (and `tcp:443` with [`dns.certificates`](#dns.certificates)) and `app` `{"tailscale.com/cap/tailsql": [{"src": ["headscale"]}]}`. + +??? example "All `tailsql` keys and defaults" + + ```yaml + tailsql: + enabled: false + state_dir: /var/lib/headscale/tailsql + ``` + +### `tailsql.enabled` { #tailsql.enabled data-toc-label="enabled" } + +- **Type:** [boolean](#type-boolean) +- **Default:** `false` +- **Env:** `HEADSCALE_TAILSQL_ENABLED` + +Runs tailsql. It needs [`database.type`](#database.type) sqlite. + +=== "YAML" + + ```yaml + tailsql: + enabled: true + ``` + +=== "Environment" + + ```shell + export HEADSCALE_TAILSQL_ENABLED=true + ``` + +=== "NixOS" + + ```nix + services.headscale.settings.tailsql.enabled = true; + ``` + +### `tailsql.state_dir` { #tailsql.state_dir data-toc-label="state_dir" } + +- **Type:** [string](#type-string) +- **Default:** `/var/lib/headscale/tailsql` +- **Env:** `HEADSCALE_TAILSQL_STATE_DIR` + +Holds the node's identity. Losing it registers a new node, `tailsql-1`, and leaves the old one for an admin to delete. + +=== "YAML" + + ```yaml + tailsql: + state_dir: /srv/headscale/tailsql + ``` + +=== "Environment" + + ```shell + export HEADSCALE_TAILSQL_STATE_DIR=/srv/headscale/tailsql + ``` + +=== "NixOS" + + ```nix + services.headscale.settings.tailsql.state_dir = "/srv/headscale/tailsql"; + ``` + ## `cli` { #cli data-toc-label="cli" } How the headscale CLI reaches the server: the local [`unix_socket`](#unix_socket) without authentication, or a remote [`cli.address`](#cli.address) with [`cli.api_key`](#cli.api_key). The CLI reads these keys from its own configuration, such as `~/.config/headscale/config.yaml`, or from `HEADSCALE_CLI_*` variables; the server does not read them, so on NixOS they do not belong in `services.headscale.settings`. See [Remote control](api.md#remote-control). diff --git a/hscontrol/types/config_docs_generated.go b/hscontrol/types/config_docs_generated.go index d5495c966..edd8eb0d9 100644 --- a/hscontrol/types/config_docs_generated.go +++ b/hscontrol/types/config_docs_generated.go @@ -34,6 +34,7 @@ var configFieldDocs = map[string]string{ "Config.Prefixes": "The IP ranges node addresses are allocated from. Keep at least one of `prefixes.v4` and `prefixes.v6`. Use the Tailscale ranges, `100.64.0.0/10` and `fd7a:115c:a1e0::/48`, or ranges inside them: the client assumes them, and other ranges are unsupported.", "Config.ServerURL": "The URL clients connect to, with its `http://` or `https://` scheme, e.g. `https://headscale.example.com:443`. A trailing slash is trimmed on load. Its host must not be `dns.base_domain` or a name below it.", "Config.TLS": "Headscale's own HTTPS certificate on `listen_addr`: from the files `tls.cert_path` and `tls.key_path`, or from ACME in `tls.acme`, not both. Without either, the server speaks plain HTTP. See [TLS](https://headscale.net/stable/ref/tls/).", + "Config.TailSQL": "[tailsql](https://github.com/tailscale/tailsql), a read-only SQL web UI over the headscale database, served as the node `tailsql` with `tag:tailsql` on headscale's own tailnet. Headscale mints its credential, joins it in memory and re-joins it if the node is deleted. Nobody can query it until the policy lists `\"tag:tailsql\": []` in `tagOwners` and a grant to `tag:tailsql` gives `ip` `tcp:80` (and `tcp:443` with `dns.certificates`) and `app` `{\"tailscale.com/cap/tailsql\": [{\"src\": [\"headscale\"]}]}`.", "Config.Taildrop": "Taildrop, Tailscale's file sharing between nodes.", "Config.TrustedProxies": "The CIDRs of reverse proxies whose `True-Client-IP`, `X-Real-IP` and `X-Forwarded-For` headers are honoured. Empty ignores those headers. Set without a proxy in front, clients can spoof their source IP in logs and the v2 API.", "Config.Tuning": "Holds performance settings that rarely need changing.", @@ -122,6 +123,8 @@ var configFieldDocs = map[string]string{ "TLSConfig.ACME": "Gets the certificate from an ACME CA such as Let's Encrypt, and renews it. Setting `tls.acme.hostname` turns it on.", "TLSConfig.CertPath": "The PEM certificate file, relative to the configuration file. Setting it turns TLS on.", "TLSConfig.KeyPath": "The PEM private key file of `tls.cert_path`, relative to the configuration file.", + "TailSQLConfig.Enabled": "Runs tailsql. It needs `database.type` sqlite.", + "TailSQLConfig.StateDir": "Holds the node's identity. Losing it registers a new node, `tailsql-1`, and leaves the old one for an admin to delete.", "TaildropConfig.Enabled": "Gives every node the file-sharing capability. False omits it from the baseline; a policy `nodeAttrs` grant can still give it.", "Tuning.BatchChangeDelay": "How often queued changes are sent to clients as one update; must be positive.", "Tuning.BatcherWorkers": "The number of workers building map updates for connected clients. Zero picks the number from the CPU count.", diff --git a/nix/options.generated.nix b/nix/options.generated.nix index 62b8f04fe..2e243e2d9 100644 --- a/nix/options.generated.nix +++ b/nix/options.generated.nix @@ -978,6 +978,24 @@ in example = true; }; }; + tailsql = { + enabled = lib.mkOption { + type = lib.types.bool; + default = false; + description = '' + Runs tailsql. It needs `database.type` sqlite. + ''; + example = true; + }; + state_dir = lib.mkOption { + type = lib.types.str; + default = "/var/lib/headscale/tailsql"; + description = '' + Holds the node's identity. Losing it registers a new node, `tailsql-1`, and leaves the old one for an admin to delete. + ''; + example = "/srv/headscale/tailsql"; + }; + }; tuning = { batch_change_delay = lib.mkOption { type = t.duration;