diff --git a/skills/network/headscale-vpn/SKILL.md b/skills/network/headscale-vpn/SKILL.md index 7c20d83..01ac096 100644 --- a/skills/network/headscale-vpn/SKILL.md +++ b/skills/network/headscale-vpn/SKILL.md @@ -2,12 +2,17 @@ name: headscale-vpn description: Deploy headscale TUN server on arm64 macOS. version: 1.0.0 +author: robertrapp +license: MIT --- # headscale-vpn Use when deploying headscale TUN server on arm64 macOS for VPN node management and registration. +## When to Use +User needs to set up headscale TUN server on arm64 macOS for VPN node registration and traffic routing. + ## Trigger User needs to set up headscale TUN server on arm64 macOS for VPN node registration and traffic routing. diff --git a/skills/network/headscale-vpn/references/headscale-config.md b/skills/network/headscale-vpn/references/headscale-config.md new file mode 100644 index 0000000..518449f --- /dev/null +++ b/skills/network/headscale-vpn/references/headscale-config.md @@ -0,0 +1,44 @@ +# headscale Config Template + +## Required Configuration Fields + +```yaml +listen_addr: 0.0.0.0:8080 +server_url: http://127.0.0.1:8080 +backend: + type: sqlite + sqlite: + path: /tmp/headscale.db +noise: + private_key_path: /tmp/noise_key.pem +dns: + nameservers: + global: + - 8.8.8.8 + override_local_dns: false +auth: + method: file + file: + prefix: 100.64.0.0/10 +``` + +## Field Descriptions + +- **listen_addr**: Network address the server listens on +- **server_url**: URL base for the headscale API +- **backend.type**: Storage backend (sqlite recommended for local setups) +- **backend.sqlite.path**: Path to the SQLite database file +- **noise.private_key_path**: Path to noise private key (Tailscale v2 protocol required) +- **dns.nameservers.global**: DNS nameservers for DNS-over-HTTPS +- **dns.override_local_dns**: Whether to override local DNS +- **auth.method**: Authentication method (file recommended for local setups) +- **auth.file.prefix**: IPv4/IPv6 subnet prefix (REQUIRED - minimum one prefix required) + +## Pitfalls + +- Missing `noise.private_key_path` causes: `Fatal config error: headscale now requires a new noise.private_key_path field` +- Missing `auth.file.prefix` causes: `Fatal config error: no IPv4 or IPv6 prefix configured, minimum one prefix is required` +- Server socket path mismatch between config and CLI expectation causes connection timeouts +- pip/brew installation unavailable; use manual binary download from GitHub releases +``` +", \ No newline at end of file diff --git a/skills/network/headscale-vpn/scripts/headscale-probe.sh b/skills/network/headscale-vpn/scripts/headscale-probe.sh new file mode 100755 index 0000000..78f8845 --- /dev/null +++ b/skills/network/headscale-vpn/scripts/headscale-probe.sh @@ -0,0 +1,58 @@ +#!/bin/bash +# headscale-probe.sh - Verification script for headscale server status and socket existence + +set -e + +CONFIG_FILE="${1:-/tmp/headscale_config.yaml}" +HEADSCALE_BIN="/tmp/headscale" + +echo "=== Headscale Server Probe ===" +echo "Config file: $CONFIG_FILE" +echo "Binary: $HEADSCALE_BIN" + +# Check if config exists +if [ ! -f "$CONFIG_FILE" ]; then + echo "ERROR: Config file not found: $CONFIG_FILE" + exit 1 +fi + +# Check if headscale binary exists +if [ ! -x "$HEADSCALE_BIN" ]; then + echo "ERROR: Headscale binary not found or not executable: $HEADSCALE_BIN" + exit 1 +fi + +# Check server process +echo "\n--- Server Process Check ---" +if pgrep -f "headscale serve" > /dev/null 2>&1; then + echo "Headscale server process is running" +else + echo "Headscale server process is NOT running" +fi + +# Check socket existence +SOCKET_PATH="/var/run/headscale/headscale.sock" +echo "\n--- Socket Check ---" +if [ -S "$SOCKET_PATH" ]; then + echo "Socket exists at $SOCKET_PATH" +else + echo "Socket NOT found at $SOCKET_PATH" +fi + +# Check config file readability +echo "\n--- Config File Check ---" +if headscale configtest -c "$CONFIG_FILE" 2>/dev/null; then + echo "Config test passed" +else + echo "Config test FAILED" +fi + +# List users if server is running +echo "\n--- User List ---" +if pgrep -f "headscale serve" > /dev/null 2>&1; then + $HEADSCALE_BIN -c "$CONFIG_FILE" users list --output json 2>/dev/null || echo "Could not list users (server may not be responding)" +else + echo "Server not running - cannot list users" +fi + +echo "\n=== Probe Complete ==="