Skip to main content

WishHandler

Struct WishHandler 

Source
pub struct WishHandler { /* private fields */ }
Expand description

Handler for a single SSH connection.

Implements russh::server::Handler to handle SSH protocol events and bridge them to Wish’s session/middleware system.

Implementations§

Source§

impl WishHandler

Source

pub fn new( remote_addr: SocketAddr, local_addr: SocketAddr, server_state: Arc<ServerState>, shutdown_rx: Receiver<()>, ) -> Self

Creates a new handler for a connection.

Trait Implementations§

Source§

impl Handler for WishHandler

Source§

fn auth_publickey<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, user: &'life1 str, public_key: &'life2 PublicKey, ) -> Pin<Box<dyn Future<Output = Result<Auth, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Handle public key authentication.

Source§

fn auth_password<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, user: &'life1 str, password: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Auth, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Handle password authentication.

Source§

fn auth_none<'life0, 'life1, 'async_trait>( &'life0 mut self, user: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Auth, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Handle “none” authentication (for servers that accept all).

Source§

fn auth_keyboard_interactive<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, user: &'life1 str, submethods: &'life2 str, response: Option<Response<'async_trait>>, ) -> Pin<Box<dyn Future<Output = Result<Auth, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Handle keyboard-interactive authentication.

Source§

fn channel_open_session<'life0, 'life1, 'async_trait>( &'life0 mut self, channel: Channel<Msg>, session: &'life1 mut RusshSession, ) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Handle new session channel.

Source§

fn pty_request<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, channel: ChannelId, term: &'life1 str, col_width: u32, row_height: u32, _pix_width: u32, _pix_height: u32, _modes: &'life2 [(Pty, u32)], session: &'life3 mut RusshSession, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Handle PTY request.

Source§

fn shell_request<'life0, 'life1, 'async_trait>( &'life0 mut self, channel: ChannelId, session: &'life1 mut RusshSession, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Handle shell request.

Source§

fn exec_request<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, channel: ChannelId, data: &'life1 [u8], session: &'life2 mut RusshSession, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Handle exec request (command execution).

Source§

fn env_request<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, channel: ChannelId, variable_name: &'life1 str, variable_value: &'life2 str, session: &'life3 mut RusshSession, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Handle environment variable request.

Source§

fn subsystem_request<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, channel: ChannelId, name: &'life1 str, session: &'life2 mut RusshSession, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Handle subsystem request.

Source§

fn window_change_request<'life0, 'life1, 'async_trait>( &'life0 mut self, channel: ChannelId, col_width: u32, row_height: u32, _pix_width: u32, _pix_height: u32, _session: &'life1 mut RusshSession, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Handle window change request.

Source§

fn data<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, channel: ChannelId, data: &'life1 [u8], _session: &'life2 mut RusshSession, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Handle data from client.

Source§

fn channel_eof<'life0, 'life1, 'async_trait>( &'life0 mut self, channel: ChannelId, _session: &'life1 mut RusshSession, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Handle channel EOF.

Source§

fn channel_close<'life0, 'life1, 'async_trait>( &'life0 mut self, channel: ChannelId, _session: &'life1 mut RusshSession, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Handle channel close.

Source§

type Error = Error

Source§

fn auth_publickey_offered<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, user: &'life1 str, public_key: &'life2 PublicKey, ) -> Pin<Box<dyn Future<Output = Result<Auth, Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: Send + 'async_trait,

Check authentication using the “publickey” method. This method should just check whether the public key matches the authorized ones. Russh then checks the signature. If the key is unknown, or the signature is invalid, Russh guarantees that rejection happens in constant time config.auth_rejection_time, except if this method takes more time than that.
Source§

fn auth_succeeded<'life0, 'life1, 'async_trait>( &'life0 mut self, session: &'life1 mut Session, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: Send + 'async_trait,

Called when authentication succeeds for a session.
Source§

fn channel_open_x11<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, channel: Channel<Msg>, originator_address: &'life1 str, originator_port: u32, session: &'life2 mut Session, ) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: Send + 'async_trait,

Called when a new X11 channel is created. Return value indicates whether the channel request should be granted.
Source§

fn channel_open_direct_tcpip<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, channel: Channel<Msg>, host_to_connect: &'life1 str, port_to_connect: u32, originator_address: &'life2 str, originator_port: u32, session: &'life3 mut Session, ) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: Send + 'async_trait,

Called when a new TCP/IP is created. Return value indicates whether the channel request should be granted.
Source§

fn channel_open_forwarded_tcpip<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, channel: Channel<Msg>, host_to_connect: &'life1 str, port_to_connect: u32, originator_address: &'life2 str, originator_port: u32, session: &'life3 mut Session, ) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: Send + 'async_trait,

Called when a new forwarded connection comes in. https://www.rfc-editor.org/rfc/rfc4254#section-7
Source§

fn channel_open_confirmation<'life0, 'life1, 'async_trait>( &'life0 mut self, id: ChannelId, max_packet_size: u32, window_size: u32, session: &'life1 mut Session, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: Send + 'async_trait,

Called when the client confirmed our request to open a channel. A channel can only be written to after receiving this message (this library panics otherwise).
Source§

fn extended_data<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, channel: ChannelId, code: u32, data: &'life1 [u8], session: &'life2 mut Session, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: Send + 'async_trait,

Called when an extended data packet is received. Code 1 means that this packet comes from stderr, other codes are not defined (see RFC4254).
Source§

fn window_adjusted<'life0, 'life1, 'async_trait>( &'life0 mut self, channel: ChannelId, new_size: u32, session: &'life1 mut Session, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: Send + 'async_trait,

Called when the network window is adjusted, meaning that we can send more bytes.
Source§

fn adjust_window(&mut self, channel: ChannelId, current: u32) -> u32

Called when this server adjusts the network window. Return the next target window.
Source§

fn x11_request<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, channel: ChannelId, single_connection: bool, x11_auth_protocol: &'life1 str, x11_auth_cookie: &'life2 str, x11_screen_number: u32, session: &'life3 mut Session, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: Send + 'async_trait,

The client requests an X11 connection.
Source§

fn agent_request<'life0, 'life1, 'async_trait>( &'life0 mut self, channel: ChannelId, session: &'life1 mut Session, ) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: Send + 'async_trait,

The client requests OpenSSH agent forwarding
Source§

fn signal<'life0, 'life1, 'async_trait>( &'life0 mut self, channel: ChannelId, signal: Sig, session: &'life1 mut Session, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: Send + 'async_trait,

The client is sending a signal (usually to pass to the currently running process).
Source§

fn tcpip_forward<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, address: &'life1 str, port: &'life2 mut u32, session: &'life3 mut Session, ) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: Send + 'async_trait,

Used for reverse-forwarding ports, see RFC4254. If port is 0, you should set it to the allocated port number.
Source§

fn cancel_tcpip_forward<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, address: &'life1 str, port: u32, session: &'life2 mut Session, ) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: Send + 'async_trait,

Used to stop the reverse-forwarding of a port, see RFC4254.
Source§

fn streamlocal_forward<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, socket_path: &'life1 str, session: &'life2 mut Session, ) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: Send + 'async_trait,

Source§

fn cancel_streamlocal_forward<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, socket_path: &'life1 str, session: &'life2 mut Session, ) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: Send + 'async_trait,

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more