Skip to main content

ACLs Introduction

Larktun ACLs follow the declarative policy model familiar from Headscale and Tailscale, strengthened with strict tenant-level isolation for SaaS multi-tenancy. Every tenant owns an independent policy document, compilation pipeline, and audit trail—rules authored in one workspace can never reference or leak into another.

What Larktun ACLs Control​

A private mesh gives devices encrypted reachability; ACLs define the security boundary on top of that mesh:

  • Who can initiate connections (src): individual user accounts, group:* user groups, device tags (tag:*), or specific hosts/CIDRs.
  • Which targets and ports are reachable (dst): specific private hosts, LAN subnets published by subnet routers, or internet egress via exit nodes, restricted down to exact TCP/UDP ports.
  • Automated route and exit approval (autoApprovers): automatically approve subnet routes or exit nodes advertised by explicitly tagged gateway nodes.

Multi-Tenant Isolation Guarantees​

  • Each tenant maintains a completely separate namespace for groups, hosts, tagOwners, acls, and autoApprovers.
  • Cross-tenant object references are rejected during validation.
  • Policy compilation and netmap distribution run per tenant so edits only trigger updates for devices inside that tenant.
  • All policy changes and access events remain scoped to the tenant's audit logs.

Core Policy Sections​

SectionPurposeTypical Example
groupsMap logical roles to user identities"group:dev": ["alice@", "bob@"]
tagOwnersDefine who is allowed to assign a device tag"tag:router": ["group:ops"]
hostsGive readable aliases to IPs or CIDRs"nas.home": "192.168.6.20/32"
aclsExplicit allow rules (action: "accept", src, dst)group:dev -> db.prod:5432
autoApproversAuto-approve routes or exit nodes for tagged peers"192.168.6.0/24": ["tag:router"]
sshOptional SSH session policy rulesRestrict root/user login scopes
testsOptional unit assertions verified before publishingEnsure group:dev cannot reach prod admin ports

Larktun ACLs follow a default-deny model: any traffic not explicitly matched by an accept rule is dropped.

Complete Multi-Role ACL Policy Example​

{
"groups": {
"group:dev": ["alice@", "bob@"],
"group:ops": ["carol@"]
},
"tagOwners": {
"tag:router": ["group:ops"],
"tag:exit": ["group:ops"],
"tag:prod-server": ["group:ops"]
},
"hosts": {
"db.prod": "10.20.0.10/32",
"nas.office": "192.168.6.20/32",
"exit.hk": "100.64.0.30/32"
},
"acls": [
{
"action": "accept",
"src": ["group:dev"],
"dst": ["db.prod:5432", "nas.office:445", "nas.office:5001"]
},
{
"action": "accept",
"src": ["group:ops"],
"dst": ["tag:prod-server:22", "autogroup:internet:*"]
}
],
"autoApprovers": {
"routes": {
"192.168.6.0/24": ["tag:router"]
},
"exitNode": ["tag:exit"]
}
}

Common Real-World ACL Patterns​

1. Personal Account Self-Access (Fastest Onboarding)​

Allow all devices signed in under your personal account to reach each other across all ports while keeping everything private to your tenant:

{
"action": "accept",
"src": ["you@example.com@"],
"dst": ["you@example.com@:*"]
}

2. Least-Privilege SSH Access Without Public Port 22​

Grant developers SSH-only access (:22) to tagged cloud servers without exposing databases or admin panels on those machines:

{
"action": "accept",
"src": ["group:dev"],
"dst": ["tag:dev-server:22"]
}

3. Scoped LAN Subnet Access (NAS / Home Lab)​

After approving 192.168.6.0/24 in the Routers page, allow only HTTPS and NAS DSM ports rather than opening the entire subnet blindly:

{
"action": "accept",
"src": ["you@example.com@"],
"dst": ["192.168.6.20:5001", "192.168.6.0/24:443"]
}

Rollout and Validation Workflow​

  1. Edit in the console: Start with built-in templates or the visual editor in ACLs, then switch to the JSON editor for advanced rules.
  2. Validate before publishing: Run syntax and tests checks to verify both positive access (allowed user succeeds) and negative isolation (unauthorized user or port is blocked).
  3. Verify convergence: Published policies compile on the control plane and push to tenant nodes within seconds.
  4. Review audit logs: Confirm expected connections and tighten overly broad * rules once initial testing completes.

Common ACL Pitfalls to Avoid​

  • Missing port suffix on dst: Every destination requires a :port or :* suffix (for example 192.168.6.0/24:*, not 192.168.6.0/24).
  • Approved route with no ACL rule: Approving a subnet in Routers only enables forwarding—you must also add a matching acls entry targeting that CIDR or host IP.
  • Overly broad src: ["*"] left in production: Use ["*"] only briefly while troubleshooting, then narrow src to a user, group, or device tag.

Reference Specifications​

Continue Reading​