diff --git a/docker-doris/Dockerfile b/docker-doris/Dockerfile new file mode 100644 index 0000000..4bdcc3a --- /dev/null +++ b/docker-doris/Dockerfile @@ -0,0 +1,19 @@ +FROM apache/incubator-doris:build-env-latest + +USER root +WORKDIR /root +RUN echo '123456' | passwd root --stdin + +RUN yum install -y vim net-tools man wget git mysql lsof bash-completion \ + && cp /var/local/thirdparty/installed/bin/thrift /usr/bin + +# 更安全的使用,创建用户而不是使用 root +RUN yum install -y sudo \ + && useradd -ms /bin/bash endera && echo 123456 | passwd endera --stdin \ + && usermod -a -G wheel endera + +USER endera +WORKDIR /home/endera +RUN git config --global color.ui true \ + && git config --global user.email "707475564@qq.com" \ + && git config --global user.name "EnderByEndera" \ No newline at end of file diff --git a/docker-nginx/Dockerfile b/docker-nginx/Dockerfile index 53f2b0c..1cc0c5f 100644 --- a/docker-nginx/Dockerfile +++ b/docker-nginx/Dockerfile @@ -11,9 +11,9 @@ COPY realtime_protection realtime_protection # NGINX_SERVER_NAME="localhost" ENV SPRINGBOOT_FIRST_URL="192.168.107.89:8081" \ - SPRINGBOOT_SECOND_URL="172.24.100.53:8082" \ - SPRINGBOOT_THIRD_URL="172.24.100.53:8083" \ - SPRINGBOOT_FOURTH_URL="172.24.100.53:8084" \ + SPRINGBOOT_SECOND_URL="192.168.107.89:8082" \ + SPRINGBOOT_THIRD_URL="192.168.107.89:8083" \ + SPRINGBOOT_FOURTH_URL="192.168.107.89:8084" \ NGINX_PORT=8080 \ NGINX_SERVER_NAME="localhost" diff --git a/docker-springboot/Dockerfile b/docker-springboot/Dockerfile index 90a2f86..7ed5367 100644 --- a/docker-springboot/Dockerfile +++ b/docker-springboot/Dockerfile @@ -3,19 +3,19 @@ LABEL authors="Endera" COPY realtime_protection realtime_protection -ENV MYSQL_USERNAME="root" \ - MYSQL_PASSWD="IOmysql" \ - MYSQL_URL="10.58.72.140:3306" \ - DORIS_USERNAME="root" \ - DORIS_PASSWD="" \ - DORIS_URL="10.58.72.135:9030" - #ENV MYSQL_USERNAME="root" \ -# MYSQL_PASSWD="aiihhbfcsy123!@#" \ -# MYSQL_URL="192.168.107.89:3306" \ +# MYSQL_PASSWD="IOmysql" \ +# MYSQL_URL="10.58.72.140:3306" \ # DORIS_USERNAME="root" \ # DORIS_PASSWD="" \ -# DORIS_URL="10.26.22.133:9030" +# DORIS_URL="10.58.72.135:9030" + +ENV MYSQL_USERNAME="root" \ + MYSQL_PASSWD="aiihhbfcsy123!@#" \ + MYSQL_URL="192.168.107.89:3306" \ + DORIS_USERNAME="root" \ + DORIS_PASSWD="" \ + DORIS_URL="10.26.22.133:9030" EXPOSE 8081 diff --git a/docker-springboot/start_springboot.sh b/docker-springboot/start_springboot.sh index 04600a0..1ef1e29 100644 --- a/docker-springboot/start_springboot.sh +++ b/docker-springboot/start_springboot.sh @@ -11,4 +11,4 @@ chmod +x ./gradlew ./gradlew clean && ./gradlew bootJar # 启动SpringBoot服务 -./gradlew bootRun --args="--spring.profiles.active=prod" \ No newline at end of file +./gradlew bootRun --args="--spring.profiles.active=test" \ No newline at end of file diff --git a/src/main/java/com/realtime/protection/server/defense/object/ProtectObjectController.java b/src/main/java/com/realtime/protection/server/defense/object/ProtectObjectController.java index 3eff9ea..2ac1fa1 100644 --- a/src/main/java/com/realtime/protection/server/defense/object/ProtectObjectController.java +++ b/src/main/java/com/realtime/protection/server/defense/object/ProtectObjectController.java @@ -70,14 +70,38 @@ public class ProtectObjectController implements ProtectObjectControllerApi { @GetMapping("/query") public ResponseResult queryProtectObjects(@RequestParam(value = "proobj_name", required = false) String protectObjectName, - @RequestParam(value = "proobj_id", required = false) @Min(1) + @RequestParam(value = "proobj_id", required = false) + @Min(value = 1, message = "ID值不可小于1") Integer protectObjectId, + @RequestParam(value = "proobj_systemm_name", required = false) + String protectObjectSystemName, + @RequestParam(value = "proobj_ip_address", required = false) + String protectObjectIPAddress, + @RequestParam(value = "proobj_port_min", required = false) + Integer protectObjectPortMin, + @RequestParam(value = "proobj_port_max", required = false) + Integer protectObjectPortMax, + @RequestParam(value = "proobj_url", required = false) + String protectObjectURL, + @RequestParam(value = "proobj_protocol", required = false) + String protectObjectProtocol, + @RequestParam(value = "proobj_create_username", required = false) + String protectObjectCreateUsername, + @RequestParam(value = "proobj_audit_status", required = false) + Integer protectObjectAuditStatus, @RequestParam("page") @Min(1) Integer page, @RequestParam("page_size") @Min(1) Integer pageSize) { return ResponseResult.ok() - .setData("proobj_list", protectObjectService.queryProtectObjects(protectObjectName, - protectObjectId, page, pageSize)) - .setData("total_num", protectObjectService.queryProtectObjectsTotalNum(protectObjectName, protectObjectId)); + .setData("proobj_list", protectObjectService.queryProtectObjects( + protectObjectName, protectObjectId, protectObjectSystemName, protectObjectIPAddress, + protectObjectPortMin, protectObjectPortMax, protectObjectURL, protectObjectProtocol, + protectObjectCreateUsername, protectObjectAuditStatus, + page, pageSize)) + .setData("total_num", protectObjectService.queryProtectObjectsTotalNum( + protectObjectName, protectObjectId, protectObjectSystemName, protectObjectIPAddress, + protectObjectPortMin, protectObjectPortMax, protectObjectURL, protectObjectProtocol, + protectObjectCreateUsername, protectObjectAuditStatus + )); } @Override diff --git a/src/main/java/com/realtime/protection/server/defense/object/ProtectObjectControllerApi.java b/src/main/java/com/realtime/protection/server/defense/object/ProtectObjectControllerApi.java index af82c5d..387a94b 100644 --- a/src/main/java/com/realtime/protection/server/defense/object/ProtectObjectControllerApi.java +++ b/src/main/java/com/realtime/protection/server/defense/object/ProtectObjectControllerApi.java @@ -158,14 +158,39 @@ public interface ProtectObjectControllerApi { parameters = { @Parameter(name = "proobj_name", description = "防护对象名称"), @Parameter(name = "proobj_id", description = "防护对象ID"), + @Parameter(name = "proobj_system_name", description = "防护对象操作系统"), + @Parameter(name = "proobj_ip_address", description = "防护对象IP地址"), + @Parameter(name = "proobj_port_min", description = "防护对象端口最小值"), + @Parameter(name = "proobj_port_max", description = "防护对象端口最大值"), + @Parameter(name = "proobj_url", description = "防护对象URL"), + @Parameter(name = "proobj_protocol", description = "防护对象网络协议"), + @Parameter(name = "proobj_create_username", description = "防护对象创建人"), + @Parameter(name = "proobj_audit_status", description = "防护对象审核状态"), @Parameter(name = "page", description = "页码", example = "1"), @Parameter(name = "page_size", description = "每页的对象个数", example = "5") } ) ResponseResult queryProtectObjects(@RequestParam(value = "proobj_name", required = false) String protectObjectName, - @RequestParam(value = "proobj_id", required = false) @Min(1) + @RequestParam(value = "proobj_id", required = false) + @Min(value = 1, message = "ID值不可小于1") Integer protectObjectId, + @RequestParam(value = "proobj_systemm_name", required = false) + String protectObjectSystemName, + @RequestParam(value = "proobj_ip_address", required = false) + String protectObjectIPAddress, + @RequestParam(value = "proobj_port_min", required = false) + Integer protectObjectPortMin, + @RequestParam(value = "proobj_port_max", required = false) + Integer protectObjectPortMax, + @RequestParam(value = "proobj_url", required = false) + String protectObjectURL, + @RequestParam(value = "proobj_protocol", required = false) + String protectObjectProtocol, + @RequestParam(value = "proobj_create_username", required = false) + String protectObjectCreateUsername, + @RequestParam(value = "proobj_audit_status", required = false) + Integer protectObjectAuditStatus, @RequestParam("page") @Min(1) Integer page, @RequestParam("page_size") @Min(1) Integer pageSize); diff --git a/src/main/java/com/realtime/protection/server/defense/object/ProtectObjectMapper.java b/src/main/java/com/realtime/protection/server/defense/object/ProtectObjectMapper.java index 5a1513c..5b8c7f1 100644 --- a/src/main/java/com/realtime/protection/server/defense/object/ProtectObjectMapper.java +++ b/src/main/java/com/realtime/protection/server/defense/object/ProtectObjectMapper.java @@ -12,10 +12,6 @@ public interface ProtectObjectMapper { void newProtectObjects(@Param("proobjs") List protectObject); - List queryProtectObjects(@Param("proobj_name") String protectObjectName, - @Param("proobj_id") Integer protectObjectId, - @Param("page") Integer page, - @Param("page_size") Integer pageSize); ProtectObject queryProtectObject(@Param("proobj_id") Integer protectObjectId); @@ -30,5 +26,26 @@ public interface ProtectObjectMapper { Integer queryProtectObjectsTotalNum(@Param("proobj_name") String protectObjectName, - @Param("proobj_id") Integer protectObjectId); + @Param("proobj_id") Integer protectObjectId, + @Param("proobj_system_name") String protectObjectSystemName, + @Param("proobj_ip") String protectObjectIPAddress, + @Param("proobj_port_min") Integer protectObjectPortMin, + @Param("proobj_port_max") Integer protectObjectPortMax, + @Param("proobj_url") String protectObjectURL, + @Param("proobj_protocol") String protectObjectProtocol, + @Param("proobj_username") String protectObjectCreateUsername, + @Param("proobj_audit_status") Integer protectObjectAuditStatus); + + List queryProtectObjects(@Param("proobj_name") String protectObjectName, + @Param("proobj_id") Integer protectObjectId, + @Param("proobj_system_name") String protectObjectSystemName, + @Param("proobj_ip") String protectObjectIPAddress, + @Param("proobj_port_min") Integer protectObjectPortMin, + @Param("proobj_port_max") Integer protectObjectPortMax, + @Param("proobj_url") String protectObjectURL, + @Param("proobj_protocol") String protectObjectProtocol, + @Param("proobj_username") String protectObjectCreateUsername, + @Param("proobj_audit_status") Integer protectObjectAuditStatus, + @Param("page") Integer page, + @Param("page_size") Integer pageSize); } diff --git a/src/main/java/com/realtime/protection/server/defense/object/ProtectObjectService.java b/src/main/java/com/realtime/protection/server/defense/object/ProtectObjectService.java index 8b223d0..c513d4e 100644 --- a/src/main/java/com/realtime/protection/server/defense/object/ProtectObjectService.java +++ b/src/main/java/com/realtime/protection/server/defense/object/ProtectObjectService.java @@ -56,8 +56,17 @@ public class ProtectObjectService { return sqlSessionWrapper.startBatchSession(ProtectObjectMapper.class, newProtectObjectFunction, protectObjectList); } - public List queryProtectObjects(String protectObjectName, Integer protectObjectId, Integer page, Integer pageSize) { - return protectObjectMapper.queryProtectObjects(protectObjectName, protectObjectId, page, pageSize); + public List queryProtectObjects(String protectObjectName, Integer protectObjectId, + String protectObjectSystemName, String protectObjectIPAddress, + Integer protectObjectPortMin, Integer protectObjectPortMax, + String protectObjectURL, String protectObjectProtocol, + String protectObjectCreateUsername, Integer protectObjectAuditStatus, + Integer page, Integer pageSize) { + return protectObjectMapper.queryProtectObjects( + protectObjectName, protectObjectId, protectObjectSystemName, protectObjectIPAddress, + protectObjectPortMin, protectObjectPortMax, protectObjectURL, protectObjectProtocol, + protectObjectCreateUsername, protectObjectAuditStatus, + page, pageSize); } public ProtectObject queryProtectObject(Integer protectObjectId) { @@ -113,7 +122,15 @@ public class ProtectObjectService { return resultMap; } - public Integer queryProtectObjectsTotalNum(String protectObjectName, Integer protectObjectId) { - return protectObjectMapper.queryProtectObjectsTotalNum(protectObjectName, protectObjectId); + public Integer queryProtectObjectsTotalNum(String protectObjectName, Integer protectObjectId, + String protectObjectSystemName, String protectObjectIPAddress, + Integer protectObjectPortMin, Integer protectObjectPortMax, + String protectObjectURL, String protectObjectProtocol, + String protectObjectCreateUsername, Integer protectObjectAuditStatus) { + return protectObjectMapper.queryProtectObjectsTotalNum( + protectObjectName, protectObjectId, protectObjectSystemName, protectObjectIPAddress, + protectObjectPortMin, protectObjectPortMax, protectObjectURL, protectObjectProtocol, + protectObjectCreateUsername, protectObjectAuditStatus + ); } } diff --git a/src/main/java/com/realtime/protection/server/defense/template/TemplateController.java b/src/main/java/com/realtime/protection/server/defense/template/TemplateController.java index 584014f..d8fd1b6 100644 --- a/src/main/java/com/realtime/protection/server/defense/template/TemplateController.java +++ b/src/main/java/com/realtime/protection/server/defense/template/TemplateController.java @@ -39,13 +39,18 @@ public class TemplateController implements TemplateControllerApi { @Override @GetMapping("/query") public ResponseResult queryTemplates(@RequestParam(value = "template_name", required = false) String templateName, + @RequestParam(value = "source_system", required = false) String sourceSystem, + @RequestParam(value = "create_user_name", required = false) String createUserName, @RequestParam("page") @Min(1) Integer page, @RequestParam("page_size") @Min(1) Integer pageSize) { - List