Skip to content

Commit 25c1420

Browse files
committed
improve reason message for blacklisted IPs
1 parent baf36f1 commit 25c1420

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/firewall/firewall.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use rpn_predicate_interpreter::PredicateEvaluator;
22
use serde::{Deserialize, Serialize};
33

4+
use crate::constants::BLACKLIST_LINK;
45
use crate::firewall::infix_firewall::InfixFirewall;
56
use crate::firewall::rules::{FirewallExpression, FirewallRule};
67
use crate::proto::appguard_commands::FirewallPolicy;
@@ -47,7 +48,14 @@ impl Firewall {
4748
) -> FirewallResult {
4849
// first let's check if this is blacklisted
4950
if item.is_blacklisted() {
50-
return FirewallResult::new(FirewallPolicy::Deny, vec!["IP is blacklisted".to_string()]);
51+
return FirewallResult::new(
52+
FirewallPolicy::Deny,
53+
vec![format!(
54+
"IP {} is blacklisted by {}",
55+
item.get_remote_ip(),
56+
BLACKLIST_LINK.as_str()
57+
)],
58+
);
5159
}
5260
// if not blacklisted, check the firewall expressions one by one
5361
for expr in &self.expressions {

0 commit comments

Comments
 (0)