Deploys and configures Tailscale (or self-hosted Headscale) as a WireGuard-based zero trust mesh VPN, setting up identity-aware ACLs, exit nodes, subnet routers, and MagicDNS for encrypted peer-to-peer connectivity. Use when replacing traditional VPN servers with an identity-authenticated mesh network or enforcing granular per-device access control lists.
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Um comando direto ignora o prompt de revisão. Verifique a origem antes de executá-lo.
Deploys and configures Tailscale (or self-hosted Headscale) as a WireGuard-based zero trust mesh VPN, setting up identity-aware ACLs, exit nodes, subnet routers, and MagicDNS for encrypted peer-to-peer connectivity. Use when replacing traditional VPN servers with an identity-authenticated mesh network or enforcing granular per-device access control lists.
Tailscale is a zero trust mesh VPN built on WireGuard that creates encrypted peer-to-peer connections between devices without requiring traditional VPN servers or complex network configuration. Every connection in a Tailscale network (tailnet) is end-to-end encrypted using WireGuard's Noise protocol framework with Curve25519 key exchange. Tailscale implements zero trust networking by authenticating every connection request through identity providers, enforcing granular Access Control Lists (ACLs), and supporting features like exit nodes, subnet routers, MagicDNS, and Tailscale SSH. For organizations preferring self-hosted infrastructure, Headscale provides an open-source implementation of the Tailscale control server.
When to Use
When deploying or configuring deploying tailscale for zero trust vpn capabilities in your environment
When establishing security controls aligned to compliance requirements
When building or improving security architecture for this domain
When conducting security assessments that require this implementation
Prerequisites
Identity provider (Okta, Azure AD, Google Workspace, GitHub, or OIDC-compatible)
Devices running supported OS (Linux, Windows, macOS, iOS, Android, FreeBSD)
Administrative access to configure DNS and firewall rules
Understanding of WireGuard protocol fundamentals
Network planning documentation for subnet routing requirements
Architecture
Tailscale Coordination Server
(or self-hosted Headscale)
|
Key Distribution
& NAT Traversal
|
+-----------------+-----------------+
| | |
+----+----+ +----+----+ +----+----+
| Node A |<---->| Node B |<---->| Node C |
| (Linux) | | (macOS) | |(Windows)|
+---------+ +---------+ +---------+
WireGuard WireGuard WireGuard
Encrypted Encrypted Encrypted
P2P Tunnel P2P Tunnel P2P Tunnel
Each node connects directly to every other node.
DERP relay servers used only when direct P2P fails.
Installation and Setup
Linux Installation
# Add Tailscale repository and install
curl -fsSL https://tailscale.com/install.sh | sh
# Start Tailscale and authenticatesudo tailscale up
# Check connection status
tailscale status
# View assigned IP address
tailscale ip -4
tailscale ip -6
Windows / macOS Installation
# Windows: Download from https://tailscale.com/download/windows# macOS: Install via Homebrew
brew install --cask tailscale
# Or download from https://tailscale.com/download/mac
Docker Deployment
# docker-compose.yml for Tailscale sidecarversion:'3.8'services:tailscale:image:tailscale/tailscale:latestcontainer_name:tailscalehostname:my-serviceenvironment:-TS_AUTHKEY=tskey-auth-xxxxx# Pre-auth key-TS_STATE_DIR=/var/lib/tailscale-TS_EXTRA_ARGS=--advertise-tags=tag:containervolumes:-tailscale-state:/var/lib/tailscale-/dev/net/tun:/dev/net/tuncap_add:-net_admin-sys_modulerestart:unless-stoppedvolumes:tailscale-state:
Kubernetes Deployment
# Tailscale operator for KubernetesapiVersion:v1kind:Secretmetadata:name:tailscale-authnamespace:tailscaletype:OpaquestringData:TS_AUTHKEY:"tskey-auth-xxxxx"---apiVersion:apps/v1kind:DaemonSetmetadata:name:tailscalenamespace:tailscalespec:selector:matchLabels:app:tailscaletemplate:metadata:labels:app:tailscalespec:containers:-name:tailscaleimage:tailscale/tailscale:latestenv:-name:TS_AUTHKEYvalueFrom:secretKeyRef:name:tailscale-authkey:TS_AUTHKEY-name:TS_KUBE_SECRETvalue:tailscale-state-name:TS_USERSPACEvalue:"true"securityContext:capabilities:add: ["NET_ADMIN"]
Access Control Lists (ACLs)
Tailscale ACLs define who can access what within your tailnet using a declarative JSON format. The default policy is deny-all, making it zero trust by design.
{"acls":[// Engineering team can access development servers{"action":"accept","src":["group:engineering"],"dst":["tag:dev-server:*"]},// SRE team can access production infrastructure{"action":"accept","src":["group:sre"],"dst":["tag:production:22,443,8080"]},// Database access restricted to backend services{"action":"accept","src":["tag:backend"],"dst":["tag:database:5432,3306,27017"]},// All employees can access internal tools{"action":"accept","src":["group:employees"],"dst":["tag:internal-tools:443"]}],"groups":{"group:engineering":["user@company.com","dev@company.com"],"group:sre":["sre@company.com","oncall@company.com"],"group:employees":["autogroup:members"]},"tagOwners":{"tag:dev-server":["group:engineering"],"tag:production":["group:sre"],"tag:backend":["group:sre"],"tag:database":["group:sre"],"tag:internal-tools":["group:sre"],"tag:container":["group:sre"]},"ssh":[{"action":"check","src":["group:sre"],"dst":["tag:production"],"users":["root","admin"]},{"action":"accept","src":["group:engineering"],"dst":["tag:dev-server"],"users":["autogroup:nonroot"]}],"nodeAttrs":[{"target":["autogroup:members"],"attr":["funnel:deny"]}]}
Exit Nodes and Subnet Routing
Configure Exit Node
# On the exit node machinesudo tailscale up --advertise-exit-node
# On the client machine, use the exit nodesudo tailscale up --exit-node=<exit-node-ip>
# Verify exit node routing
curl ifconfig.me # Should show exit node's public IP
Subnet Router Configuration
# Advertise local subnets through Tailscalesudo tailscale up --advertise-routes=10.0.0.0/24,192.168.1.0/24
# Enable IP forwarding on Linuxecho'net.ipv4.ip_forward = 1' | sudotee -a /etc/sysctl.conf
echo'net.ipv6.conf.all.forwarding = 1' | sudotee -a /etc/sysctl.conf
sudo sysctl -p
# Accept routes on clientsudo tailscale up --accept-routes
Tailscale SSH (Zero Trust SSH)
Tailscale SSH replaces traditional SSH key management with identity-based access.
# Enable Tailscale SSH on a serversudo tailscale up --ssh
# Connect using Tailscale SSH (no SSH keys needed)
ssh user@hostname # Authenticates via Tailscale identity# Session recording (audit logging)# Configure in ACL policy:# "ssh": [{"action": "check", "src": [...], "dst": [...], "users": [...]}]# "check" action requires re-authentication and records sessions
MagicDNS Configuration
# MagicDNS is enabled by default in new tailnets# Access devices by hostname instead of IP
ping my-server # Resolves via MagicDNS# Custom DNS configuration via admin console# Split DNS: route specific domains to internal DNS servers# Global nameservers: override default DNS resolution
# Initialize network lock with signing keys
tailscale lock init
# Add trusted signing keys
tailscale lock add nodekey:xxxxx
# All new nodes require signing before joining# Prevents unauthorized nodes from joining the tailnet
Monitoring and Observability
# View network status
tailscale status --json | jq '.Peer | to_entries[] | {name: .value.HostName, online: .value.Online, os: .value.OS}'# Check connection quality
tailscale ping <peer-ip>
# View network map
tailscale netcheck
# Audit logs available in Tailscale admin console# Integration with SIEM via webhook or API
Integration Patterns
Service Mesh Integration
# Tailscale as sidecar for service-to-service communication# Each service gets a Tailscale identity# ACLs enforce service-to-service access policies# Example: API service can only reach database service# ACL: tag:api -> tag:database:5432
CI/CD Pipeline Integration
# Use ephemeral auth keys in CI/CDexport TS_AUTHKEY=tskey-auth-xxxxx-ephemeral
tailscale up --authkey=$TS_AUTHKEY --hostname=ci-runner-$CI_JOB_ID# Access internal resources during build/deploy# Node automatically removed when container stops