mirror of
https://github.com/Noratrieb/cluelessh.git
synced 2026-01-16 09:25:04 +01:00
improvements and fixes
This commit is contained in:
parent
4c3f0a97aa
commit
7696484f0b
4 changed files with 28 additions and 5 deletions
|
|
@ -87,6 +87,7 @@ async fn handle_connection(
|
||||||
.await
|
.await
|
||||||
.wrap_err("reading from connection")?;
|
.wrap_err("reading from connection")?;
|
||||||
if read == 0 {
|
if read == 0 {
|
||||||
|
info!("Did not read any bytes from TCP stream, EOF");
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -100,6 +101,7 @@ async fn handle_connection(
|
||||||
return Err(err);
|
return Err(err);
|
||||||
}
|
}
|
||||||
SshStatus::Disconnect => {
|
SshStatus::Disconnect => {
|
||||||
|
info!("Received disconnect from client");
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -157,8 +157,8 @@ impl ServerChannelsState {
|
||||||
|
|
||||||
self.packets_to_send
|
self.packets_to_send
|
||||||
.push_back(Packet::new_msg_channel_open_confirmation(
|
.push_back(Packet::new_msg_channel_open_confirmation(
|
||||||
our_number.0,
|
|
||||||
sender_channel,
|
sender_channel,
|
||||||
|
our_number.0,
|
||||||
initial_window_size,
|
initial_window_size,
|
||||||
max_packet_size,
|
max_packet_size,
|
||||||
));
|
));
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,6 @@ pub mod auth {
|
||||||
info!(%password, "Got password");
|
info!(%password, "Got password");
|
||||||
// Don't worry queen, your password is correct!
|
// Don't worry queen, your password is correct!
|
||||||
self.queue_packet(Packet::new_msg_userauth_success());
|
self.queue_packet(Packet::new_msg_userauth_success());
|
||||||
|
|
||||||
self.is_authenticated = true;
|
self.is_authenticated = true;
|
||||||
}
|
}
|
||||||
"publickey" => {
|
"publickey" => {
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@ pub mod parse;
|
||||||
use core::str;
|
use core::str;
|
||||||
use std::{collections::VecDeque, mem::take};
|
use std::{collections::VecDeque, mem::take};
|
||||||
|
|
||||||
use ed25519_dalek::ed25519::signature::Signer;
|
|
||||||
use crypto::{AlgorithmName, AlgorithmNegotiation, EncryptionAlgorithm};
|
use crypto::{AlgorithmName, AlgorithmNegotiation, EncryptionAlgorithm};
|
||||||
|
use ed25519_dalek::ed25519::signature::Signer;
|
||||||
use packet::{
|
use packet::{
|
||||||
DhKeyExchangeInitReplyPacket, KeyExchangeEcDhInitPacket, KeyExchangeInitPacket, Packet,
|
DhKeyExchangeInitReplyPacket, KeyExchangeEcDhInitPacket, KeyExchangeInitPacket, Packet,
|
||||||
PacketTransport, SshPublicKey, SshSignature,
|
PacketTransport, SshPublicKey, SshSignature,
|
||||||
|
|
@ -153,7 +153,26 @@ impl ServerConnection {
|
||||||
let description = disconnect.utf8_string()?;
|
let description = disconnect.utf8_string()?;
|
||||||
let _language_tag = disconnect.utf8_string()?;
|
let _language_tag = disconnect.utf8_string()?;
|
||||||
|
|
||||||
info!(%reason, %description, "Client disconnecting");
|
let reason_string = match reason {
|
||||||
|
1 => "SSH_DISCONNECT_HOST_NOT_ALLOWED_TO_CONNECT",
|
||||||
|
2 => "SSH_DISCONNECT_PROTOCOL_ERROR",
|
||||||
|
3 => "SSH_DISCONNECT_KEY_EXCHANGE_FAILED",
|
||||||
|
4 => "SSH_DISCONNECT_RESERVED",
|
||||||
|
5 => "SSH_DISCONNECT_MAC_ERROR",
|
||||||
|
6 => "SSH_DISCONNECT_COMPRESSION_ERROR",
|
||||||
|
7 => "SSH_DISCONNECT_SERVICE_NOT_AVAILABLE",
|
||||||
|
8 => "SSH_DISCONNECT_PROTOCOL_VERSION_NOT_SUPPORTED",
|
||||||
|
9 => "SSH_DISCONNECT_HOST_KEY_NOT_VERIFIABLE",
|
||||||
|
10 => "SSH_DISCONNECT_CONNECTION_LOST",
|
||||||
|
11 => "SSH_DISCONNECT_BY_APPLICATION",
|
||||||
|
12 => "SSH_DISCONNECT_TOO_MANY_CONNECTIONS",
|
||||||
|
13 => "SSH_DISCONNECT_AUTH_CANCELLED_BY_USER",
|
||||||
|
14 => "SSH_DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE",
|
||||||
|
15 => "SSH_DISCONNECT_ILLEGAL_USER_NAME",
|
||||||
|
_ => "<unknown>",
|
||||||
|
};
|
||||||
|
|
||||||
|
info!(%reason, %reason_string, %description, "Client disconnecting");
|
||||||
|
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
@ -179,7 +198,10 @@ impl ServerConnection {
|
||||||
};
|
};
|
||||||
|
|
||||||
let kex_algorithms = AlgorithmNegotiation {
|
let kex_algorithms = AlgorithmNegotiation {
|
||||||
supported: vec![crypto::KEX_CURVE_25519_SHA256, crypto::KEX_ECDH_SHA2_NISTP256],
|
supported: vec![
|
||||||
|
crypto::KEX_CURVE_25519_SHA256,
|
||||||
|
crypto::KEX_ECDH_SHA2_NISTP256,
|
||||||
|
],
|
||||||
};
|
};
|
||||||
let kex_algorithm = kex_algorithms.find(kex.kex_algorithms.0)?;
|
let kex_algorithm = kex_algorithms.find(kex.kex_algorithms.0)?;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue