pub struct SessionHandler { /* private fields */ }Expand description
Per-connection handler.
Trait Implementations§
Source§impl Handler for SessionHandler
impl Handler for SessionHandler
Source§async fn auth_publickey(
&mut self,
user: &str,
key: &PublicKey,
) -> Result<Auth, Self::Error>
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>
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>
async fn data( &mut self, channel: ChannelId, data: &[u8], _session: &mut Session, ) -> Result<(), Self::Error>
Channel bytes are the board’s input stream.
type Error = ServerError
Source§async fn auth_none(&mut self, _user: &str) -> Result<Auth, Self::Error>
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>
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>
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>
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>
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>
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>
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>
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
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
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
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
fn auth_succeeded( &mut self, session: &mut Session, ) -> impl Future<Output = Result<(), Self::Error>> + Send
Called when authentication succeeds for a session.
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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.
fn streamlocal_forward( &mut self, socket_path: &str, session: &mut Session, ) -> impl Future<Output = Result<bool, Self::Error>> + Send
fn cancel_streamlocal_forward( &mut self, socket_path: &str, session: &mut Session, ) -> impl Future<Output = Result<bool, Self::Error>> + Send
Auto Trait Implementations§
impl Freeze for SessionHandler
impl RefUnwindSafe for SessionHandler
impl Send for SessionHandler
impl Sync for SessionHandler
impl Unpin for SessionHandler
impl UnsafeUnpin for SessionHandler
impl UnwindSafe for SessionHandler
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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