18 Commits
Author SHA1 Message Date
Pavel 575189ac66 [vnet] Skip AAAA records when IPv6 is disabled on the host (#68666)
* don't advertise IPv6 in VNet when IPv6 is disabled on host

* show ipv6 disabled in VNet diag report

* add platformHostIPv6Disabled stub for unsupported OSes

* fix some nits
2026-08-10 18:12:19 +00:00
Pavel 7a7bbc2fc9 [vnet] Increase tun mtu to 16 KiB (#69025)
* increase tun mtu to 16 KiB

* add TELEPORT_UNSTABLE_VNET_TUN_MTU override
2026-08-06 12:08:06 +00:00
Pavel bf32ab65d9 [vnet] Reduce netstack data-path allocations (#67950)
* allow RunTestBackgroundTask to be used from benchmarks

* reuse fakeTUN packet buffers via sync.Pool to avoid benchmark alloc noise

* add network stack throughput benchmark

* bump gvisor version

* use AsViewList to drop the [][]byte alloc per outbound packet

* do go mod tidy

* fix some nits

* add 512 B chunk case to netstack throughput benchmark
2026-07-24 19:21:57 +00:00
PavelandMaja Cieślak b5071fba5a [vnet] Add DNS routing diagnostic check (#66851)
* add dns diagnostic check proto

* add DNSServerSuffix and DNSServerPort constants

* handle dns diagnostic probe queries

* add dns diagnostic check

* enable dns diagnostic check in Connect

* run dns diagnostic check in tsh vnet

* render dns diagnostic check in Connect

* fix some nits

* move ssh diag check after dns check

* handle dns diagnostic probe A queries

* add dns diagnostic check proto for A queries

* refactor dns diagnostic check to also check A records

* refactor Connect to also render dns diagnostic A records

* drop trailing dot from dns diag probe

* add tests for dns diag text rendering

* do not fail dns diag if any nameserver is reachable

* Adjust spacing between DNS diag success/warning rows

* fix some nits

* improve rendering of dns reachability errors

---------

Co-authored-by: Maja Cieślak <maja.cieslak@goteleport.com>
2026-06-17 10:56:34 +00:00
Dan Upton 998f21ef29 lib/vnet: Foundations for embedding VNet in tbot (#66074)
* lib/vnet: add `EmbeddedVNet` type

* lib/vnet/dns: make it possible to use `/etc/resolv.conf` on Linux

* Use FakeHostNetwork in vnet_test.go

* Close host-side TUN

* Link to the `/etc/resolv.conf` man page

* Extend the host network ready timeout for CI

* Stop using global logger unnecessarily

* Fix spelling mistakes in doc comments
2026-05-06 09:00:52 +00:00
8385461d56 [vnet] linux support (#63664)
* first build

* add d-bus daemon for vnet

* set up dns server via systemd-resolved d-bus api

* get DNS upstreams via systemd-resolved API

* never forward DNS requests to self

* refactor: move all systemd-resolved logic to a separate package

* refactor: move all polkit logic to a separate package

* filter systemd-resolved loopback upstreams

* add scope for link-local IPv6 adresses for upstreams

* comment updates, small fixes, and typo cleanup

* return uid from D-Bus authorize func

* add typed constants for systemd unit states

* avoid using canceled context for stopping VNet daemon

* refactor: do not store ctx in dbusDaemon

* Improve dbusDaemon lifecycle handling

* Log errors from `dbusDaemon.Wait`

* refactor: reuse shared darwin/linux code for admin process

* reintroduce isDiagSupported

* refactor logging errors from dbusDaemon.Wait

* do not return error for missing TUN during deconfigure

* use d.conn.Context()

* avoid using bare slog logger

* avoid mutating cached upstream nameserver slices

* fix race between dbus Start and Stop

* small fixes

* some refactoring

---------

Co-authored-by: Nic Klaassen <nic@goteleport.com>
Co-authored-by: Rafał Cieślak <rafal.cieslak@goteleport.com>
2026-03-17 14:23:25 +00:00
Grzegorz Zdunek d694f794f8 Forcibly exit VNet admin process if network stack doesn't shut down after timeout (#58298)
* Forcibly exit VNet admin process if network stack doesn't shut down after timeout

* Add better logging

* Review comments
2025-08-27 09:28:30 +00:00
Nic Klaassen bdb190ef09 [vnet] feat: serve DNS on IPv4 (#55539)
* [vnet] feat: serve DNS on IPv4

* explicitly assign DNS addrs without promiscous mode

* fix linux lint

* apply suggestions
2025-06-23 17:33:33 +00:00
Nic Klaassen 9916519c97 [vnet] feat: DNS resolution for VNet SSH (#54856)
* update protos

* [vnet] feat: DNS resolution for VNet SSH

* fix lint

* add comment and fix typo
2025-05-21 16:22:10 +00:00
Rafał Cieślak 1b9d60ee35 Auth: Initialize VNet config (#54408)
* Prepare values and functions to be reused

* Initialize VNet config service before NewGRPCServer

* Initialize VNet config

* Add test for getting VNet config as a user

* Remove extra require.NoError
2025-05-09 09:41:43 +00:00
Rafał Cieślak 5ebe5dd836 Make VNet daemon send logs to os_log (#54237)
* Support os_log in lib/utils.InitLogger

* Refactor code for getting bundle identifier

* Rename DaemonLabel to VNEDaemonLabel

Rename the Obj-C function so that we can add a C function called
DaemonLabel later. The C function will be called from Go code.

* Use os_log in VNet daemon

* Adjust logging preferences of VNet daemon

* Clean up logger components in lib/vnet
2025-05-06 11:22:12 +00:00
Nic Klaassen 5f97acadca migrate VNet macos to service-client paradigm (#53965) 2025-04-14 20:46:54 +00:00
Rafał Cieślak a06fc22de7 VNet diag report: Add protos and tshd implementation (#52066)
* lib/teleterm/vnet: Collect CIDR ranges while listing DNS zones

This will be used for the diagnostic report.

* Include IPv6Prefix in NetworkStackInfo

* Refactor RouteConflict into a protobuf struct

* Add protos for diagnostic report

* Add Diagnostician for generating diag report

* Add netstat command for route conflict check

* Send diag report from tshd to Electron app

* Remove unnecessary Diagnostician struct

* Return nil instead of an empty slice

* s/is supposed to return/returns/

* Capture stderr of failed command attempt

* Check if command stdout and stderr are valid UTF-8 text
2025-02-19 12:10:32 +00:00
Rafał Cieślak 7474228529 Add VNet diagnostic check for detecting conflicting routes (#51778)
* Add RunDiagnostics RPC

* Add button for running diagnostics

* Return network stack info from runPlatformUserProcess

This will allow teleterm's VNet service to read the interface name after
VNet is started.

* Add route conflict diag check

* Run route conflict diag check from teleterm's VNet service

* Add hidden diag flag to tsh vnet

* Inline CheckAndSetDefaults of RouteConflictConfig

* Add comment for RunDiagnostics RPC

* Reduce indentation in vnetCommand.run by returning early

* Add godocs

* Depend on the default split function

* Log and skip invalid route messages

* Keep exported APIs in platform-independent file

* Make NetworkStackInfo platform-independent

* Fix Go and JS linters

* Adjust title for disabled button

* Adjust check for interface name in teleterm's service

* Use teleport.Component for logger name

* Add godoc for DarwinRouting

* Use `unstable.` instead of `feature.` as app config prop prefix

Users are less likely to enable something called `unstable` than
`feature`.
2025-02-10 10:31:53 +00:00
Nic Klaassen 87135fc5e6 [vnet] remote app provider (#51279)
* [vnet] remote app provider

* use fully qualified domain for non-matching app

* make errNoTCPHandler a trace error

* fix license headers

* remove explicit trail calls, rely on gRPC interceptors

* wrap error

* add comment on signer cache lifecycle

* fix imports

* make test client app grpc service listen on localhost

* remove test 100ms dial timeout for ci
2025-01-28 18:23:19 +00:00
Nic Klaassen c8d8c21578 [vnet] refactor AppProvider for Windows implementation (#51216)
* [vnet] refactor AppProvider for Windows implementation

* allow empty cert pool

* fix unconvert lint

* fix root cluster ca pool

* edit log message

* return errors when failing to get appinfo for matching app

* edit comment on ClientApplication interface

* add missing license header
2025-01-24 00:10:27 +00:00
Nic Klaassen 69188d4a38 [vnet] windows service stub (#50468)
* [vnet] Windows service

* address alan's comments

* fix typo in comment
2025-01-17 17:57:13 +00:00
Nic Klaassen 986bad7fdf chore: restructure vnet for windows support (#49921)
* chore: restructure vnet for windows support

In preparation for adding Windows support to VNet, I have restructured
the package/file structure a bit in a way that I think makes more sense
and narrows the scope of OS-specific code.

I also unexported some identifiers that did not need to be exported, in
an attempt to make it more clear what is actually called from outside
the vnet package.

This commit does not make any functional changes except for adding the
hidden `tsh vnet` and `tsh vnet-admin-setup` commands on windows that
will just return errors.

* fix renames in comments

* switch reexec to escalate

* fix-imports
2024-12-09 22:51:24 +00:00