1、修改策略模板的isFullFlow和isProtectObjectIPSrc为isProtectObjectDst和isProtectObjectSrc。并做其他相应修改

2、动态规则分页查询增加返回策略模板名称
This commit is contained in:
PushM
2024-05-22 10:10:32 +08:00
parent 1fd4612699
commit 1f12acecef
10 changed files with 68 additions and 29 deletions

View File

@@ -32,6 +32,10 @@ public class AlertMessageService {
public void processAlertMessage(AlertMessage alertMessage) {
//根据告警信息——>生成指令
List<TaskCommandInfo> dynamicTaskCommandInfoList = generateDynamicCommand(alertMessage);
//可能isProtectSrcOrDst和isProtectSrcOrDst都为FALSE说明没有生成指令
if(dynamicTaskCommandInfoList == null || dynamicTaskCommandInfoList.isEmpty()){
return;
}
//获取任务状态设置指令的isValid字段且是否生成指令入库除了RUNING\PAUSED状态其他都不入command库
Integer taskStatus = dynamicTaskCommandInfoList.get(0).getTaskStatus();
//获取任务类型设置指令的isJudged字段。
@@ -87,7 +91,9 @@ public class AlertMessageService {
//根据策略模板的is_full_flow字段如果是双向流量会生成两个fiveTuple所以返回List
List<FiveTupleWithMask> fiveTupleWithMaskNew = updateFiveTupleWithMask(alertMessage.getFiveTupleWithMask(),
alertMessage.getProtectIsSrcOrDst(), templateProtectLevel);
if(fiveTupleWithMaskNew.isEmpty()){
return null;
}
//根据fiveTuple生成动态指令信息
List<TaskCommandInfo> dynamicCommandInfoList = new ArrayList<>();
if (fiveTupleWithMaskNew.size() == 2){
@@ -235,7 +241,7 @@ public class AlertMessageService {
command2.setProtocol(fiveTupleWithMask.getProtocol());
command2.setProtocol(fiveTupleWithMask.getMaskProtocol());
}
/*
//若需要处置全方向流量,防护对象为源和目的的五元组都生成指令下发
if(templateProtectLevel.getIsFullFlow()){
newFiveTupleWithMask.add(command1);
@@ -249,6 +255,18 @@ public class AlertMessageService {
newFiveTupleWithMask.add(command1);
}
}
*/
//若需要处置全方向流量,防护对象为源和目的的五元组都生成指令下发
// 判断防护对象为源还是目的,生成指令
if(templateProtectLevel.getIsProtectObjectIPSrc()){
newFiveTupleWithMask.add(command2);
}
if (templateProtectLevel.getIsProtectObjectDst()){
newFiveTupleWithMask.add(command1);
}
//目前告警信息还只是五元组没有url、dns
return newFiveTupleWithMask;