Opt for a stealthier server-id string that doesn't mention thrussh
Diff
src/config.rs | 24 ++++++++++++++++++++++++
src/main.rs | 1 +
2 files changed, 25 insertions(+)
@@ -30,13 +30,37 @@
#[serde(rename_all = "kebab-case")]
pub struct Config {
#[serde(default = "Config::default_listen_address")]
pub listen_address: SocketAddr,
#[serde(default = "Config::default_access_probability")]
pub access_probability: f64,
#[serde(default = "Config::default_audit_output_file")]
pub audit_output_file: PathBuf,
#[serde(default = "Config::default_server_id")]
pub server_id: String,
}
impl Config {
fn default_listen_address() -> SocketAddr {
"0.0.0.0:22".parse().unwrap()
}
fn default_access_probability() -> f64 {
0.2
}
fn default_audit_output_file() -> PathBuf {
"/var/log/pisshoff/audit.log".parse().unwrap()
}
fn default_server_id() -> String {
"SSH-2.0-OpenSSH_9.3".to_string()
}
}
fn load_config<T: DeserializeOwned>(path: &str) -> Result<Arc<T>, std::io::Error> {
@@ -45,6 +45,7 @@
let keys = vec![thrussh_keys::key::KeyPair::generate_ed25519().unwrap()];
let thrussh_config = Arc::new(thrussh::server::Config {
server_id: args.config.server_id.to_string(),
methods: MethodSet::PASSWORD | MethodSet::PUBLICKEY | MethodSet::KEYBOARD_INTERACTIVE,
keys,
auth_rejection_time: std::time::Duration::from_secs(1),