Enum makiko::ClientEvent
source · #[non_exhaustive]pub enum ClientEvent {
ServerPubkey(Pubkey, AcceptPubkey),
DebugMsg(DebugMsg),
AuthBanner(AuthBanner),
Tunnel(AcceptTunnel),
Channel(AcceptChannel),
}
Expand description
An event returned from ClientReceiver
.
These are “global” events that are related to the SSH connection, not to a particular
session/channel. You can safely ignore all events except ServerPubkey
,
which you must handle in order to accept or reject the server’s public key (if you don’t handle
this event, the key will be rejected and we will abort the connection).
This enum is marked as #[non_exhaustive]
, so that we can add new variants without breaking
backwards compatibility. It should always be safe to ignore any events that you don’t intend to
handle.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
ServerPubkey(Pubkey, AcceptPubkey)
Server presented its public key and you should verify it.
This event is produced as part of the SSH key exchange. You will always receive this event during the initial handshake, but you may also receive it again later on, when the connection is “rekeyed”.
The SSH protocol does not provide any mechanism to verify the identity of the server, so it is up to you. Please read RFC 4251, section 4.1 for more details and suggestions on how to deal with this problem.
The Pubkey
is the public key that the server provided as part of the key exchange. We
have already verified that the server owns the private key. You should use the
AcceptPubkey
object to either .accept()
or
.reject()
the key.
DebugMsg(DebugMsg)
Server sent us a debugging message.
This is the “debug message” (SSH_MSG_DEBUG
) described in RFC 4253, section 11.3. You can
simply ignore this event.
AuthBanner(AuthBanner)
Server sent a text that the user should see before authentication.
This is the “banner message” (SSH_MSG_USERAUTH_BANNER
) described in RFC 4252, section
5.2. Citing from the RFC, this message “may be relevant for getting legal protection”. You
can probably ignore this event.
Tunnel(AcceptTunnel)
Server attempts to open a tunnel.
You normally recieve this event when you have requested remote forwarding using
Client::bind_tunnel()
and somebody tries to connect to
the address that you specified. You can use the AcceptTunnel
object to inspect the
connection attempt and accept or reject the tunnel.
Channel(AcceptChannel)
Server attempts to open a channel (low level API).
This is the SSH_MSG_CHANNEL_OPEN
message described in RFC 4255, section 5.1. You can use
the AcceptChannel
object to get details about the message and accept or reject the
channel.
Note that by default, some of these messages are translated to higher-level events (such as
Tunnel
). See ClientReceiver::specialize_channels()
for a way to
disable this behavior.