announcement

Announcing the CloudQuery Tailscale Source Plugin

Yevgeny Pats

Yevgeny Pats

Introduction #

The Tailscale source plugin for CloudQuery is now officially maintained by Tailscale — big thanks to the Tailscale team!
With the new Tailscale plugin you can now easily query Tailscale config and bring config data to your infrastructure/operational lake. This way you can have all your infrastructure data in one place and correlate between different services.
As part of its initial release, the Tailscale plugin supports pulling data for the following APIs:
Let's look at a few useful queries.

Configuration #

First, let's quickly look at the source configuration so the plugin. The example below syncs the tailscale_devices table to PostgreSQL, making use of the new OAuth client to authenticate.
kind: source
# Common source-plugin configuration
spec:
  name: tailscale
  path: /path/to/downloaded/plugin # Buy from here: https://www.cloudquery.io/integrations/tailscale
  registry: local
  version: 'PREMIUM'
  tables: ['tailscale_devices']
  destinations: ['postgresql']
  # Tailscale specific configuration
  spec:
    client_id: 'YOUR_CLIENT_ID'
    client_secret: '${TAILSCALE_CLIENT_SECRET}'
    tailnet: 'cloudquery.io'

Example Queries #

Let's look at a few useful queries we can do just with the Tailscale tables.

Unseen devices #

Find all devices that weren't seen for more than 30 days:
select name, id, last_seen from tailscale_devices where last_seen < NOW() - INTERVAL '30 DAY';
tailnet    |             name              |        id         |      last_seen
---------------+-------------------------------+-------------------+---------------------
 cloudquery.io | example-name.tail341.ts.net   | 12345678082367896 | 2023-01-07 12:43:18

Key expiry disabled #

Find all devices with key expiry disabled
select name, id, last_seen from tailscale_devices where key_expiry_disabled;
tailnet    |             name              |        id         |      last_seen
---------------+-------------------------------+-------------------+---------------------
 cloudquery.io | example-name.tail341.ts.net   | 12345678082367896 | 2023-01-07 12:43:18

Distribution of devices #

Learn about how Tailscale client are distributed in your org across devices
select count(*), os from tailscale_devices group by os;
count |  os
-------+-------
   102 | macOS
   103 | linux
   70  | window

Find all devices of disabled Okta users #

Other cool things once you have Tailscale configuration in your database/datalake is that you can join and query it with data from other CloudQuery source plugins.
For example, the following will show all devices of users that were deactivated on Okta:
select td.tailnet, td.name, td.id, td.user, td.last_seen
from tailscale_devices td
    left join okta_users ou
        on td.user = ou.profile->>'email'
where ou.stats != 'ACTIVE'

Summary #

Using data from the new Tailscale source plugin you can slice and dice your Tailscale data in many ways, but the examples in this post should give you a good starting point.
Yevgeny Pats

Written by Yevgeny Pats

Yevgeny Pats is the Co-Founder & CEO at CloudQuery. Prior to establishing CloudQuery, he successfully founded and exited other startups. He has a background in software engineering and cybersecurity.

Turn cloud chaos into clarity

Find out how CloudQuery can help you get clarity from a chaotic cloud environment with a personalized conversation and demo.

Join our mailing list

Subscribe to our newsletter to make sure you don't miss any updates.

Legal

© 2024 CloudQuery, Inc. All rights reserved.

We use tracking cookies to understand how you use the product and help us improve it. Please accept cookies to help us improve. You can always opt out later via the link in the footer.