forked from midefos/martillo-maldito
adding tcp command server to ban ips
This commit is contained in:
1 parent
6a54d6edf2
commit
1919ec183e
2 files changed
+103
-6
No files matched your search
+12
-6
@@ -1,8 +1,11 @@
|
||||
pub mod iptables_save;
|
||||
pub mod login_attempt;
|
||||
pub mod tpc_command_server;
|
||||
|
||||
use crate::tpc_command_server::start_tcp_command_server;
|
||||
use linemux::MuxedLines;
|
||||
use login_attempt::LoginAttempt;
|
||||
use std::thread;
|
||||
use std::{collections::HashMap, thread::sleep, time::Duration};
|
||||
|
||||
#[tokio::main]
|
||||
@@ -17,12 +20,15 @@ async fn main() -> std::io::Result<()> {
|
||||
"starting iptables-save, run every {} seconds",
|
||||
seconds_iptables.as_secs()
|
||||
);
|
||||
tokio::spawn(async move {
|
||||
loop {
|
||||
sleep(seconds_iptables);
|
||||
iptables_save::save_iptables();
|
||||
println!("saved iptables rules");
|
||||
}
|
||||
|
||||
thread::spawn(move || loop {
|
||||
sleep(seconds_iptables);
|
||||
iptables_save::save_iptables();
|
||||
println!("saved iptables rules");
|
||||
});
|
||||
|
||||
thread::spawn(|| {
|
||||
start_tcp_command_server();
|
||||
});
|
||||
|
||||
println!("listening to changes over /host_ssh/auth.log");
|
||||
|
||||
Reference in new issue
Block a user