Files
headscale/config/policy.hujson
Timmy 2ed4628528 feat: enable Taildrive via ACL policy (full-mesh preserved)
新增 config/policy.hujson 並啟用 policy.path:
- acls 保留 allow-all,維持原本全互通行為
- nodeAttrs 授予所有節點 drive:share / drive:access
- grants 開放 tailscale.com/cap/drive(所有 share, rw)

已部署至伺服器並驗證:policy valid、14 節點 online、peer ping 正常、
drive 能力出現在 netmap。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-18 18:33:08 +08:00

53 lines
1.6 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Headscale ACL policy —— 全互通 + Taildrive 範本
// 適用 headscale v0.29.0(首度支援 nodeAttrs / Taildrive policy
//
// 套用方式:
// 1) 把本檔放到容器看得到的路徑config 目錄會掛載為 /etc/headscale
// 2) 在 config/config.yaml 設定:
// policy:
// mode: file
// path: /etc/headscale/policy.hujson
// 3) 重啟容器後驗證docker exec headscale headscale policy check --file /etc/headscale/policy.hujson
//
// ⚠️ 重要:沒有 policy 檔時 headscale 預設「全部互通」。一旦啟用 policy
// acls 變成唯一授權來源;下面這條 allow-all 規則務必保留,否則所有節點立即斷線。
{
// ---- 連線授權:維持目前的全互通行為 ----
"acls": [
{
"action": "accept",
"src": ["*"],
"dst": ["*:*"]
}
],
// ---- Taildrive開啟「分享 / 存取」能力 ----
// drive:share = 可把本機目錄分享出去(伺服器端僅 Linux/macOS/Windows 支援)
// drive:access = 可掛載並讀寫他人分享的目錄iOS/Android 也能存取)
"nodeAttrs": [
{
"target": ["*"],
"attr": ["drive:share", "drive:access"]
}
],
// ---- Taildrive用 grant 指定可存取哪些 share 與讀寫權限 ----
// shares: ["*"] 代表所有 share可改成特定名稱清單。
// access: "rw" 讀寫 / "ro" 唯讀。
"grants": [
{
"src": ["*"],
"dst": ["*"],
"app": {
"tailscale.com/cap/drive": [
{
"shares": ["*"],
"access": "rw"
}
]
}
}
]
}