feat: Nebula mesh network overlay #12

Merged
greg merged 9 commits from klaatu/nixos:feat/nebula-mesh into main 2026-04-04 03:03:53 +00:00
Collaborator

Summary

Adds a greg.nebula NixOS module and enables Nebula on all managed hosts for a nebula.thehellings.com overlay network.

CIDR: 10.157.0.0/16

Architecture

Host Nebula IP Role
linode 10.157.0.1 Lighthouse + relay
genesis 10.157.0.2 Node + unsafe_routes router for 10.42.0.0/16
hosea 10.157.0.3 Node
isaiah 10.157.0.4 Node
jeremiah 10.157.0.5 Node
zeke 10.157.0.6 Node
exodus 10.157.0.7 Node (laptop)

unsafe_routes (home LAN access)

Genesis has routesSubnet = "10.42.0.0/16" which:

  • Enables net.ipv4.ip_forward
  • Adds nftables masquerade NAT rules so Nebula peers can reach 10.42.0.0/16
  • Signs genesis cert with -subnets 10.42.0.0/16 (see README)

All other hosts get unsafeRoutes pointing at genesis (10.157.0.2) for the same subnet.

Files Changed

  • modules/nixos/nebula.nix — new shared module
  • modules/nixos/default.nix — import nebula.nix
  • hosts/unstable/*/default.nix — enable greg.nebula on all hosts
  • network.json — add nebulaIp field per host
  • secrets/secrets.nix — declare nebula/*.key.age entries
  • secrets/nebula/README.md — PKI bootstrap guide

Before Deploying

  1. Generate CA + sign certs per secrets/nebula/README.md
  2. Encrypt private keys with agenix
  3. Add DNS: linode.nebula.thehellings.com → linodes public IP
  4. Open UDP 4242 on linode firewall
  5. colmena apply --on linode first, then fleet-wide
## Summary Adds a `greg.nebula` NixOS module and enables Nebula on all managed hosts for a `nebula.thehellings.com` overlay network. **CIDR:** `10.157.0.0/16` ## Architecture | Host | Nebula IP | Role | |------|-----------|------| | linode | 10.157.0.1 | Lighthouse + relay | | genesis | 10.157.0.2 | Node + unsafe_routes router for 10.42.0.0/16 | | hosea | 10.157.0.3 | Node | | isaiah | 10.157.0.4 | Node | | jeremiah | 10.157.0.5 | Node | | zeke | 10.157.0.6 | Node | | exodus | 10.157.0.7 | Node (laptop) | ## unsafe_routes (home LAN access) Genesis has `routesSubnet = "10.42.0.0/16"` which: - Enables `net.ipv4.ip_forward` - Adds nftables masquerade NAT rules so Nebula peers can reach `10.42.0.0/16` - Signs genesis cert with `-subnets 10.42.0.0/16` (see README) All other hosts get `unsafeRoutes` pointing at genesis (10.157.0.2) for the same subnet. ## Files Changed - `modules/nixos/nebula.nix` — new shared module - `modules/nixos/default.nix` — import nebula.nix - `hosts/unstable/*/default.nix` — enable greg.nebula on all hosts - `network.json` — add `nebulaIp` field per host - `secrets/secrets.nix` — declare `nebula/*.key.age` entries - `secrets/nebula/README.md` — PKI bootstrap guide ## Before Deploying 1. Generate CA + sign certs per `secrets/nebula/README.md` 2. Encrypt private keys with agenix 3. Add DNS: `linode.nebula.thehellings.com` → linodes public IP 4. Open UDP 4242 on linode firewall 5. `colmena apply --on linode` first, then fleet-wide
klaatu added 1 commit 2026-03-29 04:25:13 +00:00
feat: add Nebula mesh network overlay
buildbot/nix-eval Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-exodus Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-isaiah Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-genesis Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-linode Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-jeremiah Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-zeke Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-hosea Build done.
buildbot/nix-build Build done.
792217f640
Introduces a greg.nebula NixOS module and enables it across all managed
hosts for the nebula.thehellings.com overlay (CIDR: 10.157.0.0/16).

Architecture:
- linode: lighthouse + relay (public internet, UDP 4242)
- genesis: regular node + unsafe_routes router for 10.42.0.0/16 (home LAN)
- hosea, isaiah, jeremiah, zeke, exodus: regular nodes with unsafe_routes
  pointing to genesis to reach the home LAN

Changes:
- modules/nixos/nebula.nix: new greg.nebula module
  - isLighthouse / isRelay options
  - unsafeRoutes option (tun.unsafe_routes)
  - routesSubnet option: enables IP forwarding + nftables masquerade NAT
    on the gateway host (genesis) so Nebula peers reach 10.42.0.0/16
  - agenix secret reference per-host (secrets/nebula/<name>.key.age)
  - opens UDP/4242 in the firewall
- modules/nixos/default.nix: import nebula.nix
- hosts/unstable/linode/default.nix: greg.nebula.isLighthouse = true
- hosts/unstable/genesis/default.nix: greg.nebula.routesSubnet = "10.42.0.0/16"
- hosts/unstable/{hosea,isaiah,jeremiah,zeke,exodus}/default.nix:
  greg.nebula.enable = true with unsafeRoutes via genesis
- network.json: add nebulaIp field for each managed host
- secrets/secrets.nix: declare nebula/<host>.key.age entries
- secrets/nebula/README.md: full PKI bootstrap guide (CA, certs, agenix)
greg added 1 commit 2026-04-01 21:34:31 +00:00
chore: add encrypted keys and unencrypted certs
buildbot/nix-eval Build done.
buildbot/nix-build Build started.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-exodus Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.hm-exodus Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-genesis Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-isaiah Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-jeremiah Build done.
2bb0177ffa
greg approved these changes 2026-04-01 21:35:01 +00:00
Dismissed
greg left a comment
Owner

Update your local copy of the branch, because I have pushed the secrets into the repository. Then follow the instructions in this review.

Update your local copy of the branch, because I have pushed the secrets into the repository. Then follow the instructions in this review.
@@ -32,1 +32,4 @@
gnome.enable = true;
nebula = {
enable = true;
unsafeRoutes = [
Owner

Move this to be a default value in the module.

Move this to be a default value in the module.
greg marked this conversation as resolved
@@ -38,0 +39,4 @@
enable = true;
# genesis routes the home LAN (10.42.0.0/16) into the Nebula overlay.
# Sign genesis's cert with -subnets '10.42.0.0/16' (see secrets/nebula/README.md).
routesSubnet = "10.42.0.0/16";
Owner

Override the default value of unsafeRoutes here, because this node is the routing node.

Override the default value of unsafeRoutes here, because this node is the routing node.
greg marked this conversation as resolved
greg dismissed greg's review 2026-04-01 21:35:39 +00:00
Reason:

Nope

greg requested review from greg 2026-04-01 21:35:52 +00:00
greg added 1 commit 2026-04-01 21:36:10 +00:00
Merge branch 'main' into feat/nebula-mesh
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-jeremiah Build done.
buildbot/nix-eval Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-exodus Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-isaiah Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-genesis Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-linode Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-zeke Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-hosea Build done.
buildbot/nix-build Build done.
559155d411
klaatu added 1 commit 2026-04-01 21:46:01 +00:00
fix: move unsafeRoutes to module default, genesis overrides to []
buildbot/nix-eval Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-genesis Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-exodus Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-hosea Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-isaiah Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-jeremiah Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-linode Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-zeke Build done.
buildbot/nix-build Build done.
84e4c68f0e
Per review feedback:
- nebula module now defaults unsafeRoutes to [{route=10.42.0.0/16 via=10.157.0.2}]
  so all regular nodes get home LAN routing automatically
- genesis overrides unsafeRoutes=[] since it IS the routing node (avoids loop)
- exodus and all k3s nodes (hosea, isaiah, jeremiah, zeke) simplified to
  nebula.enable = true only, relying on the new default
klaatu reviewed 2026-04-01 21:46:10 +00:00
klaatu left a comment
Author
Collaborator

Addressed both review comments in commit 84e4c68:

exodus/default.nix — Removed the explicit unsafeRoutes block. The module now defaults to [{ route = "10.42.0.0/16"; via = "10.157.0.2"; }] so all regular nodes get home LAN routing automatically.

genesis/default.nix — Added unsafeRoutes = []; override. Since genesis IS the routing node it should not try to route through itself.

Also cleaned up the identical explicit unsafeRoutes blocks from hosea, isaiah, jeremiah, and zeke — they all now rely on the module default.

Note: kept the via hardcoded to 10.157.0.2 in the default rather than referencing cfg.lighthouseNebulaIp, since cross-option references in NixOS module defaults can cause evaluation issues.

Addressed both review comments in commit 84e4c68: **exodus/default.nix** — Removed the explicit `unsafeRoutes` block. The module now defaults to `[{ route = "10.42.0.0/16"; via = "10.157.0.2"; }]` so all regular nodes get home LAN routing automatically. **genesis/default.nix** — Added `unsafeRoutes = [];` override. Since genesis IS the routing node it should not try to route through itself. Also cleaned up the identical explicit `unsafeRoutes` blocks from hosea, isaiah, jeremiah, and zeke — they all now rely on the module default. Note: kept the `via` hardcoded to `10.157.0.2` in the default rather than referencing `cfg.lighthouseNebulaIp`, since cross-option references in NixOS module defaults can cause evaluation issues.
Author
Collaborator

Addressed both review comments in commit 84e4c68:

  • exodus: Removed the explicit unsafeRoutes block — module now defaults to [{ route = "10.42.0.0/16"; via = "10.157.0.2"; }] so all regular nodes get home LAN routing automatically.
  • genesis: Added unsafeRoutes = []; override — since genesis IS the routing node it must not try to route through itself.

Also cleaned up hosea, isaiah, jeremiah, and zeke — they all had the identical explicit block and now just use nebula.enable = true;.

Addressed both review comments in commit 84e4c68: - **exodus**: Removed the explicit `unsafeRoutes` block — module now defaults to `[{ route = "10.42.0.0/16"; via = "10.157.0.2"; }]` so all regular nodes get home LAN routing automatically. - **genesis**: Added `unsafeRoutes = [];` override — since genesis IS the routing node it must not try to route through itself. Also cleaned up hosea, isaiah, jeremiah, and zeke — they all had the identical explicit block and now just use `nebula.enable = true;`.
klaatu added 1 commit 2026-04-01 22:07:49 +00:00
fix: rename tun.dev to tun.device (correct NixOS option name)
buildbot/nix-eval Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-exodus Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-genesis Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-isaiah Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-zeke Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-jeremiah Build done.
buildbot/nix-build Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-hosea Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-linode Build done.
0e61efe5b5
klaatu added 1 commit 2026-04-01 22:13:39 +00:00
klaatu added 1 commit 2026-04-01 22:14:14 +00:00
fix: only set listen.port on lighthouse/relay nodes (regular nodes use OS-assigned port 0)
buildbot/nix-eval Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-linode Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-proxmoxtemplate Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-zeke Build done.
buildbot/nix-build Build done.
f35e8c755c
greg added 1 commit 2026-04-01 22:20:51 +00:00
fix: generate linode certs
buildbot/nix-eval Build done. (1 warning)
buildbot/nix-build Build done.
a1bef073cf
greg merged commit 35b6058c09 into main 2026-04-04 03:03:53 +00:00
Sign in to join this conversation.
No Reviewers
No labels
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: greg/nixos#12