Repository navigation
feat: Windows support (TUN, service, named pipe) - #89
Merged
Merged
Conversation
…utes Windows-only crate that holds the unsafe calls: a protected directory for keys, the named pipe with its DACL and an administrator check on the caller, and the IP Helper route calls TUN mode needs.
… Wintun The daemon core is shared with Linux; sock.rs and pipe.rs hold what differs (who may connect, who may pair). On Windows the pipe is closed to everyone but SYSTEM, administrators and the group kite, and only an elevated administrator may pair. TUN mode takes the two halves of the address space through a Wintun adapter, keeps the relay out of its own tunnel with a host route when it needs one, and sends DNS to the tunnel with a catch-all NRPT rule. kite restore removes all of it. No kill switch on Windows yet.
…pt, smoke test and docs The window and the CLI talk to the service over the named pipe. The kill switch toggle is hidden and --kill-switch refused on Windows (issue 88). scripts/fetch-wintun.ps1 pins the Wintun zip and DLL by SHA-256. scripts/tun-smoke.ps1 checks what TUN mode changes and that it is all gone after a disconnect and after a killed daemon; CI runs it on a Windows runner.
…vel clients, cleanup at service start, signed Wintun private_dir opens the directory without following links and works through that handle. The pipe clients no longer allow impersonation. The service removes a killed run's DNS rule when it starts. The group kite is looked up on this computer only. The server log is rate limited. wintun.dll must be signed by WireGuard LLC.
…asks behave Once the tunnel is told to end, the routes and the DNS rule come off at once beside the wind-down, the tunnel's tasks get 4 s before they are dropped, and the runtime is dropped with a 2 s limit (it waited for ever on a task that did not stop). The disconnect wait on Windows allows for taking the DNS rule off through PowerShell.
…d the smoke test's relay refuses external targets ipstack drops a TCP stream with block_in_place and waits for its task, which needs a worker; the one worker moves to a thread of the blocking pool for that time. The pool held 4 threads, so a flood of connections ending together left the worker stuck and the stop, its timers included, never ran. TUN mode now allows 512. relay-dev gets --refuse-external so the CI test's relay, which runs on the machine under test, no longer loops its own connections through the tunnel.
This reverts commit 2a30ebe.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #15.
Kite runs on Windows: TUN mode through Wintun, the daemon as a service on a named pipe, and the desktop app on that pipe. The installer is the next PR.
What changes:
crates/kite-win(new, Windows only) holds theunsafe: a protected directory for the keys, the pipe with its access list, the IP Helper route calls, the service glue. Everything else keepsforbid(unsafe_code).daemon/sock.rsanddaemon/pipe.rshold what differs. The pipe lets in SYSTEM, administrators and the local groupkite, refuses remote clients, and only an elevated administrator may pair. Clients open it at identification level.0.0.0.0/1,128.0.0.0/1,::/1,8000::/1), a host route for the relay only when it is reached through the default route, a catch-all NRPT rule so DNS goes to 1.1.1.1 through the tunnel.kite restoreand the service at start remove what a killed run left.wintun.dllis never committed.scripts/fetch-wintun.ps1pins the zip and the DLL by SHA-256; kite loads it by full path from its own directory and checks the signature.--kill-switchis refused, the app hides the toggle. Tracked in Windows: kill switch #88.SystemTrayIcon(Windows notification area);ksnistays Linux-only. No new crate. The icon registers with the shell (Kite: Disconnected).windows-sys0.61 andwindows-service0.8 were already in the tree through tun and tun2proxy.Memory (release build, Windows 11, no daemon running): tray only, 19.5 MB working set and 2.5 MB private; window open, 24.8 MB and 6.6 MB private.
Tested:
cargo test --workspaceand clippy on Windows; the Linux build ofkite-cliand the other crates checks. New tests: pipe access and a second first instance refused, the caller admin check, junction refused byprivate_dir, TUN state parsing, the daemon over a pipe (limits, bad requests, kill switch refused), the desktop client over a pipe.tun-windowsrunsscripts/tun-smoke.ps1on a runner: it checks adapter, routes, DNS rule and the route to 1.1.1.1 while up, and that all of it is gone afterkite disconnectand after the daemon was killed andkite restoreran.Docs:
docs/cli.md,docs/threat-model.md(Windows rows and gaps),apps/desktop/README.md.Smoke test notes:
kite statusshows over a hundred streams at 0 s: the runner's own traffic plus that loop. The connection from kite to the relay is not part of it; it goes to a loopback address, which no tunnel route covers, andsetupadds no host route for loopback. With a real phone the relay is on another machine and there is no loop.