From e1f3ad61fb29205a8f3c8c8ab42f0a291fea03fe Mon Sep 17 00:00:00 2001 From: Johan Siebens Date: Sat, 26 Apr 2025 21:54:11 +0200 Subject: [PATCH] chore: updates docs --- mkdocs/docs/configuration/auth-oidc.md | 191 +++++++++++++++++++++ mkdocs/docs/configuration/dns-providers.md | 176 +++++++++++++++++++ mkdocs/docs/getting-started/docker.md | 72 -------- mkdocs/docs/getting-started/index.md | 84 +++++++++ mkdocs/docs/getting-started/manual.md | 115 ------------- mkdocs/docs/getting-started/tailnet.md | 191 +++++++++++++++++++++ mkdocs/docs/index.md | 47 +++-- mkdocs/docs/installation/docker.md | 101 +++++++++++ mkdocs/docs/installation/index.md | 38 ++++ mkdocs/docs/installation/linux.md | 155 +++++++++++++++++ mkdocs/docs/overview/features.md | 59 +++++++ mkdocs/docs/stylesheets/extra.css | 126 ++++++++++++++ mkdocs/mkdocs.yml | 113 ++++++++++-- 13 files changed, 1245 insertions(+), 223 deletions(-) create mode 100644 mkdocs/docs/configuration/auth-oidc.md create mode 100644 mkdocs/docs/configuration/dns-providers.md delete mode 100644 mkdocs/docs/getting-started/docker.md create mode 100644 mkdocs/docs/getting-started/index.md delete mode 100644 mkdocs/docs/getting-started/manual.md create mode 100644 mkdocs/docs/getting-started/tailnet.md create mode 100644 mkdocs/docs/installation/docker.md create mode 100644 mkdocs/docs/installation/index.md create mode 100644 mkdocs/docs/installation/linux.md create mode 100644 mkdocs/docs/overview/features.md create mode 100644 mkdocs/docs/stylesheets/extra.css diff --git a/mkdocs/docs/configuration/auth-oidc.md b/mkdocs/docs/configuration/auth-oidc.md new file mode 100644 index 0000000..0b79207 --- /dev/null +++ b/mkdocs/docs/configuration/auth-oidc.md @@ -0,0 +1,191 @@ +# Configuring authentication with OIDC + +While ionscale can operate without an OIDC (OpenID Connect) provider using only static keys, configuring an OIDC provider is highly recommended for enhanced security, user management, and a smoother administrative experience. + +## Why configure an OIDC provider? + +Without an OIDC provider, ionscale operates in a key-only mode: + +- System administrators can only use the system admin key for administrative tasks +- Tailscale devices can only connect using [tags](https://tailscale.com/kb/1068/tags) and [pre-authentication keys](https://tailscale.com/kb/1085/auth-keys) +- No user accounts or user-specific permissions are available + +With an OIDC provider configured: + +- Users can authenticate using their existing identity provider credentials +- Administrators can assign specific permissions to users +- System administration can be delegated to specific users +- Fine-grained access control based on user identity becomes possible +- More seamless user experience with browser-based authentication + +## Supported OIDC providers + +ionscale supports any standard OIDC provider, including: + +- Google Workspace +- Auth0 +- Okta +- Azure AD / Microsoft Entra ID +- Keycloak +- GitLab +- GitHub (OAuth 2.0 with OIDC extensions) +- And many others + +## Basic OIDC configuration + +To configure an OIDC provider, update your ionscale configuration file (`config.yaml`) with the following settings: + +```yaml +auth: + provider: + # OIDC issuer URL where ionscale can find the OpenID Provider Configuration Document + issuer: "https://your-oidc-provider.com" + # OIDC client ID and secret + client_id: "your-client-id" + client_secret: "your-client-secret" + # Optional: additional OIDC scopes used in the OIDC flow + additional_scopes: "groups" +``` + +### Required configuration fields + +- `issuer`: The URL to your OIDC provider's issuer. This URL is used to discover your provider's endpoints. +- `client_id`: The client ID from your OIDC provider application registration. +- `client_secret`: The client secret from your OIDC provider application registration. + +### Optional configuration + +- `additional_scopes`: A space-separated list of additional OAuth scopes to request during authentication. + By default, ionscale requests the `openid`, `email`, and `profile` scopes. + +## Configuring your OIDC provider + +When registering ionscale with your OIDC provider, you'll need to configure the following: + +**Redirect URI**: Set to `https://your-ionscale-domain.com/auth/callback` + +## System administrator access + +With OIDC configured, you'll want to specify which users have system administrator privileges. +This is done in the `auth.system_admins` section of your configuration: + +```yaml +auth: + # Configuration from previous section... + + system_admins: + # By email address + emails: + - "admin@example.com" + - "secadmin@example.com" + + # By subject identifier (sub claim from OIDC) + subs: + - "user|123456" + + # By attribute expression (using BEXPR syntax) + filters: + - "token.groups contains \"admin\"" + - "domain == \"admin.example.com\"" +``` + +You can use one or more of these methods to designate system administrators: + +1. **By Email**: List specific email addresses that should have admin privileges. +2. **By Subject ID**: List specific user IDs (the `sub` claim from your OIDC provider). +3. **By Expression**: Use BEXPR filters to determine admin status based on token claims. + +## OIDC authentication flow + +When a user attempts to authenticate with ionscale: + +1. The user is redirected to the OIDC provider's login page. +2. After successful authentication, the user is redirected back to ionscale. +3. ionscale verifies the authentication and checks if: + - The user is a system administrator (based on the `system_admins` configuration). + - The user has access to any tailnets (based on IAM policies configured for individual tailnets). + +## Provider-specific setup instructions + +### Google + +1. Go to the [Google Cloud Console](https://console.cloud.google.com/). +2. Create a new project or select an existing one. +3. Navigate to "APIs & Services" > "Credentials". +4. Click "Create Credentials" > "OAuth client ID". +5. Select "Web application" as the application type. +6. Add `https://your-ionscale-domain.com/auth/callback` as an authorized redirect URI. +7. Copy the client ID and client secret. + +Configure ionscale: +```yaml +auth: + provider: + issuer: "https://accounts.google.com" + client_id: "your-client-id.apps.googleusercontent.com" + client_secret: "your-client-secret" +``` + +### Auth0 + +1. Go to the [Auth0 Dashboard](https://manage.auth0.com/). +2. Create a new application or select an existing one of type "Regular Web Application". +3. Under "Settings", configure: + - Allowed Callback URLs: `https://your-ionscale-domain.com/auth/callback` +4. Copy the Domain, Client ID, and Client Secret. + +Configure ionscale: +```yaml +auth: + provider: + issuer: "https://your-tenant.auth0.com/" + client_id: "your-client-id" + client_secret: "your-client-secret" +``` + +### Microsoft Azure AD / Entra ID + +1. Go to the [Azure Portal](https://portal.azure.com/). +2. Navigate to "Azure Active Directory" > "App registrations". +3. Create a new registration. +4. Add `https://your-ionscale-domain.com/auth/callback` as a redirect URI of type "Web". +5. Under "Certificates & secrets", create a new client secret. +6. Copy the Application (client) ID and the new secret. + +Configure ionscale: +```yaml +auth: + provider: + issuer: "https://login.microsoftonline.com/your-tenant-id/v2.0" + client_id: "your-client-id" + client_secret: "your-client-secret" + additional_scopes: "offline_access" +``` + +## Complete configuration example + +```yaml +auth: + provider: + issuer: "https://accounts.google.com" + client_id: "your-client-id.apps.googleusercontent.com" + client_secret: "your-client-secret" + additional_scopes: "groups" + + system_admins: + emails: + - "admin@example.com" + filters: + - "domain == \"example.com\" && token.groups contains \"admin\"" +``` + +## OIDC without system admin + +If you've configured OIDC but no system administrators, you can still use the system admin key from your initial setup for administrative tasks: + +```bash +export IONSCALE_URL="https://your-ionscale-domain.com" +export IONSCALE_KEY="your-system-admin-key" +ionscale tailnet list +``` + diff --git a/mkdocs/docs/configuration/dns-providers.md b/mkdocs/docs/configuration/dns-providers.md new file mode 100644 index 0000000..3da960e --- /dev/null +++ b/mkdocs/docs/configuration/dns-providers.md @@ -0,0 +1,176 @@ +# Configuring DNS providers + +ionscale supports integration with various DNS providers to enable Tailscale's HTTPS certificate functionality. When a DNS provider is properly configured, ionscale can automatically manage TXT records required for the DNS-01 challenge when requesting certificates. + +## Why configure a DNS provider + +While not strictly required for basic ionscale operation, configuring a DNS provider enables important Tailscale features: + +1. **Tailscale HTTPS Certificates**: Allows nodes to receive valid HTTPS certificates for their Tailscale hostnames, enabling secure web services within your tailnet. +2. **Tailscale Serve**: Supports the `tailscale serve` feature, which allows users to easily share web services with proper HTTPS. + +Without a configured DNS provider, these features will not be available to your users. + +## Supported DNS providers + +ionscale uses the [libdns](https://github.com/libdns) libraries to support the following DNS providers: + +- [Azure DNS](https://github.com/libdns/azure) +- [Cloudflare](https://github.com/libdns/cloudflare) +- [DigitalOcean](https://github.com/libdns/digitalocean) +- [Google Cloud DNS](https://github.com/libdns/googleclouddns) +- [Amazon Route 53](https://github.com/libdns/route53) + +!!! info "Provider availability" + These are the DNS providers supported at the time of this writing. Since ionscale uses the libdns ecosystem, additional providers may be added in future releases as the ecosystem expands. + + If you need support for a different DNS provider, check the [libdns GitHub organization](https://github.com/libdns) for newly available providers or consider contributing an implementation for your provider. + +!!! note "Future plugin system" + A plugin system for DNS providers is currently in the ideation phase. This would make it significantly easier to add and configure additional DNS providers without modifying the core ionscale code. Stay tuned for updates on this feature in future releases. + +## DNS provider configuration + +To configure a DNS provider, add the appropriate settings to your ionscale configuration file (`config.yaml`): + +```yaml +dns: + # The base domain for MagicDNS FQDN hostnames + magic_dns_suffix: "ionscale.net" + + # DNS provider configuration for HTTPS certificates + provider: + # Name of your DNS provider + name: "cloudflare" + # The DNS zone to use (typically your domain name) + zone: "example.com" + # Provider-specific configuration (varies by provider) + config: + # Provider-specific credentials and settings go here + # See provider-specific examples below +``` + +### Important requirements + +1. The `magic_dns_suffix` must be a subdomain of the provider's zone (or the zone itself). +2. MagicDNS must be enabled for the tailnet to use HTTPS certificates. +3. You must have administrative access to the DNS zone to configure the provider. + +## Provider-specific examples + +### Cloudflare + +```yaml +dns: + magic_dns_suffix: "ts.example.com" + provider: + name: "cloudflare" + zone: "example.com" + config: + auth_token: "your-cloudflare-api-token" + # OR use email/api_key authentication + # email: "your-email@example.com" + # api_key: "your-global-api-key" +``` + +For Cloudflare, create an API token with the "Edit" permission for "Zone:DNS". + +### Azure DNS + +```yaml +dns: + magic_dns_suffix: "ts.example.com" + provider: + name: "azure" + zone: "example.com" + config: + tenant_id: "your-tenant-id" + client_id: "your-client-id" + client_secret: "your-client-secret" + subscription_id: "your-subscription-id" + resource_group_name: "your-resource-group" +``` + +For Azure, create a service principal with "DNS Zone Contributor" role for your DNS zone's resource group. + +### Amazon Route 53 + +```yaml +dns: + magic_dns_suffix: "ts.example.com" + provider: + name: "route53" + zone: "example.com" + config: + access_key_id: "your-access-key-id" + secret_access_key: "your-secret-access-key" + # Optional region, defaults to us-east-1 + region: "us-east-1" +``` + +For AWS Route 53, create an IAM user with permissions to modify records in your hosted zone. + +### Google Cloud DNS + +```yaml +dns: + magic_dns_suffix: "ts.example.com" + provider: + name: "googleclouddns" + zone: "example-com" # Note: GCP uses zone names without dots + config: + project: "your-project-id" + # Either provide service account JSON directly + service_account_json: '{"type":"service_account","project_id":"your-project",...}' + # OR specify a path to a service account key file + # service_account_key_file: "/path/to/service-account-key.json" +``` + +For Google Cloud DNS, create a service account with the "DNS Administrator" role. + +### DigitalOcean + +```yaml +dns: + magic_dns_suffix: "ts.example.com" + provider: + name: "digitalocean" + zone: "example.com" + config: + token: "your-digitalocean-api-token" +``` + +For DigitalOcean, create an API token with read and write access. + +## Enabling HTTPS certificates for a tailnet + +After configuring a DNS provider in your ionscale server, you can enable HTTPS certificates for a tailnet: + +```bash +# Enable MagicDNS and HTTPS certificates for a tailnet +ionscale dns update --tailnet "my-tailnet" --magic-dns --https-certs +``` + +## Verifying DNS provider configuration + +To verify that your DNS provider is correctly configured: + +1. Configure a tailnet with MagicDNS and HTTPS certificates enabled. +2. Connect a device to the tailnet. +3. On the device, run: + ```bash + tailscale cert + ``` +4. If successful, the command will obtain a certificate for the hostname. +5. You should see TXT records created in your DNS zone for the ACME challenge. + +## Troubleshooting + +If you encounter issues with DNS provider integration: + +1. **Check DNS Provider Credentials**: Ensure the credentials in your configuration have sufficient permissions. +2. **Verify Zone Configuration**: Make sure the zone in your configuration matches your actual DNS zone. +3. **Check MagicDNS Settings**: Confirm that `magic_dns_suffix` is properly configured as a subdomain of your zone. +4. **Review Server Logs**: The ionscale server logs may contain error messages related to DNS provider integration. +5. **Test DNS Record Creation**: Some providers offer tools to test API access for creating and updating DNS records. + diff --git a/mkdocs/docs/getting-started/docker.md b/mkdocs/docs/getting-started/docker.md deleted file mode 100644 index d6113f4..0000000 --- a/mkdocs/docs/getting-started/docker.md +++ /dev/null @@ -1,72 +0,0 @@ -# Getting started with Docker - -You can install and run __ionscale__ using the Docker images published on [GitHub Container Registry](https://github.com/jsiebens/ionscale/pkgs/container/ionscale). - -## Requirements - -- A Linux machine with port 443 and 3478 open to ingress traffic. -- Docker installed. See the [official installation documentation](https://docs.docker.com/install/) -- A registered domain name. - -## Step 1. Configure DNS - -Set up a `A` DNS records: `ionscale.example.com` (We are assuming that your domain name is example.com.) - -!!! tip - - You can use `dig` to make sure that DNS records are propagated: - - ``` bash - $ dig ionscale.example.com - ``` - -## Step 2. Run ionscale with Docker - -### Configure ionscale - -``` bash -mkdir -p ionscale/data -cd ./ionscale -``` - -Generate a configuration file for __ionscale__ with the following commands: - -``` bash -export IONSCALE_ACME_EMAIL= -export IONSCALE_DOMAIN=ionscale.example.com -export IONSCALE_SYSTEM_ADMIN_KEY=$(docker run ghcr.io/jsiebens/ionscale:0.15.0 genkey -n) -``` - -``` bash -tee ./config.yaml >/dev/null </dev/null < -export IONSCALE_DOMAIN=ionscale.example.com -``` - -``` bash -sudo tee /etc/ionscale/config.yaml >/dev/null </dev/null < **Note**: -> ionscale is currently beta quality, actively being developed and so subject to changes +ionscale is an open-source alternative to Tailscale's control server, designed to provide a self-hosted coordination service for your Tailscale networks. -**What is Tailscale?** +!!! info "Beta status" + ionscale is currently in beta. While it's stable for production use for small tailnets, we're actively developing new features and improvements. -[Tailscale](https://tailscale.com) is a VPN service that makes the devices and applications you own accessible anywhere in the world, securely and effortlessly. -It enables encrypted point-to-point connections using the open source [WireGuard](https://www.wireguard.com/) protocol, which means only devices on your private network can communicate with each other. +## What is ionscale? -**What is ionscale?** +Tailscale allows your devices to communicate securely across networks using WireGuard®. While Tailscale's client software is open source, their centralized coordination server (which manages public keys and network configurations) is proprietary. -While the Tailscale software running on each node is open source, their centralized "coordination server" which act as a shared drop box for public keys is not. +**ionscale aims to implement a lightweight, open-source control server that:** -_ionscale_ aims to implement such lightweight, open source alternative Tailscale control server. +- Acts as a drop-in replacement for Tailscale's coordination server +- Can be self-hosted on your infrastructure +- Gives you full control over your network configuration +- Works with the standard Tailscale clients +- Supports a [wide range of Tailscale features](./overview/features.md) -## Features +## Getting started -- multi [tailnet](https://tailscale.com/kb/1136/tailnet/) support -- multi user support -- OIDC integration (not required, although recommended) -- [Auth keys](https://tailscale.com/kb/1085/auth-keys/) -- [Access control list](https://tailscale.com/kb/1018/acls/) -- [DNS](https://tailscale.com/kb/1054/dns/) - - nameservers - - Split DNS - - MagicDNS -- [HTTPS Certs](https://tailscale.com/kb/1153/enabling-https/) -- [Tailscale SSH](https://tailscale.com/kb/1193/tailscale-ssh/) -- [Service collection](https://tailscale.com/kb/1100/services/) -- [Taildrop](https://tailscale.com/kb/1106/taildrop/) +- [**Installation guide**](./installation/index.md) - Install ionscale using Docker or directly on Linux +- [**CLI configuration**](./getting-started/index.md) - Set up the ionscale CLI and authenticate +- [**Creating a tailnet**](./getting-started/tailnet.md) - Create and manage your first tailnet +- [**OIDC authentication**](./configuration/auth-oidc.md) - Configure user authentication via OIDC +- [**DNS providers**](./configuration/dns-providers.md) - Set up DNS integration for HTTPS certificates -## Disclaimer - -This is not an official Tailscale or Tailscale Inc. project. \ No newline at end of file + +Disclaimer: This is not an official Tailscale or Tailscale Inc. project. Tailscale and WireGuard are trademarks of their respective owners. + \ No newline at end of file diff --git a/mkdocs/docs/installation/docker.md b/mkdocs/docs/installation/docker.md new file mode 100644 index 0000000..af1cea2 --- /dev/null +++ b/mkdocs/docs/installation/docker.md @@ -0,0 +1,101 @@ +# Installing ionscale with Docker + +This guide will walk you through installing and configuring ionscale using Docker containers. Docker provides a simple and consistent way to deploy ionscale across different environments. + +## Prerequisites + +Before you begin, make sure you have: + +- A Linux server (virtual or physical) +- Docker installed ([official Docker installation guide](https://docs.docker.com/engine/install/)) +- Root or sudo access +- A registered domain name pointing to your server +- Ports 443 (HTTPS) and 3478/UDP (STUN) open in your firewall +- Basic familiarity with the Linux command line + +## Domain and DNS configuration + +ionscale requires a domain name to function properly. This enables secure HTTPS connections and proper Tailscale device discovery. + +1. Configure an A record in your domain's DNS settings: + ``` + ionscale.example.com → YOUR_SERVER_IP + ``` + (Replace "example.com" with your actual domain and "YOUR_SERVER_IP" with your server's public IP address) + +2. Verify the DNS record has propagated: + ```bash + dig ionscale.example.com + ``` + The command should return your server's public IP address. + +## Container setup + +### Creating a directory structure + +Create a dedicated directory for ionscale files: + +```bash +mkdir -p ionscale/data +cd ./ionscale +``` + +### Generating a configuration file + +First, set up environment variables for the configuration: + +```bash +export IONSCALE_ACME_EMAIL="your-email@example.com" # Used for Let's Encrypt notifications +export IONSCALE_DOMAIN="ionscale.example.com" # Your ionscale domain +export IONSCALE_SYSTEM_ADMIN_KEY=$(docker run --rm ghcr.io/jsiebens/ionscale:0.16.0 genkey -n) +``` + +!!! important "System admin key" + The system admin key is a critical security component that provides full administrative access to your ionscale instance. Make sure to save this key securely. + + Alternatively, you can configure ionscale without a system admin key by using an OIDC provider and setting up system admin accounts through the OIDC configuration. See the [Authentication with OIDC](../configuration/auth-oidc.md) documentation for details. + +Now create the configuration file: + +```bash +cat > ./config.yaml </dev/null </dev/null </dev/null <