1、修复策略模板不生成双向流指令

This commit is contained in:
PushM
2024-06-07 05:34:40 +08:00
parent 465c1d1496
commit c57bdf6103
2 changed files with 9 additions and 9 deletions

View File

@@ -240,8 +240,8 @@ public class AlertMessageService {
command1.setDestinationPort(protectObject.getPort()); command1.setDestinationPort(protectObject.getPort());
command1.setMaskDestinationPort(protectObject.getMaskPort()); command1.setMaskDestinationPort(protectObject.getMaskPort());
if (templateProtectLevel.getHasProtocol()){ if (templateProtectLevel.getHasProtocol()){
command1.setProtocol(fiveTupleWithMask.getProtocol()); command1.setProtocolNum(Integer.valueOf(fiveTupleWithMask.getProtocol()));
command1.setProtocol(fiveTupleWithMask.getMaskProtocol()); command1.setMaskProtocol(fiveTupleWithMask.getMaskProtocol());
} }
// newFiveTupleWithMask.add(command1); // newFiveTupleWithMask.add(command1);
//生成指令command2防护对象为源的五元组 //生成指令command2防护对象为源的五元组
@@ -258,7 +258,7 @@ public class AlertMessageService {
command2.setMaskDestinationPort(peer.getMaskPort()); command2.setMaskDestinationPort(peer.getMaskPort());
if (templateProtectLevel.getHasProtocol()){ if (templateProtectLevel.getHasProtocol()){
command2.setProtocol(fiveTupleWithMask.getProtocol()); command2.setProtocol(fiveTupleWithMask.getProtocol());
command2.setProtocol(fiveTupleWithMask.getMaskProtocol()); command2.setMaskProtocol(fiveTupleWithMask.getMaskProtocol());
} }
/* /*
//若需要处置全方向流量,防护对象为源和目的的五元组都生成指令下发 //若需要处置全方向流量,防护对象为源和目的的五元组都生成指令下发
@@ -279,7 +279,7 @@ public class AlertMessageService {
//若需要处置全方向流量,防护对象为源和目的的五元组都生成指令下发 //若需要处置全方向流量,防护对象为源和目的的五元组都生成指令下发
// 判断防护对象为源还是目的,生成指令 // 判断防护对象为源还是目的,生成指令
if(templateProtectLevel.getIsProtectObjectIPSrc()){ if(templateProtectLevel.getIsProtectObjectSrc()){
newFiveTupleWithMask.add(command2); newFiveTupleWithMask.add(command2);
} }
if (templateProtectLevel.getIsProtectObjectDst()){ if (templateProtectLevel.getIsProtectObjectDst()){

View File

@@ -49,7 +49,7 @@ public class AlertMessageTest {
@DSTransactional @DSTransactional
void testReceiveAlertMessage() throws DorisStartException { void testReceiveAlertMessage() throws DorisStartException {
for(int n = 10;n < 20;n++) { for(int n = 10;n < 11;n++) {
List<ProtectObject> protectObject = protectObjectService.queryProtectObjects( List<ProtectObject> protectObject = protectObjectService.queryProtectObjects(
@@ -57,7 +57,7 @@ public class AlertMessageTest {
null, null, null, null, null, null, null, null,
null, null, 1, 1); null, null, 1, 1);
List<TemplateNew> templates = templateService.queryTemplates( List<TemplateNew> templates = templateService.queryTemplates(
null, null, null, null, null, null, null, 1, 1); "洪泛型DDoS-日常态", null, null, null, null, null, null, 1, 1);
DynamicRuleObject object = new DynamicRuleObject(); DynamicRuleObject object = new DynamicRuleObject();
object.setDynamicRuleName("测试display_id"+n); object.setDynamicRuleName("测试display_id"+n);
@@ -82,7 +82,7 @@ public class AlertMessageTest {
task.setTaskCreateUserId(1100664); task.setTaskCreateUserId(1100664);
task.setTaskCreateUsername("NSADD管理员"); task.setTaskCreateUsername("NSADD管理员");
task.setTaskCreateDepart("组织树"); task.setTaskCreateDepart("组织树");
task.setTaskRange("1007"); task.setTaskRange("1009");
task.setDynamicRuleIds(List.of(new Integer[]{dynamicRuleId})); task.setDynamicRuleIds(List.of(new Integer[]{dynamicRuleId}));
task.setProtectObjectIds(List.of(new Integer[]{protectObject.get(0).getProtectObjectId()})); task.setProtectObjectIds(List.of(new Integer[]{protectObject.get(0).getProtectObjectId()}));
task.setTemplateId(templates.get(0).getTemplateId()); task.setTemplateId(templates.get(0).getTemplateId());
@@ -100,8 +100,8 @@ public class AlertMessageTest {
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
AlertMessage alert = new AlertMessage(); AlertMessage alert = new AlertMessage();
FiveTupleWithMask fiveTupleWithMask = new FiveTupleWithMask(); FiveTupleWithMask fiveTupleWithMask = new FiveTupleWithMask();
fiveTupleWithMask.setSourceIP(n+".1.1." + i); fiveTupleWithMask.setSourceIP(n+".5.1." + i);
fiveTupleWithMask.setDestinationIP(n+".22.2." + i); fiveTupleWithMask.setDestinationIP(n+".24.2." + i);
fiveTupleWithMask.setSourcePort("111"); fiveTupleWithMask.setSourcePort("111");
fiveTupleWithMask.setDestinationPort("80"); fiveTupleWithMask.setDestinationPort("80");
fiveTupleWithMask.setProtocol("6"); fiveTupleWithMask.setProtocol("6");