From 88d0460e3c775a4c07b0c2f60e5b8e52ca1af988 Mon Sep 17 00:00:00 2001 From: 21pages Date: Thu, 24 Aug 2023 10:04:34 +0800 Subject: [PATCH] alarm audit more info Signed-off-by: 21pages --- src/server/connection.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/server/connection.rs b/src/server/connection.rs index e982e6a93..4ab62cce3 100644 --- a/src/server/connection.rs +++ b/src/server/connection.rs @@ -1455,17 +1455,21 @@ impl Connection { self.send_login_error("Too many wrong password attempts") .await; Self::post_alarm_audit( - AlarmAuditType::ManyWrongPassword, + AlarmAuditType::ExceedThirtyAttempts, json!({ "ip":self.ip, + "id":lr.my_id.clone(), + "name": lr.my_name.clone(), }), ); } else if time == failure.0 && failure.1 > 6 { self.send_login_error("Please try 1 minute later").await; Self::post_alarm_audit( - AlarmAuditType::FrequentAttempt, + AlarmAuditType::SixAttemptsWithinOneMinute, json!({ "ip":self.ip, + "id":lr.my_id.clone(), + "name": lr.my_name.clone(), }), ); } else if !self.validate_password() { @@ -2504,8 +2508,8 @@ mod privacy_mode { pub enum AlarmAuditType { IpWhitelist = 0, - ManyWrongPassword = 1, - FrequentAttempt = 2, + ExceedThirtyAttempts = 1, + SixAttemptsWithinOneMinute = 2, } pub enum FileAuditType {