turbot/tailscale
steampipe plugin install tailscale

Tailscale + Steampipe

Tailscale is a zero config VPN which installs on any device in minutes and manages firewall rules.

Steampipe is an open-source zero-ETL engine to instantly query cloud APIs using SQL.

List devices which block incoming connections in your Tailscale tailnet:

select
name,
device.user,
created,
tailnet_name
from
tailscale_device as device
where
blocks_incoming_connections;
+------------------------------------+-----------+---------------------------+--------------+
| name | user | created | tailnet_name |
+------------------------------------+-----------+---------------------------+--------------+
| francis-macbook-pro.turbot.com | francis | 2022-09-19T10:28:55+08:00 | testdo.com |
| oneplus-nord2-5g.testdo.com | keyma | 2022-09-19T16:58:56+08:00 | testdo.com |
| test-macbook-pro.testdo.com | test | 2022-09-19T10:27:55+08:00 | testdo.com |
| ip-172-32-10-22.testdo.com | steampipe | 2022-09-20T12:50:55+08:00 | testdo.com |
+------------------------------------+-----------+---------------------------+--------------+

Documentation

Get started

Install

Download and install the latest Tailscale plugin:

steampipe plugin install tailscale

Configuration

Installing the latest tailscale plugin will create a config file (~/.steampipe/config/tailscale.spc) with a single connection named tailscale:

connection "tailscale" {
plugin = "tailscale"
# Required: Set your API Key and Tailnet name
# Generate your API Key per: https://tailscale.com/kb/1101/api/
api_key = "abcde-krSvfN1CNTRL-M67st8X5o1234567"
tailnet_name = "example.com"
}
  • api_key - API Key of the Tailscale account.
  • tailnet_name - Name of your Tailnet.

Environment variables are also available as an alternate configuration method:

  • TAILSCALE_API_KEY
  • TAILSCALE_TAILNET

Postgres FDW

This plugin is available as a native Postgres FDW. Unlike Steampipe CLI, which ships with an embedded Postgres server instance, the Postgres FDW can be installed in any supported Postgres database version.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_postgres_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/postgres.sh)" -- tailscale

The installer will prompt you for the plugin name and version, download and install the appropriate files for your OS, system architecture, and Postgres version.

To configure the Postgres FDW, you will create an extension, foreign server, and schema and import the foreign schema.

CREATE EXTENSION IF NOT EXISTS steampipe_postgres_tailscale;
CREATE SERVER steampipe_tailscale FOREIGN DATA WRAPPER steampipe_postgres_tailscale OPTIONS (config '<your_config>');
CREATE SCHEMA tailscale;
IMPORT FOREIGN SCHEMA tailscale FROM SERVER steampipe_tailscale INTO tailscale;

SQLite Extension

This plugin is available as a SQLite Extension, making the tables available as SQLite virtual tables.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_sqlite_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/sqlite.sh)" -- tailscale

The installer will prompt you for the plugin name, version, and destination directory. It will then determine the OS and system architecture, and it will download and install the appropriate package.

To configure the SQLite extension, load the extension module and then run the steampipe_configure_tailscale function to configure it with plugin-specific options.

$ sqlite3
sqlite> .load ./steampipe_sqlite_extension_tailscale.so
sqlite> select steampipe_configure_tailscale('<your_config>');

Export

This plugin is available as a standalone Export CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- tailscale

You can pass the configuration to the command with the --config argument:

steampipe_export_tailscale --config '<your_config>' <table_name>