Assess Tailscale Security with cnspec
Secure and enforce policy for your Tailscale tailnet
Rely on cnspec to ensure your Tailscale tailnet follows security best practices, such as verifying device compliance, checking access control policies, and auditing user configurations.
Before you begin
Before you start, install cnspec.
Give cnspec access to your Tailscale tailnet
cnspec connects to Tailscale using an API access token. To create one:
- Log in to the Tailscale admin console.
- Navigate to Settings > Keys.
- Generate a new API access token.
- Copy the token value.
To test access, open a cnspec shell:
cnspec shell tailscale --token YOUR_TOKENYou can also set the TAILSCALE_TOKEN environment variable to omit the --token flag:
export TAILSCALE_TOKEN=YOUR_TOKEN
cnspec shell tailscaleScan your Tailscale tailnet
To scan your Tailscale tailnet:
cnspec scan tailscale --token YOUR_TOKENConnection options
| Option | Description |
|---|---|
--token | Tailscale API access token |
Example checks
Run cnspec shell tailscale --token YOUR_TOKEN to open the cnspec interactive shell. From there you can make checks like the examples below.
Ensure all devices are authorized
cnspec> tailscale.devices.all(authorized == true)
[ok] value: trueEnsure key expiry is enabled on all devices
cnspec> tailscale.devices.all(keyExpiryDisabled == false)
[ok] value: trueEnsure all devices are running the latest client
cnspec> tailscale.devices.all(updateAvailable == false)
[ok] value: trueEnsure no devices have tailnet lock errors
cnspec> tailscale.devices.all(tailnetLockError == "")
[ok] value: trueEnsure no users are idle
cnspec> tailscale.users.none(status == "idle")
[ok] value: trueList devices with their details
cnspec> tailscale.devices { name os addresses lastSeenAt }Learn more
-
To learn more about how the MQL query language works, read Write Effective MQL.
-
Explore the complete Mondoo Tailscale Resource Pack Reference.