Skip to main content

Module ssh

Module ssh 

Source
Expand description

Support for tailnet-native, in-process SSH servers.

§Overview

This module (tailscale::ssh) holds helpers for running SSH servers on the tailnet using russh. They delegate their functionality to the Handler trait, which is russh’s notion of a connection handler, i.e. a single incoming TCP connection gets a single instance of Handler.

§Channels

SSH has a nested notion of channels, which are multiplexed over a single connection. The terminal session you open over a normal machine-to-machine ssh connection runs in a channel, and in principle, you can have multiple channels open on the same connection.

The channel_server module provides a ChannelServer type that separates out the per-channel handler logic from russh’s monolithic Handler. Channel handler logic is supported here by ChannelHandler, which is passed into ChannelServer and processes a ChannelEvent stream for each channel that’s opened.

§Terminal applications

Support for building per-channel terminal application is provided by RatatuiTerm, which implements ChannelHandler to drive a ratatui::Terminal. The user provides an implementation of RatatuiApp that consumes input data and supports draws to the screen, and the RatatuiTerm drives it automatically.

Re-exports§

pub extern crate russh;

Structs§

ChannelServer
Implementation of russh::server::Handler which provides per-channel session handlers using a parametric ChannelHandler.
RatatuiTerm
A ChannelHandler that runs a RatatuiApp.
ShellHandler
A turnkey ChannelHandler that runs the authorized user’s login shell in a PTY.
SshAccept
Details of an accepted SSH connection.
SshPolicy
An owned Tailscale SSH policy. Mirrors tailcfg.SSHPolicy.

Enums§

ChannelEvent
An event that may be generated by a channel connected to a ChannelServer.
SshDecision
The outcome of evaluating an SshPolicy against a connection.
SshDenyReason
Why a connection was denied. Mirrors Go’s rejected / rejectedUser results plus an explicit reject action.

Traits§

ChannelHandler
Handler for a channel session.
RatatuiApp
A ratatui application designed to be driven by a ChannelServer.
RatatuiEnv
Terminal environment for RatatuiApp.
TailnetServer
Trait to construct a new Handler from a Tailscale Device and the address of a connecting client.