-
Notifications
You must be signed in to change notification settings - Fork 2k
[v18] Add Linux VNet systemd, dbus, polkit files to the teleport-connect package #64737
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: branch/v18
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| # Teleport VNet Linux Files | ||
|
|
||
| This directory contains files needed for VNet to work on Linux. | ||
| Teleport Connect ships these files in its package. | ||
|
|
||
| ## Files | ||
|
|
||
| - `teleport-vnet.service`: systemd unit for the privileged VNet daemon. | ||
| - `dbus/org.teleport.vnet1.conf`: D-Bus system bus policy for `org.teleport.vnet1`. | ||
| - `dbus/org.teleport.vnet1.service`: D-Bus service activation entry for `org.teleport.vnet1`. | ||
| - `polkit/org.teleport.vnet1.policy`: polkit policy used to authorize starting and stopping the privileged VNet daemon. | ||
|
|
||
| ## Install locations (package defaults) | ||
|
|
||
| - `teleport-vnet.service` -> `/usr/lib/systemd/system/teleport-vnet.service` | ||
| - `dbus/org.teleport.vnet1.conf` -> `/usr/share/dbus-1/system.d/org.teleport.vnet1.conf` | ||
| - `dbus/org.teleport.vnet1.service` -> `/usr/share/dbus-1/system-services/org.teleport.vnet1.service` | ||
| - `polkit/org.teleport.vnet1.policy` -> `/usr/share/polkit-1/actions/org.teleport.vnet1.policy` | ||
|
|
||
| Notes: | ||
| - For packaged vendor files, `/usr/share/...` is the standard location. | ||
| - `/etc/dbus-1/system.d/` is typically for local admin overrides, not vendor package files. | ||
|
|
||
| ## Manual install example | ||
|
|
||
| ```bash | ||
| sudo cp teleport-vnet.service /usr/lib/systemd/system/teleport-vnet.service | ||
| sudo cp dbus/org.teleport.vnet1.conf /usr/share/dbus-1/system.d/org.teleport.vnet1.conf | ||
| sudo cp dbus/org.teleport.vnet1.service /usr/share/dbus-1/system-services/org.teleport.vnet1.service | ||
| sudo cp polkit/org.teleport.vnet1.policy /usr/share/polkit-1/actions/org.teleport.vnet1.policy | ||
| sudo systemctl daemon-reload | ||
| sudo dbus-send --print-reply --system --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.ReloadConfig | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| <!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN" | ||
| "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> | ||
| <busconfig> | ||
| <policy user="root"> | ||
| <allow own="org.teleport.vnet1"/> | ||
| </policy> | ||
|
|
||
| <policy context="default"> | ||
| <allow send_destination="org.teleport.vnet1"/> | ||
| </policy> | ||
| </busconfig> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| [D-BUS Service] | ||
| Name=org.teleport.vnet1 | ||
| SystemdService=teleport-vnet.service | ||
| User=root | ||
| Exec=/bin/false |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <!DOCTYPE policyconfig PUBLIC | ||
| "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN" | ||
| "http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd"> | ||
| <policyconfig> | ||
|
|
||
| <action id="org.teleport.vnet1.manage-daemon"> | ||
| <description>Start Teleport VNet</description> | ||
| <message>Authentication is required to start Teleport VNet</message> | ||
| <defaults> | ||
| <allow_any>no</allow_any> | ||
| <allow_inactive>no</allow_inactive> | ||
| <!-- Default behavior if no rule matches --> | ||
| <allow_active>yes</allow_active> | ||
| </defaults> | ||
| </action> | ||
|
|
||
| </policyconfig> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| [Unit] | ||
| Description=Teleport VNet D-Bus service | ||
| After=dbus.service | ||
| Requires=dbus.service | ||
|
|
||
| [Service] | ||
| Type=dbus | ||
| BusName=org.teleport.vnet1 | ||
| ExecStart=/usr/local/bin/tsh vnet-daemon | ||
| User=root | ||
| Group=root | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -105,4 +105,44 @@ else | |
| fi | ||
| fi | ||
|
|
||
| has_systemd() { | ||
| [ -d /run/systemd/system ] && command -v systemctl >/dev/null 2>&1 | ||
| } | ||
|
|
||
| install_vnet_file() { | ||
| src="$1" | ||
| dst="$2" | ||
| mode="$3" | ||
|
|
||
| [ -f "$src" ] || return 0 | ||
| mkdir -p "$(dirname "$dst")" | ||
| install -m "$mode" "$src" "$dst" | ||
| } | ||
|
|
||
| reload_dbus_config() { | ||
| # Normally packages that install files into | ||
| # D-Bus configuration directories (for example): | ||
| # /usr/share/dbus-1/system.d/ | ||
| # /usr/share/dbus-1/system-services/ | ||
| # | ||
| # rely on package manager to reload the system bus configuration after installation. | ||
| # | ||
| # In our case, these files are copied into place by post-install script, so we reload | ||
| # dbus config manually. | ||
| dbus-send --print-reply --system \ | ||
| --dest=org.freedesktop.DBus \ | ||
| /org/freedesktop/DBus \ | ||
| org.freedesktop.DBus.ReloadConfig >/dev/null 2>&1 || true | ||
| } | ||
|
|
||
| if has_systemd; then | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The new post-install logic copies all VNet dbus/polkit/systemd files only when Useful? React with 👍 / 👎. |
||
| VNET_SOURCE_DIR=$APP/resources/vnet | ||
| install_vnet_file "$VNET_SOURCE_DIR/polkit/org.teleport.vnet1.policy" /usr/share/polkit-1/actions/org.teleport.vnet1.policy 0644 | ||
| install_vnet_file "$VNET_SOURCE_DIR/dbus/org.teleport.vnet1.conf" /usr/share/dbus-1/system.d/org.teleport.vnet1.conf 0644 | ||
| install_vnet_file "$VNET_SOURCE_DIR/dbus/org.teleport.vnet1.service" /usr/share/dbus-1/system-services/org.teleport.vnet1.service 0644 | ||
| install_vnet_file "$VNET_SOURCE_DIR/teleport-vnet.service" /usr/lib/systemd/system/teleport-vnet.service 0644 | ||
| systemctl daemon-reload || true | ||
| reload_dbus_config | ||
| fi | ||
|
|
||
| # vim: syntax=sh | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This unit starts
tsh vnet-daemon, but on Linux that subcommand is not registered:tool/tsh/common/vnet_nodaemon.gois built for!darwinand returnsvnetCommandNotSupported, so the daemon entrypoint is unavailable on this platform. As a result, D-Bus/systemd activation ofteleport-vnet.servicewill fail immediately, making the packaged Linux VNet service non-functional.Useful? React with 👍 / 👎.