From ee2f5d545825752af63da36e2b9ec7a92985a875 Mon Sep 17 00:00:00 2001 From: James O'Doherty Date: Fri, 29 May 2026 18:29:12 -0400 Subject: feat: implement userspace wireguard data-path and unprivileged host fd-passing - Implement complete rootless network namespace bootstrap via C launcher using unshare(CLONE_NEWUSER | CLONE_NEWNS | CLONE_NEWNET). - Resolve unprivileged network isolation blackhole via host-socket preservation (FD passing): open client UDP sockets on the host pre-isolation, clear O_CLOEXEC, and ingest them via custom `FDBind` inside the sandbox. - Implement isolated routing table automation over `tun0` (addresses, MTU, default routes). - Implement persistent, multi-process namespace sharing and joining using reference-counted PID files and the setns system call. - Write robust, self-contained E2E data plane test suites in `tests/e2e/e2e_test.go` using a mock UDP listener. - Update project documentation (`README.md` and `AGENTS.md`) to reflect completed milestones. - Ensure 100% test passing rate and zero lint/staticcheck warnings. --- internal/namespace/launcher_src/launcher.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'internal/namespace/launcher_src/launcher.c') diff --git a/internal/namespace/launcher_src/launcher.c b/internal/namespace/launcher_src/launcher.c index 4311430..e108da6 100644 --- a/internal/namespace/launcher_src/launcher.c +++ b/internal/namespace/launcher_src/launcher.c @@ -17,9 +17,11 @@ int main(int argc, char **argv) { uid_t current_uid = getuid(); gid_t current_gid = getgid(); - // 2. Combined Unshare for User and Network namespaces - if (unshare(CLONE_NEWUSER | CLONE_NEWNET) == -1) { - perror("unshare(CLONE_NEWUSER | CLONE_NEWNET)"); + // 2. Combined Unshare for User, Mount, and Network namespaces + // We unshare Mount namespace (CLONE_NEWNS) to allow private /etc/resolv.conf setup + // without contaminating the host filesystem. + if (unshare(CLONE_NEWUSER | CLONE_NEWNS | CLONE_NEWNET) == -1) { + perror("unshare(CLONE_NEWUSER | CLONE_NEWNS | CLONE_NEWNET)"); return 1; } -- cgit v1.2.3