Skip to content

feat: add amneziawg extension#1004

Open
masterbpro wants to merge 1 commit into
siderolabs:mainfrom
masterbpro:feat/amneziawg
Open

feat: add amneziawg extension#1004
masterbpro wants to merge 1 commit into
siderolabs:mainfrom
masterbpro:feat/amneziawg

Conversation

@masterbpro
Copy link
Copy Markdown

No description provided.

@github-project-automation github-project-automation Bot moved this to To Do in Planning Mar 11, 2026
@talos-bot talos-bot moved this from To Do to In Review in Planning Mar 11, 2026
Add AmneziaWG as a Talos Linux system extension service.
AmneziaWG is a WireGuard-based VPN with DPI bypass via traffic obfuscation.

Signed-off-by: masterbpro <iserver12345@gmail.com>
cp -p amneziawg-tools/src/wg-quick/linux.bash /rootfs/usr/local/lib/containers/amneziawg/usr/local/bin/awg-quick
chmod +x /rootfs/usr/local/lib/containers/amneziawg/usr/local/bin/*
- |
cp -p /pkg/entrypoint.sh /rootfs/usr/local/lib/containers/amneziawg/usr/local/bin/entrypoint.sh
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see where the shell is coming from? It should inside the container rootfs for the script to work

@smira smira moved this from In Review to On Hold in Planning Mar 16, 2026
@github-actions
Copy link
Copy Markdown

This PR is stale because it has been open 45 days with no activity.

@github-actions github-actions Bot added the Stale label Apr 28, 2026
@gentoosys
Copy link
Copy Markdown

Hi @masterbpro — thanks for getting amneziawg support moving, this is genuinely useful for clusters that span networks where plain WireGuard gets DPI-fingerprinted.

I hit the exact thing @smira flagged in review (the entrypoint.sh needs a shell inside the container rootfs). Rather than add bash + iproute2 to the extension's rootfs, I went the other way and replaced awg-quick with a small Go helper — which matches the precedent the other network/ extensions already set (tailscale, nebula, netbird, zerotier all ship a Go binary entrypoint, no shell).

I've been running it in production for a few weeks on a two-node control plane split across two datacenters on different continents (~140 ms RTT) — awg0 comes up at boot before etcd/kubelet, and etcd peering, kube-apiserver, kubelet and Cilium pod-to-pod (native routing) all flow over the mesh.

Sources here, with unit tests: https://github.com/gentoosys/talos-awg-up

What it does (the subset of awg-quick an extension service actually needs):

  • ip link add awg0 type amneziawg, address, MTU, up — via vishvananda/netlink, no iproute2
  • parses the wg-quick-style .conf, strips the wg-quick-only fields, and pipes the rest to awg setconf (the obfuscation fields Jc/Jmin/Jmax/S1/S2/H1..H4 go through awg since wgctrl doesn't speak them)
  • installs a route per AllowedIPs prefix; idempotent across restarts

The win is the service container becomes scratch + awg (~50 KB C binary) + the Go helper (~2.6 MB static) — no shell, and notably no /proc mount. awg-quick needs /proc because its process-substitution (awg setconf <(...)) resolves /dev/fd/63/proc/self/fd/63; making that work inside a sandboxed extension service container otherwise means bind-mounting host /proc (exposes the host process table) or a fresh-procfs mount. The Go path sidesteps that entirely.

Happy to contribute this whichever way is least disruptive — fold it into this PR, or open a follow-up once this lands. I'm also preparing a full extension PR (the pkg.yaml + service definition wired to the Go helper, plus the companion siderolabs/pkgs PR for the signed kernel module). Glad to coordinate so we're not duplicating effort — your call on ordering.

@gentoosys
Copy link
Copy Markdown

Followed up on my comment above — I've opened the kernel-module version as a draft pair so there's something concrete to compare against:

To be clear, I don't think this is strictly "better" than your #1004 — it's a different trade-off, and they're complementary:

Both also drop the bash dependency @smira flagged — #1103 via the Go helper.

No interest in stepping on your PR — you got here first and the userspace approach is genuinely the lower-maintenance option. Posting the kernel-module variant mainly so maintainers can see both and decide whether they want one canonical extension or both as options. Glad to consolidate / co-author whichever direction the team prefers.

@github-actions github-actions Bot removed the Stale label May 30, 2026
gentoosys added a commit to gentoosys/extensions that referenced this pull request May 30, 2026
Adds network/amneziawg — the AmneziaWG kernel-module approach to a
DPI-resistant inter-node WireGuard mesh. Brings up awg0 at boot via a
small shell-free Go helper (awg-up) that does its own netlink for
link/addr/route and execs the bundled static awg C binary only for
'awg setconf'. No bash, no iproute2, no /proc or /dev bind — matching
the Go-entrypoint pattern of tailscale/nebula/etc. rather than shipping
a wg-quick shell script.

  - awg-up/        Go helper (5 files, ~475 LOC) + unit tests (go test ./...)
  - amneziawg.yaml service definition (entrypoint awg-up, mounts only
                   /var/run/amneziawg + /sys)
  - pkg.yaml       builds awg-up, pulls signed .ko + static awg from the
                   companion siderolabs/pkgs amneziawg-pkg, assembles a
                   scratch service-container rootfs
  - manifest/vars/README

Depends on siderolabs/pkgs amneziawg-pkg (kernel module + awg).

Complements the userspace amneziawg-go approach in siderolabs#1004 — this is the
native-kernel-datapath alternative; see PR discussion for the trade-off.

amneziawg added to .kres.yaml targets and the generated Makefile
TARGETS list. MPL-2.0 headers added to all awg-up Go sources.

Signed-off-by: gentoosys <linux.admin@anche.no>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: On Hold

Development

Successfully merging this pull request may close these issues.

4 participants