0

我写了一条规则,用“密码失败”来警告 ssh 事件。这条规则在这里:

rule "Hello World"
  when
    accumulate(m:Message(eventType=="Failed password") over window:time( 59s );s:count(m);s>3)
  then
     System.out.println( "success" );
     Alert alert=new Alert("ssh","test");
     insert(alert);
end

这适用于第一种情况。但我想扩展这条​​规则。我想为具有相同 Src_ip 地址的“密码失败”累积 ssh 事件。例如,如果我在 59 秒内从三个不同的 src_ip 有 4 个失败的密码 ssh 事件,则规则不匹配,但是当我在 59 秒内从一个 src_ip 有 4 个失败的密码 ssh 事件时,规则匹配。我应该如何为这种情况重写这个规则。

4

1 回答 1

0

您需要一条消息来选择某个 IP 地址;然后你可以积累其他具有相同价值的人。

rule "Four or more"
when
   $ml: Message( eventType == "Failed password", $ip: src_ip )
   not Message( eventType == "Failed password", src_ip == $ip, this after $ml )
   accumulate( Message(eventType == "Failed password", src_ip == $ip )
        over window:time( 59s ); s:count(1); s > 3 )
then
   System.out.println( "success" );
   Alert alert=new Alert("ssh","test");
   insert(alert);
 end
于 2016-01-12T13:16:21.110 回答