[vnet] install and run windows service #50468
Draft
+937
−431
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.
This commit adds a Windows service for VNet. It adds support for automatically installing and running the service when the user runs
tsh vnet
, and adds a command to manually uninstall/delete the service.The service creates the TUN interface and establishes an IPC connection with the user process over a named pipe, but for now does not actually handle any networking, the rest will come in later PRs.
If you want to test this out on a Windows machine/VM, you should be able to run
tsh vnet
and see that:sc.exe query state=all | grep -A3 Teleport
logs.txt
in the directory wheretsh
is installed (this is temporary until I find a better place for logs).netsh interface show interface
Unfortunately this PR does not include any unit tests. Most of the functionality here needs to be able to escalate to administrator with a UAC prompt and needs to run on Windows, this is exactly the kind of unit test that is very hard to write and would never actually be able to run in CI.
But, any part of this that's broken would immediately break VNet on Windows, and this should be caught in any test plan.