mirror of
https://github.com/hanzoai/skills.git
synced 2026-11-19 00:47:36 +00:00
hanzoskills.com/llms.txt now opens with the install line, the API reference index and the company index, so an agent that lands on any one of the three can find the rest. robots.txt claimed 537 documents while llms.txt counts 920. The number is gone from robots.txt; llms.txt derives it. public/ is regenerated from scripts/site.py, which it had fallen behind: the copy-prompt menu and agent bar were in the generator and not in the committed pages. tests/site.mjs passes against the result. Co-authored-by: Hanzo Dev <[email protected]>
509 lines
22 KiB
HTML
509 lines
22 KiB
HTML
<!doctype html>
|
|
<html lang="en"><head>
|
|
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
|
<title>tailscale-vpn</title>
|
|
<meta name="color-scheme" content="dark">
|
|
<style>
|
|
/* Committed to one visual world: a dark instrument panel. No light variant —
|
|
the dot field and the hairline rules only read on black, and a naive
|
|
inversion would wash both out. Every colour is painted explicitly so the page
|
|
never borrows a host background. */
|
|
@font-face{font-family:'Zen';src:url('/fonts/Zen-Variable.woff2') format('woff2');font-weight:100 900;font-style:normal;font-display:swap}
|
|
@font-face{font-family:'Zen';src:url('/fonts/Zen-Italic-Variable.woff2') format('woff2');font-weight:100 900;font-style:italic;font-display:swap}
|
|
@font-face{font-family:'Zen Mono';src:url('/fonts/ZenMono-Variable.woff2') format('woff2');font-weight:100 900;font-style:normal;font-display:swap}
|
|
@font-face{font-family:'Zen Mono';src:url('/fonts/ZenMono-Italic-Variable.woff2') format('woff2');font-weight:100 900;font-style:italic;font-display:swap}
|
|
@font-face{font-family:'Zen Pixel Square';src:url('/fonts/ZenPixel-Square.woff2') format('woff2');font-style:normal;font-display:swap}
|
|
|
|
:root{
|
|
--ink:#f4f4f2; --soft:#9c9c98; --faint:#6a6a66; --ground:#000; --panel:#0a0a0a;
|
|
--line:#232323; --line-hi:#3a3a3a; --accent:#f4f4f2;
|
|
--font-zen-sans:'Zen',-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif;
|
|
--font-zen-mono:'Zen Mono',ui-monospace,"SF Mono",SFMono-Regular,Menlo,Consolas,monospace;
|
|
--font-zen-pixel-square:'Zen Pixel Square',monospace;
|
|
--mono:var(--font-zen-mono);
|
|
--sans:var(--font-zen-sans);
|
|
/* Controls are pills and surfaces are soft, as on hanzo.ai. */
|
|
--r:999px; --r-soft:14px;
|
|
}
|
|
*{box-sizing:border-box}
|
|
html{-webkit-text-size-adjust:100%}
|
|
body{margin:0;background:var(--ground);color:var(--ink);font-family:var(--sans);
|
|
font-size:16px;line-height:1.65;-webkit-font-smoothing:antialiased}
|
|
.wrap{max-width:60rem;margin:0 auto;padding:0 1.75rem}
|
|
|
|
/* The dot field. A halftone made of one repeating radial-gradient, faded out
|
|
along the diagonal by a mask so it reads as a wave rather than wallpaper. */
|
|
/* No overflow clip here: the dot field is inset to the box already, and a clip
|
|
would cut off the copy-prompt menu. */
|
|
.hero{position:relative;border-bottom:1px solid var(--line)}
|
|
.hero::before{content:"";position:absolute;inset:0;
|
|
background-image:radial-gradient(var(--line-hi) 1px, transparent 1px);
|
|
background-size:7px 7px;
|
|
-webkit-mask-image:linear-gradient(115deg,#000 0%,rgba(0,0,0,.55) 38%,transparent 72%);
|
|
mask-image:linear-gradient(115deg,#000 0%,rgba(0,0,0,.55) 38%,transparent 72%);
|
|
pointer-events:none}
|
|
.hero .wrap{position:relative;padding-top:5.5rem;padding-bottom:4rem}
|
|
|
|
nav{border-bottom:1px solid var(--line)}
|
|
nav .in{max-width:60rem;margin:0 auto;padding:1.1rem 1.75rem;display:flex;
|
|
justify-content:space-between;align-items:center;gap:1rem}
|
|
.brand{font-family:var(--mono);font-size:.85rem;letter-spacing:.14em;
|
|
text-transform:uppercase;color:var(--ink);text-decoration:none;
|
|
display:inline-flex;align-items:center;gap:.6rem}
|
|
.brand i{font-style:normal;color:var(--faint)}
|
|
.mark{width:1.15em;height:1.15em;display:block;flex:0 0 auto}
|
|
nav a.up{font-family:var(--mono);font-size:.72rem;letter-spacing:.14em;
|
|
text-transform:uppercase;color:var(--soft);text-decoration:none}
|
|
nav a.up:hover{color:var(--ink)}
|
|
|
|
h1{font-family:var(--mono);font-size:clamp(2rem,5.4vw,3.4rem);line-height:1.12;
|
|
letter-spacing:-.02em;margin:0 0 1.1rem;font-weight:500;text-wrap:balance}
|
|
h1 em{font-style:normal;color:var(--faint)}
|
|
.lede{color:var(--soft);font-size:1.05rem;max-width:52ch;margin:0 0 2.25rem}
|
|
|
|
.btns{display:flex;flex-wrap:wrap;gap:.7rem;margin:0 0 .5rem;align-items:center}
|
|
.btn{display:inline-flex;align-items:center;gap:.5rem;font-family:var(--mono);
|
|
font-size:.72rem;letter-spacing:.14em;text-transform:uppercase;
|
|
padding:.8rem 1.4rem;border:1px solid var(--line-hi);border-radius:var(--r);
|
|
color:var(--ink);text-decoration:none;background:transparent;cursor:pointer;
|
|
line-height:1.2;font-weight:400}
|
|
.btn:hover{background:#141414;text-decoration:none;border-color:var(--soft)}
|
|
.btn.solid{background:var(--ink);color:#000;border-color:var(--ink)}
|
|
.btn.solid:hover{background:#d8d8d4}
|
|
.btn .chev{width:.7em;height:.7em;flex:0 0 auto;transition:transform .15s ease}
|
|
.btn[aria-expanded="true"] .chev{transform:rotate(180deg)}
|
|
|
|
/* Copy-prompt selector. Each row copies the prompt for its own target. */
|
|
.copy{position:relative;display:inline-flex}
|
|
.menu{position:absolute;top:calc(100% + .5rem);left:0;z-index:20;min-width:21rem;
|
|
background:var(--panel);border:1px solid var(--line-hi);border-radius:var(--r-soft);
|
|
padding:.4rem;display:flex;flex-direction:column;
|
|
box-shadow:0 12px 32px rgba(0,0,0,.75)}
|
|
.menu[hidden]{display:none}
|
|
.mi{display:flex;align-items:center;gap:.7rem;width:100%;text-align:left;
|
|
padding:.62rem .8rem;border:0;border-radius:calc(var(--r-soft) - .35rem);
|
|
background:transparent;color:var(--ink);font-family:var(--mono);font-size:.76rem;
|
|
letter-spacing:.04em;text-decoration:none;cursor:pointer;line-height:1.3;
|
|
white-space:nowrap}
|
|
.mi:hover,.mi:focus-visible{background:#181818;outline:none}
|
|
.mi .mark{width:1.05rem;height:1.05rem;color:var(--soft)}
|
|
.mi:hover .mark{color:var(--ink)}
|
|
.mi u{margin-left:auto;color:var(--faint);text-decoration:none;font-size:.68rem;
|
|
letter-spacing:.1em;text-transform:uppercase}
|
|
|
|
/* Works-with bar: one scrolling row, name and mark per agent. */
|
|
.strip{border-bottom:1px solid var(--line);background:var(--panel)}
|
|
.strip .in{max-width:60rem;margin:0 auto;padding:.9rem 1.75rem;display:flex;
|
|
align-items:center;gap:1.25rem;font-family:var(--mono);font-size:.72rem;
|
|
letter-spacing:.1em;text-transform:uppercase;color:var(--faint)}
|
|
.strip b{color:var(--soft);font-weight:400;flex:0 0 auto;
|
|
border-right:1px solid var(--line);padding-right:1.25rem;align-self:stretch;
|
|
display:flex;align-items:center}
|
|
.bar{display:flex;align-items:center;gap:.5rem;flex:1 1 auto;min-width:0;
|
|
overflow-x:auto;scrollbar-width:none;scroll-snap-type:x proximity;
|
|
-webkit-overflow-scrolling:touch;
|
|
-webkit-mask-image:linear-gradient(90deg,#000 calc(100% - 3rem),transparent);
|
|
mask-image:linear-gradient(90deg,#000 calc(100% - 3rem),transparent)}
|
|
.bar::-webkit-scrollbar{display:none}
|
|
.agent{display:inline-flex;align-items:center;gap:.45rem;flex:0 0 auto;
|
|
padding:.4rem .85rem;border:1px solid var(--line);border-radius:var(--r);
|
|
color:var(--soft);white-space:nowrap;scroll-snap-align:start;
|
|
text-decoration:none;background:var(--ground)}
|
|
.agent:hover{color:var(--ink);border-color:var(--line-hi);text-decoration:none}
|
|
.agent .mark{width:.95rem;height:.95rem}
|
|
|
|
h2{font-family:var(--mono);font-size:1.1rem;letter-spacing:-.01em;margin:2.75rem 0 .75rem;font-weight:500}
|
|
h3{font-size:1rem;margin:2rem 0 .5rem;font-weight:600}
|
|
h4,h5,h6{font-size:.94rem;margin:1.5rem 0 .5rem;font-weight:600}
|
|
p{margin:0 0 1rem;max-width:70ch}
|
|
ul,ol{margin:0 0 1rem;padding-left:1.35rem;max-width:70ch}
|
|
li{margin:.22rem 0}
|
|
a{color:var(--ink);text-decoration:underline;text-underline-offset:3px;
|
|
text-decoration-color:var(--line-hi)}
|
|
a:hover{text-decoration-color:var(--ink)}
|
|
a:focus-visible{outline:1px solid var(--ink);outline-offset:3px}
|
|
code{font-family:var(--mono);font-size:.85em;background:var(--panel);
|
|
border:1px solid var(--line);border-radius:5px;padding:.1em .36em}
|
|
pre{background:var(--panel);border:1px solid var(--line);padding:1rem 1.1rem;
|
|
border-radius:var(--r-soft);overflow-x:auto;margin:0 0 1.25rem}
|
|
pre code{background:none;border:0;padding:0;font-size:.82rem;line-height:1.7}
|
|
blockquote{margin:0 0 1rem;padding-left:1rem;border-left:1px solid var(--line-hi);color:var(--soft)}
|
|
hr{border:0;border-top:1px solid var(--line);margin:2.5rem 0}
|
|
table{border-collapse:collapse;width:100%;margin:0 0 1.25rem;font-size:.92rem;
|
|
display:block;overflow-x:auto}
|
|
th,td{border:1px solid var(--line);padding:.5rem .7rem;text-align:left}
|
|
|
|
.curl{display:block;background:var(--panel);border:1px solid var(--line);
|
|
border-radius:var(--r-soft);padding:.95rem 1.1rem;font-family:var(--mono);
|
|
font-size:.8rem;color:var(--soft);overflow-x:auto;margin:0 0 2.5rem;
|
|
white-space:pre;line-height:1.9}
|
|
.curl b{color:var(--ink);font-weight:400}
|
|
.curl i{font-style:normal;color:var(--faint)}
|
|
|
|
/* index */
|
|
#q{width:100%;padding:.85rem 1.2rem;font-family:var(--mono);font-size:.85rem;color:var(--ink);
|
|
background:var(--panel);border:1px solid var(--line);border-radius:var(--r);margin:0 0 .6rem}
|
|
#q::placeholder{color:var(--faint);text-transform:uppercase;letter-spacing:.1em;font-size:.72rem}
|
|
#q:focus{outline:none;border-color:var(--soft)}
|
|
#count{color:var(--faint);font-family:var(--mono);font-size:.72rem;letter-spacing:.1em;
|
|
text-transform:uppercase;margin:0 0 2rem}
|
|
.cat{margin:2.5rem 0 .5rem;font-family:var(--mono);font-size:.7rem;letter-spacing:.16em;
|
|
text-transform:uppercase;color:var(--faint);border-bottom:1px solid var(--line);
|
|
padding-bottom:.45rem}
|
|
.row{display:block;padding:.6rem .9rem;margin:0 -.9rem;border-bottom:1px solid var(--line);
|
|
border-radius:var(--r-soft);text-decoration:none}
|
|
.row:hover{background:#0a0a0a}
|
|
.nm{font-family:var(--mono);font-size:.84rem;color:var(--ink);display:block}
|
|
.ds{color:var(--soft);font-size:.9rem;display:block;margin-top:.12rem}
|
|
footer{margin-top:4rem;padding:2rem 0 4rem;border-top:1px solid var(--line);
|
|
color:var(--faint);font-size:.85rem}
|
|
footer a{color:var(--soft)}
|
|
.fmap{display:grid;gap:1.75rem;grid-template-columns:repeat(auto-fit,minmax(11rem,1fr));
|
|
margin:0 0 2rem;font-size:.85rem}
|
|
.fmap b{display:block;font-family:var(--mono);font-size:.68rem;letter-spacing:.16em;
|
|
text-transform:uppercase;color:var(--faint);font-weight:400;margin:0 0 .6rem;
|
|
border-bottom:1px solid var(--line);padding-bottom:.4rem}
|
|
.fmap a{display:inline-block;color:var(--ink);text-decoration:none;margin:.3rem .35rem 0 0}
|
|
.fmap a:hover{text-decoration:underline}
|
|
.fmap div{color:var(--faint);line-height:1.5}
|
|
.fend{border-top:1px solid var(--line);padding-top:1.25rem;font-size:.82rem}
|
|
|
|
@media (max-width:640px){
|
|
.hero .wrap{padding-top:3.25rem;padding-bottom:2.75rem}
|
|
.btns{gap:.5rem}
|
|
.btn{padding:.75rem 1.15rem;font-size:.68rem}
|
|
.copy,.copy .btn{width:100%;justify-content:center}
|
|
.menu{left:0;right:0;min-width:0}
|
|
.strip .in{flex-direction:column;align-items:flex-start;gap:.6rem;padding:.9rem 1.75rem}
|
|
.strip b{border-right:0;padding-right:0}
|
|
.bar{width:100%}
|
|
}
|
|
</style>
|
|
<link rel="alternate" type="text/markdown" href="/tailscale-vpn.md">
|
|
|
|
<link rel="icon" href="/favicon.svg">
|
|
<link rel="canonical" href="https://hanzoskills.com/tailscale-vpn">
|
|
</head>
|
|
<!-- Reading this with a machine? Every page here is also plain markdown.
|
|
This one: https://hanzoskills.com/tailscale-vpn.md
|
|
Index: https://hanzoskills.com/llms.txt
|
|
Corpus: https://hanzoskills.com/all.md
|
|
Append .md to any path for the markdown twin. -->
|
|
<body>
|
|
<nav><div class="in">
|
|
<a class="brand" href="/"><svg class="mark" viewBox="0 0 67 67" fill="currentColor" aria-hidden="true"><path d="M22.21 67V44.6369H0V67H22.21Z"/><path d="M66.7038 22.3184H22.2534L0.0878906 44.6367H44.4634L66.7038 22.3184Z"/><path d="M22.21 0H0V22.3184H22.21V0Z"/><path d="M66.7198 0H44.5098V22.3184H66.7198V0Z"/><path d="M66.7198 67V44.6369H44.5098V67H66.7198Z"/></svg> HANZO<i>SKILLS</i></a>
|
|
<a class="up" href="/">All skills</a>
|
|
</div></nav>
|
|
|
|
<div class="wrap">
|
|
<h1>tailscale-vpn</h1><p class="lede">Creating secure private networks (mesh VPN)</p><h1>Tailscale VPN Setup</h1>
|
|
<p><strong>Use this skill when:</strong></p>
|
|
<ul><li>Creating secure private networks (mesh VPN)</li><li>Connecting services across cloud providers</li><li>Accessing development machines remotely</li><li>Building zero-trust networks</li><li>Simplifying network configuration</li></ul>
|
|
<h2>Installation</h2>
|
|
<h3>Install Tailscale</h3>
|
|
<pre><code class="lang-bash"># macOS
|
|
brew install tailscale
|
|
|
|
# Ubuntu/Debian
|
|
⚠️ **SECURITY**: Piping curl to shell is dangerous. For production:</code></pre>
|
|
<h1>Download script first</h1>
|
|
<p>curl -O https://tailscale.com/install.sh</p>
|
|
<h1>Verify checksum</h1>
|
|
<p>sha256sum install.sh</p>
|
|
<h1>Review content</h1>
|
|
<p>less install.sh</p>
|
|
<h1>Then execute</h1>
|
|
<p>bash install.sh</p>
|
|
<pre><code>For development/learning only:</code></pre>
|
|
<p>curl -fsSL https://tailscale.com/install.sh | sh</p>
|
|
<h1>Docker</h1>
|
|
<p>docker pull tailscale/tailscale</p>
|
|
<pre><code>
|
|
### Initial Setup
|
|
</code></pre>
|
|
<h1>Start tailscale</h1>
|
|
<p>sudo tailscale up</p>
|
|
<h1>Authenticate (opens browser)</h1>
|
|
<h1>Follow link to authenticate with your account</h1>
|
|
<h1>Check status</h1>
|
|
<p>tailscale status</p>
|
|
<h1>Get your IP</h1>
|
|
<p>tailscale ip -4</p>
|
|
<pre><code>
|
|
## Basic Usage
|
|
|
|
### Connect Machines
|
|
|
|
All authenticated devices automatically connect:
|
|
</code></pre>
|
|
<h1>On machine A</h1>
|
|
<p>tailscale up</p>
|
|
<h1>Gets IP: 100.64.0.1</h1>
|
|
<h1>On machine B</h1>
|
|
<p>tailscale up</p>
|
|
<h1>Gets IP: 100.64.0.2</h1>
|
|
<h1>Now machines can reach each other</h1>
|
|
<h1>From A: ping 100.64.0.2</h1>
|
|
<h1>From B: ping 100.64.0.1</h1>
|
|
<pre><code>
|
|
### SSH Over Tailscale
|
|
|
|
Use Tailscale IPs for SSH:
|
|
</code></pre>
|
|
<h1>Traditional SSH (need to configure firewalls, ports)</h1>
|
|
<p>ssh user@public-ip-address</p>
|
|
<h1>Tailscale SSH (just works)</h1>
|
|
<p>ssh [email protected]</p>
|
|
<h1>Enable Tailscale SSH (simpler auth)</h1>
|
|
<p>tailscale up --ssh</p>
|
|
<h1>Then SSH without password</h1>
|
|
<p>ssh username@machine-name</p>
|
|
<pre><code>
|
|
## Service Exposure
|
|
|
|
### Expose Local Services
|
|
|
|
Access local services from anywhere:
|
|
</code></pre>
|
|
<h1>Run web service on 100.64.0.1:8000</h1>
|
|
<h1>Accessible from any tailscale device at http://100.64.0.1:8000</h1>
|
|
<h1>Example: Flask app</h1>
|
|
<p>from flask import Flask app = Flask(__name__)</p>
|
|
<p>@app.route('/') def hello(): return "Hello from Tailscale!"</p>
|
|
<p>if __name__ == '__main__': # Listen on tailscale interface app.run(host='100.64.0.1', port=8000)</p>
|
|
<pre><code>
|
|
### Database Access
|
|
|
|
Connect to databases securely:
|
|
</code></pre>
|
|
<h1>PostgreSQL on machine A (100.64.0.1)</h1>
|
|
<h1>Start postgres listening on tailscale IP</h1>
|
|
<h1>From machine B</h1>
|
|
<p>import psycopg2</p>
|
|
<p>conn = psycopg2.connect( host="100.64.0.1", # Tailscale IP port=5432, database="mydb", user="user", password="password" )</p>
|
|
<h1>No need for public IPs or complex firewall rules!</h1>
|
|
<pre><code>
|
|
## MagicDNS
|
|
|
|
### Use Machine Names
|
|
|
|
Access machines by name instead of IP:
|
|
</code></pre>
|
|
<h1>Enable MagicDNS in Tailscale admin console</h1>
|
|
<h1>Now use machine names</h1>
|
|
<p>ssh user@machine-name</p>
|
|
<h1>In code</h1>
|
|
<p>import requests response = requests.get("http://api-server:8000/data")</p>
|
|
<pre><code></code></pre>
|
|
<h1>Python example with MagicDNS</h1>
|
|
<p>import psycopg2</p>
|
|
<h1>Use machine name instead of IP</h1>
|
|
<p>conn = psycopg2.connect( host="postgres-server", # MagicDNS name database="mydb" )</p>
|
|
<pre><code>
|
|
## Subnet Routing
|
|
|
|
### Share Entire Networks
|
|
|
|
Expose entire subnets:
|
|
</code></pre>
|
|
<h1>On gateway machine with access to 192.168.1.0/24</h1>
|
|
<p>tailscale up --advertise-routes=192.168.1.0/24</p>
|
|
<h1>Approve route in admin console</h1>
|
|
<h1>Now other tailscale machines can access 192.168.1.*</h1>
|
|
<p>ping 192.168.1.100</p>
|
|
<pre><code>
|
|
### Docker Network Access
|
|
|
|
Access Docker containers:
|
|
</code></pre>
|
|
<h1>Enable IP forwarding</h1>
|
|
<p>echo 'net.ipv4.ip_forward = 1' | sudo tee -a /etc/sysctl.conf sudo sysctl -p</p>
|
|
<h1>Advertise Docker network</h1>
|
|
<p>tailscale up --advertise-routes=172.17.0.0/16</p>
|
|
<h1>Access containers from other machines</h1>
|
|
<p>curl http://172.17.0.2:8000</p>
|
|
<pre><code>
|
|
## Exit Nodes
|
|
|
|
### Use as VPN Exit Node
|
|
|
|
Route all traffic through a machine:
|
|
</code></pre>
|
|
<h1>On exit node machine</h1>
|
|
<p>tailscale up --advertise-exit-node</p>
|
|
<h1>On client machine</h1>
|
|
<p>tailscale up --exit-node=exit-node-name</p>
|
|
<h1>Now all traffic routes through exit node</h1>
|
|
<p>curl ifconfig.me # Shows exit node's IP</p>
|
|
<pre><code>
|
|
## ACLs (Access Control Lists)
|
|
|
|
### Restrict Access
|
|
|
|
Control who can access what:
|
|
</code></pre>
|
|
<p>// In Tailscale admin console > Access Controls { "acls": [ // Allow devs to access staging { "action": "accept", "src": ["group:devs"], "dst": ["tag:staging:*"] },</p>
|
|
<p> // Allow production access only from specific IPs { "action": "accept", "src": ["group:ops"], "dst": ["tag:production:*"] } ],</p>
|
|
<p> "groups": { "group:devs": ["[email protected]", "[email protected]"], "group:ops": ["[email protected]"] },</p>
|
|
<p> "tagOwners": { "tag:staging": ["group:devs"], "tag:production": ["group:ops"] } }</p>
|
|
<pre><code>
|
|
## Tailscale in Docker
|
|
|
|
### Docker Container with Tailscale
|
|
</code></pre>
|
|
<p>FROM ubuntu:22.04</p>
|
|
<h1>Install Tailscale</h1>
|
|
<p>RUN apt-get update && apt-get install -y \ curl \ iptables \ iproute2</p>
|
|
<p>⚠️ <strong>SECURITY</strong>: Piping curl to shell is dangerous. For production:</p>
|
|
<pre><code class="lang-dockerfile"># Download script first
|
|
RUN curl -O https://tailscale.com/install.sh && \
|
|
sha256sum install.sh && \
|
|
less install.sh && \
|
|
bash install.sh</code></pre>
|
|
<p>For development/learning only:</p>
|
|
<pre><code class="lang-dockerfile">RUN curl -fsSL https://tailscale.com/install.sh | sh
|
|
|
|
# Your app
|
|
COPY app.py /app/
|
|
WORKDIR /app
|
|
|
|
CMD ["sh", "-c", "tailscaled & tailscale up --authkey=$TAILSCALE_AUTH_KEY && python app.py"]</code></pre>
|
|
<pre><code class="lang-bash"># Run with auth key
|
|
docker run -e TAILSCALE_AUTH_KEY=tskey-auth-xxx my-app</code></pre>
|
|
<h3>Docker Compose</h3>
|
|
<pre><code class="lang-yaml">version: '3.8'
|
|
|
|
services:
|
|
app:
|
|
image: myapp
|
|
environment:
|
|
- DATABASE_HOST=postgres-server # MagicDNS name
|
|
depends_on:
|
|
- tailscale
|
|
|
|
tailscale:
|
|
image: tailscale/tailscale
|
|
hostname: myapp-tailscale
|
|
environment:
|
|
- TS_AUTHKEY=${TAILSCALE_AUTH_KEY}
|
|
- TS_STATE_DIR=/var/lib/tailscale
|
|
volumes:
|
|
- tailscale-state:/var/lib/tailscale
|
|
cap_add:
|
|
- NET_ADMIN
|
|
- SYS_MODULE
|
|
|
|
volumes:
|
|
tailscale-state:</code></pre>
|
|
<h2>Kubernetes Integration</h2>
|
|
<h3>Tailscale Operator</h3>
|
|
<pre><code class="lang-yaml"># Install Tailscale operator
|
|
kubectl apply -f https://github.com/tailscale/tailscale/releases/latest/download/operator.yaml
|
|
|
|
# Expose service via Tailscale
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: my-service
|
|
annotations:
|
|
tailscale.com/expose: "true"
|
|
spec:
|
|
type: LoadBalancer
|
|
ports:
|
|
- port: 8000
|
|
selector:
|
|
app: my-app</code></pre>
|
|
<h2>Common Patterns</h2>
|
|
<h3>Development Environment</h3>
|
|
<p>Access dev services from laptop:</p>
|
|
<pre><code class="lang-bash"># On dev server (100.64.0.5)
|
|
# Run services normally on localhost
|
|
|
|
# On laptop
|
|
# Add to /etc/hosts or use MagicDNS
|
|
# 100.64.0.5 dev-server
|
|
|
|
# Access services
|
|
curl http://dev-server:3000 # React dev server
|
|
curl http://dev-server:8000 # Django backend
|
|
psql -h dev-server mydb # PostgreSQL</code></pre>
|
|
<h3>Multi-Cloud Networking</h3>
|
|
<p>Connect AWS, GCP, and on-prem:</p>
|
|
<pre><code class="lang-bash"># AWS EC2 instance
|
|
tailscale up --advertise-routes=10.0.0.0/16
|
|
|
|
# GCP instance
|
|
tailscale up --advertise-routes=10.1.0.0/16
|
|
|
|
# On-prem
|
|
tailscale up --advertise-routes=192.168.1.0/24
|
|
|
|
# All networks can now communicate
|
|
# AWS -> GCP: ssh 10.1.0.50
|
|
# GCP -> on-prem: curl http://192.168.1.100</code></pre>
|
|
<h2>Security Best Practices</h2>
|
|
<h3>Use Auth Keys Safely</h3>
|
|
<pre><code class="lang-bash"># Generate auth keys in admin console with:
|
|
# - Expiration date
|
|
# - Tags for ACL enforcement
|
|
# - One-time use (for ephemeral nodes)
|
|
|
|
# Use environment variables
|
|
export TAILSCALE_AUTH_KEY=tskey-auth-xxx
|
|
tailscale up --authkey=$TAILSCALE_AUTH_KEY
|
|
|
|
# Never commit auth keys to git!</code></pre>
|
|
<h3>Enable MFA</h3>
|
|
<pre><code class="lang-bash"># Enable in admin console
|
|
# All users required to use MFA for authentication
|
|
|
|
# Enforce key expiry
|
|
# Set device authorization expiry</code></pre>
|
|
<h2>Monitoring</h2>
|
|
<h3>Check Network Status</h3>
|
|
<pre><code class="lang-bash"># List all peers
|
|
tailscale status
|
|
|
|
# Show detailed peer info
|
|
tailscale status --peers
|
|
|
|
# Check routes
|
|
tailscale status --peers --active
|
|
|
|
# Test connectivity
|
|
tailscale ping peer-name</code></pre>
|
|
<h2>Anti-Patterns to Avoid</h2>
|
|
<p><strong>DON'T expose services on 0.0.0.0 without firewall:</strong></p>
|
|
<pre><code class="lang-bash"># ❌ BAD - Exposed to entire internet
|
|
app.run(host='0.0.0.0', port=8000)
|
|
|
|
# ✅ GOOD - Only on Tailscale
|
|
app.run(host='100.64.0.1', port=8000)</code></pre>
|
|
<p><strong>DON'T share auth keys:</strong></p>
|
|
<pre><code class="lang-bash"># ❌ BAD - Reusing same key
|
|
export SHARED_KEY=tskey-auth-xxx
|
|
|
|
# ✅ GOOD - Generate unique keys
|
|
# Use one-time keys for each deployment</code></pre>
|
|
<h2>Related Skills</h2>
|
|
<ul><li><strong>mtls-implementation.md</strong> - Layer mTLS on Tailscale</li><li><strong>mosh-resilient-ssh.md</strong> - Combine with mosh for resilience</li><li><strong>network-resilience-patterns.md</strong> - Handle Tailscale disconnects</li></ul>
|
|
<footer>
|
|
<div class="fmap">
|
|
<div><b>Build</b>
|
|
<a href="https://hanzo.app">hanzo.app</a> app builder
|
|
<a href="https://hanzo.codes">hanzo.codes</a> code with an agent
|
|
<a href="https://hanzoskills.com">hanzoskills.com</a> what an agent reads</div>
|
|
<div><b>Run</b>
|
|
<a href="https://console.hanzo.ai">console.hanzo.ai</a> cloud console
|
|
<a href="https://api.hanzo.ai">api.hanzo.ai</a> the API</div>
|
|
<div><b>Account</b>
|
|
<a href="https://hanzo.id">hanzo.id</a> sign in
|
|
<a href="https://pay.hanzo.ai">pay.hanzo.ai</a> top up
|
|
<a href="https://billing.hanzo.ai">billing.hanzo.ai</a> invoices and usage</div>
|
|
<div><b>Company</b>
|
|
<a href="https://hanzo.ai">hanzo.ai</a> canonical
|
|
<a href="https://hanzo.ventures">hanzo.ventures</a> ventures</div>
|
|
</div>
|
|
<div class="fend"><a href="/tailscale-vpn.md">This page as plain text</a> · <a href="/llms.txt">Index for agents</a></div>
|
|
</footer>
|
|
</div></body></html> |