sshlogd/src/main.rs

36 lines
875 B
Rust
Raw Normal View History

2022-09-19 22:26:20 +02:00
use std::str::FromStr;
use std::sync::Arc;
2022-09-25 20:06:38 +02:00
mod server;
mod handler;
2022-09-19 22:26:20 +02:00
#[tokio::main]
async fn main() {
env_logger::builder()
.filter_level(log::LevelFilter::Info)
.init();
2022-09-19 23:53:20 +02:00
let listen_addr = std::env::args().skip(1).next()
2022-09-19 23:36:58 +02:00
.expect("Expecting <addr:port>");
2022-09-19 22:26:20 +02:00
let mut config = russh::server::Config::default();
2022-09-23 23:22:27 +02:00
config.auth_banner = Some("#
# DEMONSTRATION SYSTEM
#
# All input will be published
#
");
2022-09-19 22:26:20 +02:00
config.connection_timeout = Some(std::time::Duration::from_secs(10000));
config.auth_rejection_time = std::time::Duration::from_secs(1);
config.keys.push(russh_keys::key::KeyPair::generate_ed25519().unwrap());
let config = Arc::new(config);
2022-09-25 20:06:38 +02:00
let sh = server::Server;
2022-09-19 22:26:20 +02:00
russh::server::run(
config,
2022-09-19 23:36:58 +02:00
&std::net::SocketAddr::from_str(&listen_addr).unwrap(),
2022-09-19 22:26:20 +02:00
sh,
)
.await
.unwrap();
}