Date: 2026-10-23
Accepted (implemented in 1.2.0)
wg never takes a preshared key as an argument. The process list is readable by every account on a host, so wg set … preshared-key expects the path of a file and reads the key from it. Islandr therefore writes each preshared key to a short-lived 0600 file, calls wg, and deletes the file: the hub in the JVM's temp directory (the service's private /tmp under PrivateTmp=true), islandr-proxy in /run/islandr.
Ubuntu 26.04 ships an AppArmor profile for /usr/bin/wg in enforce mode:
profile wg /usr/bin/wg flags=(attach_disconnected){
include <abstractions/base>
include <abstractions/nameservice-strict>
capability net_admin,
capability net_bind_service,
...
# wireguard configuration and key files
file rw @{etc_rw}/wireguard/{,**},
...
}
Its only file rule is /etc/wireguard and below. It grants net_admin but not dac_override or dac_read_search, so running wg as root does not get around it. Measured on the GitHub runner image (ubuntu-26.04, 20261012) by handing wg set … private-key a root-owned 0600 key file in each candidate directory:
| Directory | Result |
|---|---|
/etc/wireguard |
read |
/root |
denied |
/tmp |
denied |
/var/tmp |
denied |
/home/runner/work/_temp |
denied |
with the kernel logging apparmor="DENIED" operation="open" profile="wg" for each denied path. wg itself reports only fopen: Permission denied. A key piped in on standard input from the calling process is refused the same way: /dev/stdin resolves to a pipe the calling user owns, and reading it needs the same capabilities.
A second measurement settled the ownership. A key file the service user writes, in a 0700 directory it owns, mode 0600: refused — the kernel logs the denied dac_override. The same file in a directory owned by the service user, group root, setgid, mode 2750, written 0640: read, and the key reached the interface. In that layout the service user can still delete its file, and another account can neither read it nor list /etc/wireguard.
On such a host every peer created with a preshared key fails with HTTP 500, in both deployments. Peers without one are unaffected. Preshared keys are an admin-only option and off by default, so this hits a minority of peers on a minority of hosts today — and every such host as 26.04 spreads.
Islandr writes the preshared-key file to /etc/wireguard/islandr, a directory of its own:
root, mode 2750. The profile denies wg dac_override, so root's wg reads a file only if the ordinary permission bits let it — a 0600 file owned by islandr is closed to it, and so is a 0700 directory. Measured on the image: refused. With the setgid bit every key file is born in group root; Islandr writes it 0640, and group read is how root's wg gets in. Nobody outside group root can read it, the service can still delete it, and the file is deleted right after the call, as before./etc/wireguard, which is 0700 root:root on a stock host. The installers set its group to islandr and grant that group execute only — no read, so nobody can list the directory, and the operator's files keep their own modes. If the directory already belongs to a group other than root, the installers leave it alone and say so.ProtectSystem=strict (hub) and =full (proxy) make /etc read-only; ReadWritePaths=-/etc/wireguard/islandr opens exactly this directory. The leading - keeps the unit starting where the directory does not exist.update.sh touches nothing under /etc (ADR-0031 set that line). Where the profile exists and the setup is incomplete, it says so and links the manual steps in docs/install.md.psk-* file in the directory older than one minute. A key file lives for one wg call, bounded at five seconds.The configuration key is islandr.wg.psk-dir (hub) and ISLANDR_PSK_DIR (proxy), both defaulting to /etc/wireguard/islandr.
| Criterion (weight) | A: own directory under /etc/wireguard (chosen) |
B: ship an AppArmor override in /etc/apparmor.d/local/wg |
C: no file — set the key over netlink | D: document the limitation, fix later |
|---|---|---|---|---|
| Works on Ubuntu 26.04 (5) | +1 | +1 | +1 | −1 |
| Leaves the host's security policy alone (4) | 0 (changes the group and one mode bit of /etc/wireguard) |
−1 (widens a confinement profile Ubuntu chose to enforce) | +1 | +1 |
| No new privileges for the service (4) | +1 (sudo scope unchanged) | +1 | 0 (the proxy could do it; the native hub would need a netlink library instead of the CLI) | +1 |
| Hosts installed before 1.2.0 keep working (4) | +1 (fallback) | +1 | +1 | +1 |
| Key material exposure (3) | −1 (on disk under /etc for one call; mitigated by the sweep — R-198) |
0 (stays on tmpfs or private /tmp) |
+1 (never on disk) | 0 |
| Effort and risk for 1.2.0 (2) | 0 (three installers, two code paths, two E2E checks) | 0 (one file per installer, but a policy file to maintain against Ubuntu's) | −1 (new dependency or a hand-written netlink client in two languages) | +1 |
| Weighted total | +10 | +9 | +14 | +9 |
C scores highest and stays the long-term direction: a key that never touches a file is the cleanest answer. It is not a 1.2.0 change — it means a netlink client in Java and in Go, and that is a feature, not a fix. A is the smallest change that is safe today and does not stand in C's way: once the key travels over netlink, the directory and its passage can simply be removed.
<iface>.conf stays true.update.sh's report, by an error message that names the cause, and by both E2E jobs asserting the modes on every release candidate./etc for one call, where it used to sit on tmpfs. Mitigated by the 2750/0640 modes, deletion right after the call and the startup sweep.update.sh and by the error on the first failing peer.docs/install.md — "Installing on a hub that already runs WireGuard" (what the installer now adds) and "Preshared keys on Ubuntu 26.04" (the manual steps for older hubs)RealWgAdapter#createPskFile, RealWgAdapter#sweepStalePskFilesislandr-proxy: writePsk, pskDir, sweepStalePsk.github/workflows/ci.yml — both E2E jobs assert the directory modes and that a peer with a preshared key reaches the interface