Merge pull request #5498 from 21pages/audit

alarm audit more info
This commit is contained in:
RustDesk 2023-08-24 20:04:50 +08:00 committed by GitHub
commit 2f6711dd2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1455,17 +1455,21 @@ impl Connection {
self.send_login_error("Too many wrong password attempts") self.send_login_error("Too many wrong password attempts")
.await; .await;
Self::post_alarm_audit( Self::post_alarm_audit(
AlarmAuditType::ManyWrongPassword, AlarmAuditType::ExceedThirtyAttempts,
json!({ json!({
"ip":self.ip, "ip":self.ip,
"id":lr.my_id.clone(),
"name": lr.my_name.clone(),
}), }),
); );
} else if time == failure.0 && failure.1 > 6 { } else if time == failure.0 && failure.1 > 6 {
self.send_login_error("Please try 1 minute later").await; self.send_login_error("Please try 1 minute later").await;
Self::post_alarm_audit( Self::post_alarm_audit(
AlarmAuditType::FrequentAttempt, AlarmAuditType::SixAttemptsWithinOneMinute,
json!({ json!({
"ip":self.ip, "ip":self.ip,
"id":lr.my_id.clone(),
"name": lr.my_name.clone(),
}), }),
); );
} else if !self.validate_password() { } else if !self.validate_password() {
@ -2531,8 +2535,8 @@ mod privacy_mode {
pub enum AlarmAuditType { pub enum AlarmAuditType {
IpWhitelist = 0, IpWhitelist = 0,
ManyWrongPassword = 1, ExceedThirtyAttempts = 1,
FrequentAttempt = 2, SixAttemptsWithinOneMinute = 2,
} }
pub enum FileAuditType { pub enum FileAuditType {