mirror of
https://github.com/stalwartlabs/mail-server.git
synced 2025-12-11 22:06:31 +08:00
HTTP: Skip scanner fail2ban checks when the proxy client IP can't be parsed
This commit is contained in:
parent
cd2b958001
commit
6c70872b4d
1 changed files with 19 additions and 20 deletions
|
|
@ -814,26 +814,25 @@ async fn handle_session<T: SessionStream>(inner: Arc<Inner>, session: SessionDat
|
|||
.await
|
||||
{
|
||||
if http_err.is_parse() {
|
||||
match inner
|
||||
.build_server()
|
||||
.is_scanner_fail2banned(session.remote_ip)
|
||||
.await
|
||||
{
|
||||
Ok(true) => {
|
||||
trc::event!(
|
||||
Security(SecurityEvent::ScanBan),
|
||||
SpanId = session.session_id,
|
||||
RemoteIp = session.remote_ip,
|
||||
Reason = http_err.to_string(),
|
||||
);
|
||||
return;
|
||||
}
|
||||
Ok(false) => {}
|
||||
Err(err) => {
|
||||
trc::error!(
|
||||
err.span_id(session.session_id)
|
||||
.details("Failed to check for fail2ban")
|
||||
);
|
||||
let server = inner.build_server();
|
||||
if !server.core.jmap.http_use_forwarded {
|
||||
match server.is_scanner_fail2banned(session.remote_ip).await {
|
||||
Ok(true) => {
|
||||
trc::event!(
|
||||
Security(SecurityEvent::ScanBan),
|
||||
SpanId = session.session_id,
|
||||
RemoteIp = session.remote_ip,
|
||||
Reason = http_err.to_string(),
|
||||
);
|
||||
return;
|
||||
}
|
||||
Ok(false) => {}
|
||||
Err(err) => {
|
||||
trc::error!(
|
||||
err.span_id(session.session_id)
|
||||
.details("Failed to check for fail2ban")
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue