Merge remote-tracking branch 'origin/haskafka' into haskafka
# Conflicts: # src/main/java/com/realtime/protection/server/task/TaskMapper.java # src/main/java/com/realtime/protection/server/task/TaskService.java # src/main/resources/mappers/TaskMapper.xml
This commit is contained in:
@@ -30,7 +30,7 @@ dependencies {
|
||||
implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:3.0.3'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-actuator'
|
||||
implementation 'org.springframework.kafka:spring-kafka'
|
||||
|
||||
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
|
||||
|
||||
compileOnly 'org.projectlombok:lombok'
|
||||
annotationProcessor 'org.projectlombok:lombok'
|
||||
|
||||
@@ -12,6 +12,8 @@ COPY realtime_protection realtime_protection
|
||||
# KAFKA_SERVERS="10.58.72.125:9092,10.58.72.126:9092,10.58.72.127:9092,10.58.72.128:9092,10.58.72.129:9092,\
|
||||
# 10.58.72.130:9092,10.58.72.131:9092,10.58.72.132:9092,10.58.72.133:9092,10.58.72.134:9092"
|
||||
|
||||
# DORIS_URL="10.58.72.135:9030" \
|
||||
# REDIS_URL="10.58.72.140"
|
||||
|
||||
ENV MYSQL_USERNAME="root" \
|
||||
MYSQL_PASSWD="aiihhbfcsy123!@#" \
|
||||
@@ -20,8 +22,7 @@ ENV MYSQL_USERNAME="root" \
|
||||
DORIS_PASSWD="" \
|
||||
DORIS_URL="10.26.22.133:9030"\
|
||||
KAFKA_SERVERS="172.29.128.1:9092"
|
||||
|
||||
|
||||
REDIS_URL="192.168.107.89"
|
||||
|
||||
EXPOSE 8081
|
||||
|
||||
|
||||
@@ -17,6 +17,11 @@ public class ProtectObject {
|
||||
@Schema(description = "防护对象ID", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
private Integer protectObjectId;
|
||||
|
||||
@JsonProperty("proobj_display_id")
|
||||
@ExcelProperty("ID")
|
||||
@Schema(description = "防护对象显示ID", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
private String protectObjectDisplayId;
|
||||
|
||||
@JsonProperty("proobj_name")
|
||||
@NotNull(message = "proobj_name字段不能为空。")
|
||||
@ExcelProperty("名称")
|
||||
|
||||
@@ -22,6 +22,10 @@ public class DynamicRuleObject {
|
||||
@Schema(description = "动态规则ID", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
private Integer dynamicRuleId;
|
||||
|
||||
@JsonProperty("dynamic_rule_display_id")
|
||||
@Schema(description = "动态规则显示ID", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
private String dynamicRuleDisplayId;
|
||||
|
||||
@NotNull
|
||||
@JsonProperty("dynamic_rule_name")
|
||||
@Schema(description = "动态规则名称", example = "动态规则测试", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@@ -38,8 +42,6 @@ public class DynamicRuleObject {
|
||||
@Schema(description = "动态规则创建用户名称", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
private String dynamicRuleCreateUsername;
|
||||
|
||||
// @JsonProperty("dynamic_rule_audit_status")
|
||||
// private Integer dynamicRuleAuditStatus;
|
||||
@JsonProperty("dynamic_rule_create_depart")
|
||||
@Schema(description = "动态规则创建用户所属部门", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
private String dynamicRuleCreateDepart;
|
||||
@@ -99,7 +101,6 @@ public class DynamicRuleObject {
|
||||
@Schema(description = "筛选条件-日志规则id", example = "1", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long logRuleId;
|
||||
|
||||
|
||||
@JsonProperty("dynamic_rule_audit_status")
|
||||
@ExcelIgnore
|
||||
@Schema(description = "动态规则审核状态(0为未审核,1为已退回,2为审核通过)", example = "2", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
|
||||
@@ -28,6 +28,11 @@ public class StaticRuleObject {
|
||||
@Schema(description = "静态规则ID", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
private Integer staticRuleId;
|
||||
|
||||
@JsonProperty("static_rule_display_id")
|
||||
@ExcelProperty("ID")
|
||||
@Schema(description = "静态规则显示ID", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
private String staticRuleDisplayId;
|
||||
|
||||
@NotNull
|
||||
@JsonProperty("static_rule_name")
|
||||
@ExcelProperty("名称")
|
||||
|
||||
@@ -16,6 +16,10 @@ public class Task {
|
||||
@Schema(description = "任务ID", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
private Long taskId;
|
||||
|
||||
@JsonProperty("task_display_id")
|
||||
@Schema(description = "任务显示ID", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
private String taskDisplayId;
|
||||
|
||||
@JsonProperty("task_name")
|
||||
@NotNull(message = "task_name字段不能为空。")
|
||||
@Schema(description = "任务名称", example = "静态任务")
|
||||
|
||||
@@ -17,6 +17,10 @@ public class TaskCommandInfo {
|
||||
@JsonProperty("task_id")
|
||||
private Long taskId;
|
||||
|
||||
@Schema(description = "任务显示ID", accessMode = Schema.AccessMode.READ_ONLY)
|
||||
@JsonProperty("task_display_id")
|
||||
private String taskDisplayId;
|
||||
|
||||
@Schema(description = "规则ID", hidden = true)
|
||||
@JsonProperty("rule_id")
|
||||
private Long ruleId;
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.realtime.protection.configuration.utils;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.redis.core.BoundValueOperations;
|
||||
import org.springframework.data.redis.core.Cursor;
|
||||
import org.springframework.data.redis.core.ScanOptions;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class Counter {
|
||||
private final StringRedisTemplate stringRedisTemplate;
|
||||
|
||||
public Counter(StringRedisTemplate stringRedisTemplate) {
|
||||
this.stringRedisTemplate = stringRedisTemplate;
|
||||
}
|
||||
|
||||
public Long generateId(String typeName) {
|
||||
String key = String.format("counter::%s", typeName.toLowerCase());
|
||||
BoundValueOperations<String, String> op = stringRedisTemplate.boundValueOps(key);
|
||||
return op.increment();
|
||||
}
|
||||
|
||||
@Scheduled(cron = "0 0 0 * * ?")
|
||||
public void resetId() {
|
||||
Cursor<String> cursor = stringRedisTemplate.scan(ScanOptions.scanOptions().build());
|
||||
while (cursor.hasNext()) {
|
||||
String key = cursor.next();
|
||||
if (key.startsWith("counter::")) {
|
||||
stringRedisTemplate.delete(key);
|
||||
log.debug("删除计时器key: {}", key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,12 +3,15 @@ package com.realtime.protection.server.defense.object;
|
||||
import com.alibaba.excel.util.ListUtils;
|
||||
import com.realtime.protection.configuration.entity.defense.object.ProtectObject;
|
||||
import com.realtime.protection.configuration.response.ResponseResult;
|
||||
import com.realtime.protection.configuration.utils.Counter;
|
||||
import com.realtime.protection.configuration.utils.SqlSessionWrapper;
|
||||
import com.realtime.protection.configuration.utils.enums.audit.AuditStatusEnum;
|
||||
import com.realtime.protection.configuration.utils.enums.audit.AuditStatusValidator;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -19,13 +22,22 @@ public class ProtectObjectService {
|
||||
private final ProtectObjectMapper protectObjectMapper;
|
||||
private final SqlSessionWrapper sqlSessionWrapper;
|
||||
private static final Integer batchSize = 100;
|
||||
private final Counter counter;
|
||||
|
||||
public ProtectObjectService(ProtectObjectMapper protectObjectMapper, SqlSessionWrapper sqlSessionWrapper) {
|
||||
public ProtectObjectService(ProtectObjectMapper protectObjectMapper, SqlSessionWrapper sqlSessionWrapper, Counter counter) {
|
||||
this.protectObjectMapper = protectObjectMapper;
|
||||
this.sqlSessionWrapper = sqlSessionWrapper;
|
||||
this.counter = counter;
|
||||
}
|
||||
|
||||
public Integer newProtectObject(ProtectObject protectObject) {
|
||||
protectObject.setProtectObjectDisplayId(
|
||||
"FHDX-"
|
||||
+ LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"))
|
||||
+ "-"
|
||||
+ String.format("%06d", counter.generateId("protect_object"))
|
||||
);
|
||||
|
||||
protectObjectMapper.newProtectObject(protectObject);
|
||||
|
||||
if (protectObject.getProtectObjectId() == null) {
|
||||
@@ -42,6 +54,13 @@ public class ProtectObjectService {
|
||||
|
||||
List<ProtectObject> protectObjectBatch = ListUtils.newArrayListWithExpectedSize(batchSize);
|
||||
for (ProtectObject protectObject : list) {
|
||||
protectObject.setProtectObjectDisplayId(
|
||||
"FHDX-"
|
||||
+ LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"))
|
||||
+ "-"
|
||||
+ String.format("%06d", counter.generateId("protect_object"))
|
||||
);
|
||||
|
||||
protectObjectBatch.add(protectObject);
|
||||
if (protectObjectBatch.size() < batchSize) {
|
||||
continue;
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.realtime.protection.server.rule.dynamicrule;
|
||||
import com.alibaba.excel.util.ListUtils;
|
||||
import com.realtime.protection.configuration.entity.defense.template.Template;
|
||||
import com.realtime.protection.configuration.entity.rule.dynamicrule.DynamicRuleObject;
|
||||
import com.realtime.protection.configuration.utils.Counter;
|
||||
import com.realtime.protection.configuration.utils.SqlSessionWrapper;
|
||||
import com.realtime.protection.configuration.utils.enums.StateEnum;
|
||||
import com.realtime.protection.configuration.utils.enums.audit.AuditStatusValidator;
|
||||
@@ -10,6 +11,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -20,11 +22,12 @@ import java.util.function.Function;
|
||||
public class DynamicRuleService {
|
||||
private final DynamicRuleMapper dynamicRuleMapper;
|
||||
private final SqlSessionWrapper sqlSessionWrapper;
|
||||
private final Counter counter;
|
||||
|
||||
public DynamicRuleService(DynamicRuleMapper dynamicRuleMapper, SqlSessionWrapper sqlSessionWrapper) {
|
||||
|
||||
public DynamicRuleService(DynamicRuleMapper dynamicRuleMapper, SqlSessionWrapper sqlSessionWrapper, Counter counter) {
|
||||
this.sqlSessionWrapper = sqlSessionWrapper;
|
||||
this.dynamicRuleMapper = dynamicRuleMapper;
|
||||
this.counter = counter;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@@ -37,6 +40,13 @@ public class DynamicRuleService {
|
||||
throw new IllegalArgumentException("protect object id is invalid");
|
||||
}
|
||||
|
||||
dynamicRule.setDynamicRuleDisplayId(
|
||||
"DTGZ-"
|
||||
+ LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"))
|
||||
+ "-"
|
||||
+ String.format("%06d", counter.generateId("dynamic_rule"))
|
||||
);
|
||||
|
||||
dynamicRuleMapper.newDynamicRule(dynamicRule);
|
||||
Integer dynamicRuleId = dynamicRule.getDynamicRuleId();
|
||||
dynamicRule.getProtectObjectIds().forEach(
|
||||
@@ -56,6 +66,12 @@ public class DynamicRuleService {
|
||||
List<DynamicRuleObject> DynamicRuleIdBatch = ListUtils.newArrayListWithExpectedSize(100);
|
||||
for (DynamicRuleObject dynamicRule : DynamicRuleList) {
|
||||
dynamicRule.setDynamicRuleCreateTime(LocalDateTime.now());
|
||||
dynamicRule.setDynamicRuleDisplayId(
|
||||
"DTGZ-"
|
||||
+ LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"))
|
||||
+ "-"
|
||||
+ String.format("%06d", counter.generateId("dynamic_rule"))
|
||||
);
|
||||
DynamicRuleIdBatch.add(dynamicRule);
|
||||
if (DynamicRuleIdBatch.size() < 100) {
|
||||
continue;
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.realtime.protection.server.rule.staticrule;
|
||||
import com.alibaba.excel.util.ListUtils;
|
||||
import com.realtime.protection.configuration.entity.rule.staticrule.StaticRuleObject;
|
||||
import com.realtime.protection.configuration.entity.whitelist.WhiteListObject;
|
||||
import com.realtime.protection.configuration.utils.Counter;
|
||||
import com.realtime.protection.configuration.utils.SqlSessionWrapper;
|
||||
import com.realtime.protection.configuration.utils.enums.RuleEnum;
|
||||
import com.realtime.protection.configuration.utils.enums.audit.AuditStatusEnum;
|
||||
@@ -30,12 +31,14 @@ public class StaticRuleService {
|
||||
private final StaticRuleMapper staticRuleMapper;
|
||||
private final SqlSessionWrapper sqlSessionWrapper;
|
||||
private final WhiteListService whiteListService;
|
||||
private final Counter counter;
|
||||
|
||||
public StaticRuleService(StaticRuleMapper staticRuleMapper, SqlSessionWrapper sqlSessionWrapper, WhiteListService whiteListService) {
|
||||
|
||||
public StaticRuleService(StaticRuleMapper staticRuleMapper, SqlSessionWrapper sqlSessionWrapper, WhiteListService whiteListService, Counter counter) {
|
||||
this.staticRuleMapper = staticRuleMapper;
|
||||
this.sqlSessionWrapper = sqlSessionWrapper;
|
||||
this.whiteListService = whiteListService;
|
||||
this.counter = counter;
|
||||
}
|
||||
|
||||
private static int ipToInt(String ip) {
|
||||
@@ -86,6 +89,14 @@ public class StaticRuleService {
|
||||
whiteListsHit.forEach(item -> result.append(item.getWhiteListName()).append(" "));
|
||||
throw new IllegalArgumentException("静态规则与白名单规则冲突,冲突白名单名称:"+result.toString().trim());
|
||||
}
|
||||
|
||||
object.setStaticRuleDisplayId(
|
||||
"JTGZ-"
|
||||
+ LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"))
|
||||
+ "-"
|
||||
+ String.format("%06d", counter.generateId("static_rule"))
|
||||
);
|
||||
|
||||
staticRuleMapper.newStaticRuleObject(object);
|
||||
|
||||
return object.getStaticRuleId();
|
||||
@@ -186,6 +197,12 @@ public class StaticRuleService {
|
||||
List<StaticRuleObject> StaticRuleBatch = ListUtils.newArrayListWithExpectedSize(100);
|
||||
for (StaticRuleObject staticRule : list) {
|
||||
staticRule.setStaticRuleCreateTime(LocalDateTime.now());
|
||||
staticRule.setStaticRuleDisplayId(
|
||||
"JTGZ-"
|
||||
+ LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"))
|
||||
+ "-"
|
||||
+ String.format("%06d", counter.generateId("static_rule"))
|
||||
);
|
||||
StaticRuleBatch.add(staticRule);
|
||||
if (StaticRuleBatch.size() < 100) {
|
||||
continue;
|
||||
|
||||
@@ -7,6 +7,8 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -65,7 +67,8 @@ public interface TaskMapper {
|
||||
@Param("task_name") String taskName, @Param("task_creator") String taskCreator,
|
||||
@Param("audit_status") Integer auditStatus,
|
||||
@Param("task_act")String taskAct, @Param("task_auditor")String taskAuditor,
|
||||
@Param("task_source")String taskSource, @Param("rule_name")String ruleName);
|
||||
@Param("task_source")String taskSource, @Param("rule_name")String ruleName,
|
||||
@Param("task_create_time") LocalDateTime taskCreateTime);
|
||||
|
||||
void updateAuditStatusByIdBatch(@Param("idWithAuditStatusBatch") Map<Integer, Integer> idWithAuditStatusBatch);
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.realtime.protection.configuration.entity.rule.staticrule.StaticRuleOb
|
||||
import com.realtime.protection.configuration.entity.task.DynamicTaskInfo;
|
||||
import com.realtime.protection.configuration.entity.task.Task;
|
||||
import com.realtime.protection.configuration.entity.task.TaskCommandInfo;
|
||||
import com.realtime.protection.configuration.utils.Counter;
|
||||
import com.realtime.protection.configuration.utils.SqlSessionWrapper;
|
||||
import com.realtime.protection.configuration.utils.enums.StateEnum;
|
||||
import com.realtime.protection.configuration.utils.enums.audit.AuditStatusEnum;
|
||||
@@ -14,9 +15,18 @@ import com.realtime.protection.configuration.utils.enums.audit.AuditStatusValida
|
||||
import com.realtime.protection.server.rule.dynamicrule.DynamicRuleMapper;
|
||||
import com.realtime.protection.server.rule.staticrule.StaticRuleMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.annotation.Isolation;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -30,20 +40,29 @@ public class TaskService {
|
||||
private final SqlSessionWrapper sqlSessionWrapper;
|
||||
private static final int BATCH_SIZE = 100;
|
||||
private final DynamicRuleMapper dynamicRuleMapper;
|
||||
private final Counter counter;
|
||||
|
||||
public TaskService(TaskMapper taskMapper, StaticRuleMapper staticRuleMapper, SqlSessionWrapper sqlSessionWrapper, DynamicRuleMapper dynamicRuleMapper) {
|
||||
public TaskService(TaskMapper taskMapper, StaticRuleMapper staticRuleMapper, SqlSessionWrapper sqlSessionWrapper, DynamicRuleMapper dynamicRuleMapper, Counter counter) {
|
||||
this.taskMapper = taskMapper;
|
||||
this.staticRuleMapper = staticRuleMapper;
|
||||
this.sqlSessionWrapper = sqlSessionWrapper;
|
||||
this.dynamicRuleMapper = dynamicRuleMapper;
|
||||
this.counter = counter;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Long newTask(Task task) {
|
||||
// todo: 目前获取方式还不确定,以后再确定
|
||||
task.setTaskCreateUserId(1);
|
||||
task.setTaskCreateUsername("xxx");
|
||||
task.setTaskCreateDepart("xxx");
|
||||
|
||||
task.setTaskDisplayId(
|
||||
"RW-"
|
||||
+ LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"))
|
||||
+ "-"
|
||||
+ String.format("%06d", counter.generateId("task")));
|
||||
|
||||
taskMapper.newTask(task);
|
||||
|
||||
if (task.getStaticRuleIds() != null && !task.getStaticRuleIds().isEmpty()) {
|
||||
|
||||
@@ -135,7 +135,7 @@ public class StateHandler {
|
||||
|
||||
SimpleResponse response = mono.block(Duration.ofSeconds(5));
|
||||
|
||||
if (response == null || response.getSuccess() == null) {
|
||||
if (response == null || response.getCode() != 200 || response.getSuccess() == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,18 @@ spring:
|
||||
grace-destroy: true
|
||||
jackson:
|
||||
default-property-inclusion: non_null
|
||||
data:
|
||||
redis:
|
||||
host: 192.168.107.89
|
||||
port: 6379
|
||||
database: 1
|
||||
jedis:
|
||||
pool:
|
||||
enabled: true
|
||||
max-active: 10
|
||||
max-idle: 5
|
||||
min-idle: 1
|
||||
connect-timeout: 1000
|
||||
|
||||
|
||||
mybatis:
|
||||
|
||||
@@ -108,6 +108,18 @@ spring:
|
||||
# # 两次poll之间的最大间隔,默认值为5分钟。如果超过这个间隔会触发reBalance
|
||||
# poll-timeout: 600000
|
||||
|
||||
data:
|
||||
redis:
|
||||
host: ${REDIS_URL}
|
||||
port: 6379
|
||||
database: 1
|
||||
jedis:
|
||||
pool:
|
||||
enabled: true
|
||||
max-active: 10
|
||||
max-idle: 5
|
||||
min-idle: 1
|
||||
connect-timeout: 1000
|
||||
|
||||
mybatis:
|
||||
mapper-locations: classpath:mappers/*
|
||||
|
||||
@@ -15,16 +15,15 @@ spring:
|
||||
datasource:
|
||||
mysql:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
username: ${MYSQL_USERNAME:root}
|
||||
password: ${MYSQL_PASSWD}
|
||||
url: jdbc:mysql://${MYSQL_URL:localhost:3306}/realtime_protection?serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
password: aiihhbfcsy123!@#
|
||||
url: jdbc:mysql://192.168.107.89:3306/realtime_protection?serverTimezone=Asia/Shanghai
|
||||
hikari:
|
||||
is-auto-commit: false
|
||||
doris:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
username: ${DORIS_USERNAME:root}
|
||||
password: ${DORIS_PASSWD}
|
||||
url: jdbc:mysql://${DORIS_URL:localhost:9030}/command
|
||||
username: root
|
||||
url: jdbc:mysql://10.26.22.133:9030/command
|
||||
hikari:
|
||||
is-auto-commit: false
|
||||
aop:
|
||||
@@ -108,6 +107,18 @@ spring:
|
||||
# # 两次poll之间的最大间隔,默认值为5分钟。如果超过这个间隔会触发reBalance
|
||||
# poll-timeout: 600000
|
||||
|
||||
data:
|
||||
redis:
|
||||
host: 192.168.107.89
|
||||
port: 6379
|
||||
database: 1
|
||||
jedis:
|
||||
pool:
|
||||
enabled: true
|
||||
max-active: 10
|
||||
max-idle: 5
|
||||
min-idle: 1
|
||||
connect-timeout: 1000
|
||||
|
||||
mybatis:
|
||||
mapper-locations: classpath:mappers/*
|
||||
@@ -122,9 +133,9 @@ task:
|
||||
springdoc:
|
||||
api-docs:
|
||||
enabled: true
|
||||
path: /v3/api-docs
|
||||
path: /api-docs
|
||||
swagger-ui:
|
||||
path: /swagger-ui.html
|
||||
path: /swagger
|
||||
packages-to-scan: com.realtime.protection.server
|
||||
|
||||
management:
|
||||
|
||||
@@ -13,14 +13,14 @@
|
||||
create_time, modify_time, dynamic_rule_create_username,
|
||||
dynamic_rule_create_depart, template_id, dynamic_rule_protect_level,
|
||||
dynamic_rule_priority,
|
||||
dynamic_rule_frequency, dynamic_rule_create_user_id, log_rule_id)
|
||||
dynamic_rule_frequency, dynamic_rule_create_user_id, log_rule_id, dynamic_rule_display_id)
|
||||
values (#{object.dynamicRuleName},
|
||||
NOW(), #{object.dynamicRuleModifyTime},
|
||||
#{object.dynamicRuleCreateUsername}, #{object.dynamicRuleCreateDepart},
|
||||
#{object.templateId}, #{object.dynamicRuleProtectLevel},
|
||||
#{object.dynamicRulePriority},
|
||||
#{object.dynamicRuleFrequency},
|
||||
#{object.dynamicRuleCreateUserId}, #{object.logRuleId})
|
||||
#{object.dynamicRuleCreateUserId}, #{object.logRuleId}, #{object.dynamicRuleDisplayId})
|
||||
|
||||
</insert>
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
create_time, modify_time, dynamic_rule_create_username,
|
||||
dynamic_rule_create_depart, template_id, dynamic_rule_protect_level,
|
||||
dynamic_rule_priority,
|
||||
dynamic_rule_frequency, dynamic_rule_create_user_id, log_rule_id
|
||||
dynamic_rule_frequency, dynamic_rule_create_user_id, log_rule_id, dynamic_rule_display_id
|
||||
)
|
||||
values
|
||||
<foreach collection="dynamicRuleObjects" item="object" separator=",">
|
||||
@@ -43,9 +43,9 @@
|
||||
NOW(),#{object.dynamicRuleModifyTime},
|
||||
#{object.dynamicRuleCreateUsername},#{object.dynamicRuleCreateDepart},
|
||||
#{object.templateId}, #{object.dynamicRuleProtectLevel},
|
||||
#{object.dynamicRulePriority},
|
||||
#{object.dynamicRulePriority}, #{object.dynamicRuleRange},
|
||||
#{object.dynamicRuleFrequency},
|
||||
#{object.dynamicRuleCreateUserId}, #{object.logRuleId})
|
||||
#{object.dynamicRuleCreateUserId},#{object.logRuleId}, #{object.dynamicRuleDisplayId})
|
||||
</foreach>
|
||||
</insert>
|
||||
<insert id="newDynamicRulProtectObjectsConcat">
|
||||
|
||||
@@ -10,12 +10,12 @@
|
||||
protect_object_ip, protect_object_port, protect_object_url,
|
||||
protect_object_protocol,
|
||||
protect_object_create_username, protect_object_create_depart,
|
||||
protect_object_create_user_id)
|
||||
protect_object_create_user_id, protect_object_display_id)
|
||||
VALUE (#{proobj.protectObjectId}, #{proobj.protectObjectName}, #{proobj.protectObjectSystemName},
|
||||
INET_ATON(#{proobj.protectObjectIPAddress}), #{proobj.protectObjectPort}, #{proobj.protectObjectURL},
|
||||
#{proobj.protectObjectProtocol},
|
||||
#{proobj.protectObjectCreateUsername}, #{proobj.protectObjectCreateDepart},
|
||||
#{proobj.protectObjectCreateUserId})
|
||||
#{proobj.protectObjectCreateUserId}, #{proobj.protectObjectDisplayId})
|
||||
</insert>
|
||||
|
||||
<insert id="newProtectObjects" parameterType="List">
|
||||
@@ -23,14 +23,14 @@
|
||||
protect_object_ip, protect_object_port, protect_object_url,
|
||||
protect_object_protocol,
|
||||
protect_object_create_username, protect_object_create_depart,
|
||||
protect_object_create_user_id)
|
||||
protect_object_create_user_id, protect_object_display_id)
|
||||
VALUES
|
||||
<foreach collection="proobjs" item="proobj" separator=",">
|
||||
(#{proobj.protectObjectId}, #{proobj.protectObjectName}, #{proobj.protectObjectSystemName},
|
||||
INET_ATON(#{proobj.protectObjectIPAddress}), #{proobj.protectObjectPort}, #{proobj.protectObjectURL},
|
||||
#{proobj.protectObjectProtocol},
|
||||
#{proobj.protectObjectCreateUsername}, #{proobj.protectObjectCreateDepart},
|
||||
#{proobj.protectObjectCreateUserId})
|
||||
#{proobj.protectObjectCreateUserId}, #{proobj.protectObjectDisplayId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
static_rule_dip, static_rule_mdip, static_rule_dport, static_rule_mdport,
|
||||
static_rule_protocol, static_rule_mprotocol, static_rule_dns,
|
||||
static_rule_url, static_rule_priority,
|
||||
static_rule_frequency, static_rule_audit_status
|
||||
)
|
||||
static_rule_frequency, static_rule_audit_status,
|
||||
static_rule_display_id)
|
||||
values (#{object.staticRuleName}, #{object.staticRuleCreateTime}, #{object.staticRuleCreateUsername},
|
||||
#{object.staticRuleCreateDepart}, #{object.staticRuleCreateUserId}, INET_ATON(#{object.staticRuleSip}),
|
||||
INET_ATON(#{object.staticRuleMsip}), #{object.staticRuleSport}, #{object.staticRuleMsport},
|
||||
@@ -22,7 +22,8 @@
|
||||
#{object.staticRuleMdport}, #{object.staticRuleProtocol}, #{object.staticRuleMprotocol},
|
||||
#{object.staticRuleDns}, #{object.staticRuleURL}, #{object.staticRulePriority},
|
||||
#{object.staticRuleFrequency},
|
||||
#{object.auditStatus})
|
||||
#{object.auditStatus},
|
||||
#{object.staticRuleDisplayId})
|
||||
</insert>
|
||||
<insert id="newStaticRules">
|
||||
insert into t_static_rule(static_rule_name, static_rule_create_time,
|
||||
@@ -32,7 +33,8 @@
|
||||
static_rule_dip, static_rule_mdip, static_rule_dport, static_rule_mdport,
|
||||
static_rule_protocol, static_rule_mprotocol, static_rule_dns,
|
||||
static_rule_url, static_rule_priority,
|
||||
static_rule_frequency, static_rule_audit_status
|
||||
static_rule_frequency, static_rule_audit_status,
|
||||
static_rule_display_id
|
||||
)
|
||||
values
|
||||
<foreach collection="staticRuleBatch" item="object" separator=",">
|
||||
@@ -42,7 +44,8 @@
|
||||
INET_ATON(#{object.staticRuleDip}), INET_ATON(#{object.staticRuleMdip}), #{object.staticRuleDport},
|
||||
#{object.staticRuleMdport}, #{object.staticRuleProtocol}, #{object.staticRuleMprotocol},
|
||||
#{object.staticRuleDns}, #{object.staticRuleURL}, #{object.staticRulePriority},
|
||||
#{object.staticRuleFrequency}, 0
|
||||
#{object.staticRuleFrequency}, 0,
|
||||
#{object.staticRuleDisplayId}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
@@ -8,12 +8,13 @@
|
||||
INSERT INTO t_task(task_name, task_start_time, task_end_time,
|
||||
task_act, task_type,
|
||||
task_create_time, task_modify_time,
|
||||
task_create_userid, task_create_username, task_create_depart,task_range
|
||||
)
|
||||
task_create_userid, task_create_username, task_create_depart,task_range,
|
||||
task_display_id)
|
||||
VALUE (#{task.taskName}, #{task.taskStartTime}, #{task.taskEndTime},
|
||||
#{task.taskAct}, #{task.taskType},
|
||||
NOW(), NOW(),
|
||||
#{task.taskCreateUserId}, #{task.taskCreateUsername}, #{task.taskCreateDepart},#{task.taskRange}
|
||||
#{task.taskCreateUserId}, #{task.taskCreateUsername}, #{task.taskCreateDepart},#{task.taskRange},
|
||||
#{task.taskDisplayId}
|
||||
)
|
||||
|
||||
</insert>
|
||||
@@ -251,12 +252,12 @@
|
||||
<insert id="newTaskUsingCommandInfo" useGeneratedKeys="true" keyProperty="taskId"
|
||||
parameterType="com.realtime.protection.configuration.entity.task.TaskCommandInfo">
|
||||
INSERT INTO t_task(task_name, task_start_time, task_end_time, task_create_time, task_modify_time, task_type,
|
||||
task_act, task_create_username, task_create_depart, task_create_userid, task_range)
|
||||
task_act, task_create_username, task_create_depart, task_create_userid, task_range, task_display_id)
|
||||
VALUE
|
||||
(
|
||||
#{info.taskName}, #{info.startTime}, #{info.endTime}, NOW(), NOW(), #{info.taskType},
|
||||
#{info.taskAct}, #{info.taskCreateUsername}, #{info.taskCreateDepart}, #{info.taskCreateUserId},
|
||||
#{info.distributePoint}}
|
||||
#{info.distributePoint},#{info.taskDisplayId}
|
||||
);
|
||||
</insert>
|
||||
|
||||
@@ -368,6 +369,9 @@
|
||||
AND task_source LIKE CONCAT('%', #{task_source}, '%')
|
||||
</if>
|
||||
|
||||
<if test="task_create_time != null">
|
||||
AND DATE(#{task_create_time}) = CURRENT_DATE
|
||||
</if>
|
||||
</where>
|
||||
|
||||
</select>
|
||||
@@ -376,6 +380,7 @@
|
||||
SELECT COUNT(*) FROM t_task
|
||||
WHERE task_audit_status = #{auditStatus}
|
||||
</select>
|
||||
|
||||
<select id="queryAuditStatusByIds" resultType="java.lang.Integer">
|
||||
SELECT task_audit_status
|
||||
FROM t_task
|
||||
|
||||
@@ -39,4 +39,7 @@ server {
|
||||
|
||||
proxy_pass http://server_list/api/v1/;
|
||||
}
|
||||
|
||||
# 允许iframe跨域嵌套
|
||||
add_header X-Frame-Options ALLOW-FROM ${iframe_url};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user