Skip to main content

SessionHandler

Struct SessionHandler 

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

Per-connection handler.

Trait Implementations§

Source§

impl Handler for SessionHandler

Source§

async fn auth_publickey( &mut self, user: &str, key: &PublicKey, ) -> Result<Auth, Self::Error>

Accept every well-signed key: unknown keys must be able to connect to run signup/accept. Known keys get their registry user attached; command-level gating happens in the router.

Source§

async fn shell_request( &mut self, channel: ChannelId, session: &mut Session, ) -> Result<(), Self::Error>

Enrolled keys with a pty get the board (picker first when they belong to several tenants); unknown keys get usage guidance and a closed channel; pty-less requests are told to reconnect with ssh -t.

Source§

async fn data( &mut self, channel: ChannelId, data: &[u8], _session: &mut Session, ) -> Result<(), Self::Error>

Channel bytes are the board’s input stream.

Source§

type Error = ServerError

Source§

async fn auth_none(&mut self, _user: &str) -> Result<Auth, Self::Error>

Check authentication using the “none” method. Read more
Source§

async fn auth_password( &mut self, _user: &str, _password: &str, ) -> Result<Auth, Self::Error>

Check authentication using the “password” method. Read more
Source§

async fn channel_open_session( &mut self, _channel: Channel<Msg>, reply: ChannelOpenHandle, _session: &mut Session, ) -> Result<(), Self::Error>

Called when a new session channel is requested by the client. Read more
Source§

async fn pty_request( &mut self, channel: ChannelId, _term: &str, col_width: u32, row_height: u32, _pix_width: u32, _pix_height: u32, _modes: &[(Pty, u32)], session: &mut Session, ) -> Result<(), Self::Error>

The client requests a pseudo-terminal with the given specifications. Read more
Source§

async fn window_change_request( &mut self, channel: ChannelId, col_width: u32, row_height: u32, _pix_width: u32, _pix_height: u32, _session: &mut Session, ) -> Result<(), Self::Error>

The client’s pseudo-terminal window size has changed. Read more
Source§

async fn exec_request( &mut self, channel: ChannelId, data: &[u8], session: &mut Session, ) -> Result<(), Self::Error>

The client sends a command to execute, to be passed to a shell. Make sure to check the command before doing so. Read more
Source§

async fn channel_eof( &mut self, channel: ChannelId, _session: &mut Session, ) -> Result<(), Self::Error>

Called when the client sends EOF to a channel.
Source§

async fn channel_close( &mut self, channel: ChannelId, _session: &mut Session, ) -> Result<(), Self::Error>

Called when the client closes a channel.
Source§

fn auth_publickey_offered( &mut self, user: &str, public_key: &PublicKey, ) -> impl Future<Output = Result<Auth, Self::Error>> + Send

Pre-authentication callback for public key authentication. This method is called when a client is: Read more
Source§

fn auth_openssh_certificate( &mut self, user: &str, certificate: &Certificate, ) -> impl Future<Output = Result<Auth, Self::Error>> + Send

Check authentication using an OpenSSH certificate. This method is called after the signature has been verified and key ownership has been confirmed. Read more
Source§

fn auth_keyboard_interactive<'a>( &'a mut self, user: &str, submethods: &str, response: Option<Response<'a>>, ) -> impl Future<Output = Result<Auth, Self::Error>> + Send

Check authentication using the “keyboard-interactive” method. Read more
Source§

fn auth_succeeded( &mut self, session: &mut Session, ) -> impl Future<Output = Result<(), Self::Error>> + Send

Called when authentication succeeds for a session.
Source§

fn authentication_banner( &mut self, ) -> impl Future<Output = Result<Option<String>, Self::Error>> + Send

Called when authentication starts but before it is successful. Return value is an authentication banner, usually a warning message shown to the client.
Source§

fn channel_open_x11( &mut self, channel: Channel<Msg>, originator_address: &str, originator_port: u32, reply: ChannelOpenHandleInner<Msg>, session: &mut Session, ) -> impl Future<Output = Result<(), Self::Error>> + Send

Called when a new X11 channel is requested by the client. Read more
Source§

fn channel_open_direct_tcpip( &mut self, channel: Channel<Msg>, host_to_connect: &str, port_to_connect: u32, originator_address: &str, originator_port: u32, reply: ChannelOpenHandleInner<Msg>, session: &mut Session, ) -> impl Future<Output = Result<(), Self::Error>> + Send

Called when a new direct TCP/IP (“local TCP forwarding”) channel is requested. Read more
Source§

fn channel_open_forwarded_tcpip( &mut self, channel: Channel<Msg>, host_to_connect: &str, port_to_connect: u32, originator_address: &str, originator_port: u32, reply: ChannelOpenHandleInner<Msg>, session: &mut Session, ) -> impl Future<Output = Result<(), Self::Error>> + Send

Called when a new remote forwarded TCP connection comes in. Read more
Source§

fn channel_open_direct_streamlocal( &mut self, channel: Channel<Msg>, socket_path: &str, reply: ChannelOpenHandleInner<Msg>, session: &mut Session, ) -> impl Future<Output = Result<(), Self::Error>> + Send

Called when a new direct-streamlocal (“local UNIX socket forwarding”) channel is requested. Read more
Source§

fn channel_open_confirmation( &mut self, id: ChannelId, max_packet_size: u32, window_size: u32, session: &mut Session, ) -> impl Future<Output = Result<(), Self::Error>> + Send

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( &mut self, channel: ChannelId, code: u32, data: &[u8], session: &mut Session, ) -> impl Future<Output = Result<(), Self::Error>> + Send

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( &mut self, channel: ChannelId, new_size: u32, session: &mut Session, ) -> impl Future<Output = Result<(), Self::Error>> + Send

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( &mut self, channel: ChannelId, single_connection: bool, x11_auth_protocol: &str, x11_auth_cookie: &str, x11_screen_number: u32, session: &mut Session, ) -> impl Future<Output = Result<(), Self::Error>> + Send

The client requests an X11 connection. Read more
Source§

fn env_request( &mut self, channel: ChannelId, variable_name: &str, variable_value: &str, session: &mut Session, ) -> impl Future<Output = Result<(), Self::Error>> + Send

The client wants to set the given environment variable. Check these carefully, as it is dangerous to allow any variable environment to be set. Read more
Source§

fn subsystem_request( &mut self, channel: ChannelId, name: &str, session: &mut Session, ) -> impl Future<Output = Result<(), Self::Error>> + Send

The client asks to start the subsystem with the given name (such as sftp). Read more
Source§

fn agent_request( &mut self, channel: ChannelId, session: &mut Session, ) -> impl Future<Output = Result<bool, Self::Error>> + Send

The client requests OpenSSH agent forwarding Read more
Source§

fn signal( &mut self, channel: ChannelId, signal: Sig, session: &mut Session, ) -> impl Future<Output = Result<(), Self::Error>> + Send

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

fn tcpip_forward( &mut self, address: &str, port: &mut u32, session: &mut Session, ) -> impl Future<Output = Result<bool, Self::Error>> + Send

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( &mut self, address: &str, port: u32, session: &mut Session, ) -> impl Future<Output = Result<bool, Self::Error>> + Send

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

fn streamlocal_forward( &mut self, socket_path: &str, session: &mut Session, ) -> impl Future<Output = Result<bool, Self::Error>> + Send

Source§

fn cancel_streamlocal_forward( &mut self, socket_path: &str, session: &mut Session, ) -> impl Future<Output = Result<bool, Self::Error>> + Send

Source§

fn lookup_dh_gex_group( &mut self, gex_params: &GexParams, ) -> impl Future<Output = Result<Option<DhGroup>, Self::Error>> + Send

Override when enabling the diffie-hellman-group-exchange-* key exchange methods. Read more

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.