Skills von blackbook: network/headscale-vpn

This commit is contained in:
2026-11-05 22:16:07 +01:00
parent 8ec5cb6b6c
commit e069d995d7
3 changed files with 107 additions and 0 deletions
+5
View File
@@ -2,12 +2,17 @@
name: headscale-vpn name: headscale-vpn
description: Deploy headscale TUN server on arm64 macOS. description: Deploy headscale TUN server on arm64 macOS.
version: 1.0.0 version: 1.0.0
author: robertrapp
license: MIT
--- ---
# headscale-vpn # headscale-vpn
Use when deploying headscale TUN server on arm64 macOS for VPN node management and registration. 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 ## Trigger
User needs to set up headscale TUN server on arm64 macOS for VPN node registration and traffic routing. User needs to set up headscale TUN server on arm64 macOS for VPN node registration and traffic routing.
@@ -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
```
",
+58
View File
@@ -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 ==="