✨ darkone.service.headscale
A full-configured headscale service for HCS.
The tailnet ACL policy is generated from the topology (zones, hosts, users)
by dnfLib.mkHeadscalePolicy, validated by headscale policy check at build
time, then reloaded on change (SIGHUP) without restarting headscale.
- Machines are tagged:
tag:hcs,tag:gw-<zone>,tag:admin(host whosegroupscontainsadmin). - Machines and zone LANs reach each other. Personal devices: DNS and HTTPS
on the HCS, HTTPS on zone gateways (every zone for admins, else their
zone-*groups and the zones of their AI spaces). SSH from admin stations andpolicy.adminDevices. - Every addressed zone host is a policy alias (
nas-> its LAN IP): any other service opens throughpolicy.extraAcls(nas:445). - Personal devices log in through Kanidm (OIDC), for members of the Kanidm
tailnetgroup; their keys expire afternodeExpiry.
darkone.service.headscale.policy.adminDevices.phone-alice = "100.64.0.9";Sub-modules (headscale/):
dns.nix: unbound, the tailnet pivot DNS, and itstailnet-machinesview;audit.nix:headscale-audit, live nodes against the declared topology;enroll.nix:dnf-tailnet-enroll, behindjust tailnet-enroll.
Pivot DNS (dns.nix)
Section titled “Pivot DNS (dns.nix)”unbound on the HCS. Internal names reach it through headscale split DNS; it forwards each zone domain to the zone gateway, the rest to Quad9 over TLS.
View tailnet-machines: tagged nodes (HCS aside) get the zone LAN address
of the global services a zone serves (git.<domain> on a gateway),
everyone else the public one. unbound-tailnet-view lists their tailnet
IPs from headscale, declared nowhere.
Audit (audit.nix)
Section titled “Audit (audit.nix)”headscale-audit, every 15 min: live nodes against the declared topology.
Metrics for the dnf-headscale-<zone> alerts, details in its journal. It
never tags nor deletes.
Enrollment (enroll.nix)
Section titled “Enrollment (enroll.nix)”dnf-tailnet-enroll, root side of just tailnet-enroll: single-use keys
tagged from the declared topology; the enrolled node gets its declared name
and tags.
Options
Section titled “Options”- enable
boolEnable headscale DNF service - enableGRPC
boolOpen GRPC TCP port - nodeExpiry
strKey expiry of personal devices (0: never). Tagged machines never expire. - policy.enforce
boolDefault-deny tailnet ACLs.falseallows all traffic, for a migration only. - policy.adminDevices
attrsPersonal devices granted SSH on every machine and zone: name -> tailnet IPv4. - policy.exitNodeSources
listOf strPolicy sources allowed to use the HCS as exit node. - policy.extraHosts
attrsExtra policy host aliases (name -> CIDR), to use inextraAcls. Declared zone hosts already have one. - policy.extraAcls
listOf (attrsOf anything)ACL rules appended after the generated ones. - shared
rawHeadscale values shared with theheadscale/sub-modules.
darkone.service.headscale = { enable = false; enableGRPC = false; nodeExpiry = "180d"; policy.enforce = true; policy.adminDevices = { }; policy.exitNodeSources = [ ]; policy.extraHosts = { }; policy.extraAcls = [ ]; shared = { inherit policy auditSpec idmUrl hcsTailnetIpv4 ; };};Source: modules/service/headscale.nix 🡕