From 2c3c5450593b93ccb7a46749d943a84b477f55e9 Mon Sep 17 00:00:00 2001 From: leijun Date: Mon, 20 Aug 2018 17:22:39 +0800 Subject: [PATCH 01/23] =?UTF-8?q?p2p=E6=96=87=E4=BB=B6=E5=90=8D=E6=9B=B4?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../log/ntc/{B2pLogController.java => P2pLogController.java} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/main/java/com/nis/web/controller/log/ntc/{B2pLogController.java => P2pLogController.java} (100%) diff --git a/src/main/java/com/nis/web/controller/log/ntc/B2pLogController.java b/src/main/java/com/nis/web/controller/log/ntc/P2pLogController.java similarity index 100% rename from src/main/java/com/nis/web/controller/log/ntc/B2pLogController.java rename to src/main/java/com/nis/web/controller/log/ntc/P2pLogController.java From 8d9bbabbeefd15fa67e46cef1fe270d8627fedf9 Mon Sep 17 00:00:00 2001 From: zhanghongqing Date: Mon, 20 Aug 2018 17:27:03 +0800 Subject: [PATCH 02/23] =?UTF-8?q?=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/messages/message_en.properties | 8 +++++--- src/main/resources/messages/message_zh_CN.properties | 7 ++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main/resources/messages/message_en.properties b/src/main/resources/messages/message_en.properties index 681f0a848..f3b4ca784 100644 --- a/src/main/resources/messages/message_en.properties +++ b/src/main/resources/messages/message_en.properties @@ -1076,6 +1076,8 @@ ip_intercepter_replace=IP Intercept Replace domain_intercepter_replace=Domain Intercept Replace ip_intercepter_ratelimit=IP Intercept Ratelimit domain_intercepter_ratelimit=Domain Intercept Ratelimit -app_built_in_features_config=APP Built-in Features -app_ssl_config=APP SSL Cert Feature -p2p_control=P2P \ No newline at end of file +app_built_in_features_config=APP Built-in Features +app_ssl_config=APP SSL Cert Feature +PXY_INTERCEPT_PKT_BIN=Intercept Messages +certificate=Certificate +app_ssl_config=APP SSL Cert Feature diff --git a/src/main/resources/messages/message_zh_CN.properties b/src/main/resources/messages/message_zh_CN.properties index 7c59efeb4..9341cc139 100644 --- a/src/main/resources/messages/message_zh_CN.properties +++ b/src/main/resources/messages/message_zh_CN.properties @@ -1074,6 +1074,7 @@ ip_intercepter_replace=IP\u62E6\u622A\u66FF\u6362 domain_intercepter_replace=\u57DF\u540D\u62E6\u622A\u66FF\u6362 ip_intercepter_ratelimit=IP\u62E6\u622A\u9650\u901F domain_intercepter_ratelimit=\u57DF\u540D\u62E6\u622A\u9650\u901F -app_built_in_features_config=APP\u5185\u7F6E\u7279\u5F81\u7EF4\u62A4 -app_ssl_config=APP SSL\u8BC1\u4E66\u7279\u5F81 -p2p_control=P2P \ No newline at end of file +app_built_in_features_config=APP\u5185\u7F6E\u7279\u5F81\u7EF4\u62A4 +app_ssl_config=APP SSL\u8BC1\u4E66\u7279\u5F81 +PXY_INTERCEPT_PKT_BIN=\u62E6\u622A\u62A5\u6587 +certificate=\u8BC1\u4E66 From ada7d38be9ed4a2c29f556aff409c684fef529c9 Mon Sep 17 00:00:00 2001 From: zhanghongqing Date: Mon, 20 Aug 2018 17:46:28 +0800 Subject: [PATCH 03/23] =?UTF-8?q?Revert=20"=E5=86=B2=E7=AA=81"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 8d9bbabbeefd15fa67e46cef1fe270d8627fedf9. --- src/main/resources/messages/message_en.properties | 8 +++----- src/main/resources/messages/message_zh_CN.properties | 7 +++---- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/main/resources/messages/message_en.properties b/src/main/resources/messages/message_en.properties index f3b4ca784..681f0a848 100644 --- a/src/main/resources/messages/message_en.properties +++ b/src/main/resources/messages/message_en.properties @@ -1076,8 +1076,6 @@ ip_intercepter_replace=IP Intercept Replace domain_intercepter_replace=Domain Intercept Replace ip_intercepter_ratelimit=IP Intercept Ratelimit domain_intercepter_ratelimit=Domain Intercept Ratelimit -app_built_in_features_config=APP Built-in Features -app_ssl_config=APP SSL Cert Feature -PXY_INTERCEPT_PKT_BIN=Intercept Messages -certificate=Certificate -app_ssl_config=APP SSL Cert Feature +app_built_in_features_config=APP Built-in Features +app_ssl_config=APP SSL Cert Feature +p2p_control=P2P \ No newline at end of file diff --git a/src/main/resources/messages/message_zh_CN.properties b/src/main/resources/messages/message_zh_CN.properties index 9341cc139..7c59efeb4 100644 --- a/src/main/resources/messages/message_zh_CN.properties +++ b/src/main/resources/messages/message_zh_CN.properties @@ -1074,7 +1074,6 @@ ip_intercepter_replace=IP\u62E6\u622A\u66FF\u6362 domain_intercepter_replace=\u57DF\u540D\u62E6\u622A\u66FF\u6362 ip_intercepter_ratelimit=IP\u62E6\u622A\u9650\u901F domain_intercepter_ratelimit=\u57DF\u540D\u62E6\u622A\u9650\u901F -app_built_in_features_config=APP\u5185\u7F6E\u7279\u5F81\u7EF4\u62A4 -app_ssl_config=APP SSL\u8BC1\u4E66\u7279\u5F81 -PXY_INTERCEPT_PKT_BIN=\u62E6\u622A\u62A5\u6587 -certificate=\u8BC1\u4E66 +app_built_in_features_config=APP\u5185\u7F6E\u7279\u5F81\u7EF4\u62A4 +app_ssl_config=APP SSL\u8BC1\u4E66\u7279\u5F81 +p2p_control=P2P \ No newline at end of file From 18e8c872f34dc28eabc04e4aad6b8e4e087993c5 Mon Sep 17 00:00:00 2001 From: leijun Date: Mon, 20 Aug 2018 18:39:06 +0800 Subject: [PATCH 04/23] =?UTF-8?q?=E7=B1=BB=E5=90=8D=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nis/web/controller/log/ntc/P2pLogController.java | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/main/java/com/nis/web/controller/log/ntc/P2pLogController.java b/src/main/java/com/nis/web/controller/log/ntc/P2pLogController.java index 0cca62917..8a26e34f0 100644 --- a/src/main/java/com/nis/web/controller/log/ntc/P2pLogController.java +++ b/src/main/java/com/nis/web/controller/log/ntc/P2pLogController.java @@ -1,7 +1,5 @@ package com.nis.web.controller.log.ntc; -import java.io.File; -import java.io.IOException; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -10,23 +8,17 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang3.StringUtils; -import org.aspectj.util.FileUtil; -import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; - import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; import com.nis.domain.FunctionServiceDict; -import com.nis.domain.Page; import com.nis.domain.PageLog; import com.nis.domain.log.NtcIpLog; import com.nis.domain.maat.LogRecvData; -import com.nis.exceptions.MaatConvertException; import com.nis.util.Constants; import com.nis.util.DictUtils; import com.nis.util.httpclient.HttpClientUtil; @@ -34,7 +26,7 @@ import com.nis.web.controller.BaseController; @Controller @RequestMapping("${adminPath}/log/ntc/p2pLogs") -public class B2pLogController extends BaseController { +public class P2pLogController extends BaseController { @RequestMapping(value = {"list", ""}) public String list(@ModelAttribute("log") NtcIpLog log, Model model, HttpServletRequest request, HttpServletResponse response) { From aa7c75da998bc5e39150561c68725baf719af8ed Mon Sep 17 00:00:00 2001 From: zhanghongqing Date: Mon, 20 Aug 2018 18:48:10 +0800 Subject: [PATCH 05/23] =?UTF-8?q?1.=E5=A2=9E=E5=8A=A0do=5Flog=E5=AD=97?= =?UTF-8?q?=E5=85=B8=E5=B1=9E=E6=80=A72.cfg=5Findex=5Finfo=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0do=5Flog=E5=AD=97=E6=AE=B5=E6=9B=B4=E6=96=B0sql?= =?UTF-8?q?=E6=96=87=E4=BB=B6=203.VoIP=20IP=E8=B7=9Faccount=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0do=5Flog=E6=98=AF=E5=90=A6=E6=98=BE=E7=A4=BA=E6=97=A5?= =?UTF-8?q?=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/nis/domain/configuration/BaseCfg.java | 12 ++++ .../web/dao/configuration/AvContentCfgDao.xml | 12 +++- .../resources/messages/message_en.properties | 8 ++- .../messages/message_zh_CN.properties | 5 +- .../sql/update_cfg_index_info-20180820.sql | 1 + src/main/resources/sql/字典修改记录.txt | 9 ++- .../views/cfg/av/voip/voipAccountForm.jsp | 43 ++++++++++++- .../views/cfg/av/voip/voipAccountList.jsp | 8 +++ .../WEB-INF/views/cfg/av/voip/voipForm.jsp | 63 +++++++++++++++---- .../WEB-INF/views/cfg/av/voip/voipList.jsp | 8 +++ 10 files changed, 146 insertions(+), 23 deletions(-) create mode 100644 src/main/resources/sql/update_cfg_index_info-20180820.sql diff --git a/src/main/java/com/nis/domain/configuration/BaseCfg.java b/src/main/java/com/nis/domain/configuration/BaseCfg.java index 02472d9f0..0973d2c01 100644 --- a/src/main/java/com/nis/domain/configuration/BaseCfg.java +++ b/src/main/java/com/nis/domain/configuration/BaseCfg.java @@ -196,6 +196,18 @@ public class BaseCfg extends BaseEntity implements Cloneable{ */ protected Integer functionId; + /** + * do_log属性在界面(do_log:0不需要1记录所有日志2只记录结构化日志。默认是2) + */ + protected Integer doLog; + + + public Integer getDoLog() { + return doLog; + } + public void setDoLog(Integer doLog) { + this.doLog = doLog; + } /** * cfgRegionCode * @return cfgRegionCode diff --git a/src/main/java/com/nis/web/dao/configuration/AvContentCfgDao.xml b/src/main/java/com/nis/web/dao/configuration/AvContentCfgDao.xml index 3bbbb8f5a..0d1073c9f 100644 --- a/src/main/java/com/nis/web/dao/configuration/AvContentCfgDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/AvContentCfgDao.xml @@ -23,6 +23,7 @@ + @@ -157,7 +158,7 @@ r.CFG_ID,r.CFG_DESC,r.ACTION,r.IS_VALID,r.IS_AUDIT, r.CREATOR_ID,r.CREATE_TIME,r.EDITOR_ID,r.EDIT_TIME,r.AUDITOR_ID,r.AUDIT_TIME, r.SERVICE_ID,r.REQUEST_ID,r.COMPILE_ID,r.IS_AREA_EFFECTIVE,r.CLASSIFY, - r.ATTRIBUTE,r.LABLE,r.AREA_EFFECTIVE_IDS,r.function_id + r.ATTRIBUTE,r.LABLE,r.AREA_EFFECTIVE_IDS,r.function_id,r.do_log r.cfg_id,r.cfg_desc,r.ip_type,r.src_ip_address,r.ip_pattern,r.port_pattern,r.src_port @@ -545,7 +546,8 @@ ATTRIBUTE, LABLE, AREA_EFFECTIVE_IDS, - function_id + function_id, + do_log )values ( #{cfgDesc,jdbcType=VARCHAR}, #{action,jdbcType=INTEGER}, @@ -565,7 +567,8 @@ #{attribute,jdbcType=VARCHAR}, #{lable,jdbcType=VARCHAR}, #{areaEffectiveIds,jdbcType=VARCHAR}, - #{functionId,jdbcType=INTEGER} + #{functionId,jdbcType=INTEGER}, + #{doLog,jdbcType=INTEGER} ) @@ -804,6 +807,9 @@ service_id = #{serviceId,jdbcType=INTEGER}, + + do_log = #{doLog,jdbcType=INTEGER}, + diff --git a/src/main/resources/messages/message_en.properties b/src/main/resources/messages/message_en.properties index 881c9d4d5..09e2ec444 100644 --- a/src/main/resources/messages/message_en.properties +++ b/src/main/resources/messages/message_en.properties @@ -617,7 +617,7 @@ val_dst_ip=Server IP format is incorrect or inconsistent with IP type val_dst_mask=Server IP mask format is incorrect or inconsistent with IP type val_dst_port=Server port is empty or incorrectly formatting(0-65535) val_dst_port_mask=Server port mask format is incorrect(0-65535) -val_protocol=Protocol Can't be empty,and should be 6(TCP),17(UDP),0(\u4efb\u610f) +val_protocol=Protocol Can't be empty,and should be 6(TCP),17(UDP),0(\u4EFB\u610F) val_direction=Direction should be 0(bidirectional) or 1(unidirectional) #===============protocol IP Import end================= @@ -1077,7 +1077,9 @@ domain_intercepter_replace=Domain Intercept Replace ip_intercepter_ratelimit=IP Intercept Ratelimit domain_intercepter_ratelimit=Domain Intercept Ratelimit app_built_in_features_config=APP Built-in Features -app_ssl_config=APP SSL Cert Feature PXY_INTERCEPT_PKT_BIN=Intercept Messages certificate=Certificate -app_ssl_config=APP SSL Cert Feature +do_log=Do Log +no_log=Not Do Log +all_log=Log All Logs +framework_log=Only Framework Logs \ No newline at end of file diff --git a/src/main/resources/messages/message_zh_CN.properties b/src/main/resources/messages/message_zh_CN.properties index 75c019bad..9ec1c4b36 100644 --- a/src/main/resources/messages/message_zh_CN.properties +++ b/src/main/resources/messages/message_zh_CN.properties @@ -1075,6 +1075,9 @@ domain_intercepter_replace=\u57DF\u540D\u62E6\u622A\u66FF\u6362 ip_intercepter_ratelimit=IP\u62E6\u622A\u9650\u901F domain_intercepter_ratelimit=\u57DF\u540D\u62E6\u622A\u9650\u901F app_built_in_features_config=APP\u5185\u7F6E\u7279\u5F81\u7EF4\u62A4 -app_ssl_config=APP SSL\u8BC1\u4E66\u7279\u5F81 PXY_INTERCEPT_PKT_BIN=\u62E6\u622A\u62A5\u6587 certificate=\u8BC1\u4E66 +do_log=\u662F\u5426\u8BB0\u5F55\u65E5\u5FD7 +no_log=\u4E0D\u8BB0\u5F55 +all_log=\u8BB0\u5F55\u6240\u6709\u65E5\u5FD7 +framework_log=\u53EA\u8BB0\u5F55\u7ED3\u6784\u5316\u65E5\u5FD7 \ No newline at end of file diff --git a/src/main/resources/sql/update_cfg_index_info-20180820.sql b/src/main/resources/sql/update_cfg_index_info-20180820.sql new file mode 100644 index 000000000..a00adcfd9 --- /dev/null +++ b/src/main/resources/sql/update_cfg_index_info-20180820.sql @@ -0,0 +1 @@ +alter table task_info add do_log int(11) COMMENT 'do_log:0不需要1记录所有日志2只记录结构化日志。默认是2' \ No newline at end of file diff --git a/src/main/resources/sql/字典修改记录.txt b/src/main/resources/sql/字典修改记录.txt index a8b991713..16b320e35 100644 --- a/src/main/resources/sql/字典修改记录.txt +++ b/src/main/resources/sql/字典修改记录.txt @@ -2,4 +2,11 @@ \u4FEE\u6539\u5B57\u5178LOG_STREAM_TYPE\uFF0C\u5C06\u6807\u8BC60\u30011\u30012\u6539\u4E3A1\u30012\u30013 2018-08-03 -\u589E\u52A0\u5B57\u5178ATTACK_TYPE\uFF0C\u4F9D\u636E\u534F\u8BAE\u7EDF\u8BA1\u5DF2\u6709\u7C7B\u578B \uFF1AUDP-Flood: 1069 \uFF0CSYN-Flood: 1070 \ No newline at end of file +\u589E\u52A0\u5B57\u5178ATTACK_TYPE\uFF0C\u4F9D\u636E\u534F\u8BAE\u7EDF\u8BA1\u5DF2\u6709\u7C7B\u578B \uFF1AUDP-Flood: 1069 \uFF0CSYN-Flood: 1070 + +2018-08-20\uFF08do_log:0\u4E0D\u9700\u89811\u8BB0\u5F55\u6240\u6709\u65E5\u5FD72\u53EA\u8BB0\u5F55\u7ED3\u6784\u5316\u65E5\u5FD7\u3002\u9ED8\u8BA4\u662F2\uFF09 +\u65B0\u589E\u662F\u5426\u8BB0\u5F55\u65E5\u5FD7 DO_LOG +\u6807\u8BC6 \u503C describe \u662F\u5426\u53EF\u7528 \u662F\u5426\u53EF\u7EF4\u62A4 +0 no_log \u4E0D\u8BB0\u5F55\u65E5\u5FD7 \u662F \u662F +1 all_log \u8BB0\u5F55\u6240\u6709\u65E5\u5FD7 \u662F \u662F +2 framework_log \u53EA\u8BB0\u5F55\u7ED3\u6784\u5316\u65E5\u5FD7 \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/cfg/av/voip/voipAccountForm.jsp b/src/main/webapp/WEB-INF/views/cfg/av/voip/voipAccountForm.jsp index dfd64f098..c96a01fc0 100644 --- a/src/main/webapp/WEB-INF/views/cfg/av/voip/voipAccountForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/av/voip/voipAccountForm.jsp @@ -152,8 +152,6 @@ value="${_cfg.serviceId}">
- -
@@ -192,6 +190,47 @@
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ diff --git a/src/main/webapp/WEB-INF/views/cfg/av/voip/voipAccountList.jsp b/src/main/webapp/WEB-INF/views/cfg/av/voip/voipAccountList.jsp index 96419003f..e8f5d6c96 100644 --- a/src/main/webapp/WEB-INF/views/cfg/av/voip/voipAccountList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/av/voip/voipAccountList.jsp @@ -535,6 +535,7 @@ + @@ -566,6 +567,13 @@ + + + + + + + diff --git a/src/main/webapp/WEB-INF/views/cfg/av/voip/voipForm.jsp b/src/main/webapp/WEB-INF/views/cfg/av/voip/voipForm.jsp index c285ab42d..c507587a3 100644 --- a/src/main/webapp/WEB-INF/views/cfg/av/voip/voipForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/av/voip/voipForm.jsp @@ -165,37 +165,74 @@
+
- +
-
- - - - +
+
+ + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + diff --git a/src/main/webapp/WEB-INF/views/cfg/av/voip/voipList.jsp b/src/main/webapp/WEB-INF/views/cfg/av/voip/voipList.jsp index 1c3213e43..4529094c4 100644 --- a/src/main/webapp/WEB-INF/views/cfg/av/voip/voipList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/av/voip/voipList.jsp @@ -602,6 +602,7 @@ + @@ -633,6 +634,13 @@ + + + + + + + From 493ff4013facc9092d5715a0270d74e4cb0d3cbe Mon Sep 17 00:00:00 2001 From: wangxin Date: Mon, 20 Aug 2018 18:52:44 +0800 Subject: [PATCH 06/23] =?UTF-8?q?IP=E5=AF=BC=E5=85=A5=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E6=95=B0=E5=AD=97=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nis/web/controller/BaseController.java | 156 ++++++++++++------ 1 file changed, 106 insertions(+), 50 deletions(-) diff --git a/src/main/java/com/nis/web/controller/BaseController.java b/src/main/java/com/nis/web/controller/BaseController.java index 654034ea7..3d020afa7 100644 --- a/src/main/java/com/nis/web/controller/BaseController.java +++ b/src/main/java/com/nis/web/controller/BaseController.java @@ -724,14 +724,12 @@ public class BaseController { StringBuffer errInfo=new StringBuffer(); // ip_type check start Integer ipType=value.getIpType(); - String ipTypeString=null; if(ipType==null){ errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("ip_type"))+";"); }else{ boolean has=false; for(SysDataDictionaryItem ipTypeItem:ipTypeList){ if(ipType==Integer.parseInt(ipTypeItem.getItemCode())){ - ipTypeString=ipTypeItem.getItemValue(); has=true; break; } @@ -743,14 +741,12 @@ public class BaseController { // ip_type check end // ip_pattern check start Integer ipPattern=value.getIpPattern(); - String ipPatternString=null; if(ipPattern==null){ errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("ip_pattern"))+";"); }else{ boolean has=false; for(SysDataDictionaryItem ipPatternItem:ipPatternList){ if(ipPattern==Integer.parseInt(ipPatternItem.getItemCode())){ - ipPatternString=ipPatternItem.getItemValue(); has=true; break; } @@ -764,9 +760,9 @@ public class BaseController { String srcIp=value.getSrcIpAddress(); String _msg=""; if("ipmulitiplex".equals(specialItem)) { - _msg=checkIP(prop,prop.getProperty("IP"),srcIp,ipTypeString,ipPatternString); + _msg=checkIP(prop,prop.getProperty("IP"),srcIp,ipType,ipPattern); }else { - _msg=checkIP(prop,prop.getProperty("client_ip"),srcIp,ipTypeString,ipPatternString); + _msg=checkIP(prop,prop.getProperty("client_ip"),srcIp,ipType,ipPattern); } if(StringUtils.isNotBlank(_msg)){ errInfo.append(_msg); @@ -776,40 +772,40 @@ public class BaseController { String destIp=value.getDestIpAddress(); if("ipmulitiplex".equals(specialItem)) {//set 默认值 if(ipPattern!=null&&ipType!=null) { - if("ip_subnet".equals(ipPatternString)) { - if("ipv4".equals(ipTypeString)) { + if(1==ipPattern.intValue()) { + if(4==ipType.intValue()) { value.setDestIpAddress(Constants.IPV4_DEFAULT_IP_SUBNET_VALUE); - }else if("ipv6".equals(ipTypeString)) { + }else if(6==ipType.intValue()) { value.setDestIpAddress(Constants.IPV6_DEFAULT_IP_SUBNET_VALUE); - }else if("4over6".equals(ipTypeString)) { + }else if(46==ipType.intValue()) { value.setDestIpAddress(Constants.IPV6_DEFAULT_IP_SUBNET_VALUE); - }else if("6over4".equals(ipTypeString)) { + }else if(64==ipType.intValue()) { value.setDestIpAddress(Constants.IPV4_DEFAULT_IP_SUBNET_VALUE); - }else if("all".equals(ipTypeString)) { + }else if(10==ipType.intValue()) { value.setDestIpAddress(Constants.IPV4_DEFAULT_IP_SUBNET_VALUE); } - }else if("ip_range".equals(ipPatternString)) { - if("ipv4".equals(ipTypeString)) { + }else if(2==ipPattern.intValue()) { + if(4==ipType.intValue()) { value.setDestIpAddress(Constants.IPV4_DEFAULT_IP_RANGE_VALUE); - }else if("ipv6".equals(ipTypeString)) { + }else if(6==ipType.intValue()) { value.setDestIpAddress(Constants.IPV6_DEFAULT_IP_RANGE_VALUE); - }else if("4over6".equals(ipTypeString)) { + }else if(46==ipType.intValue()) { value.setDestIpAddress(Constants.IPV6_DEFAULT_IP_RANGE_VALUE); - }else if("6over4".equals(ipTypeString)) { + }else if(64==ipType.intValue()) { value.setDestIpAddress(Constants.IPV4_DEFAULT_IP_RANGE_VALUE); - }else if("all".equals(ipTypeString)) { + }else if(10==ipType.intValue()) { value.setDestIpAddress(Constants.IPV4_DEFAULT_IP_RANGE_VALUE); } - }else if("ip".equals(ipPatternString)) { - if("ipv4".equals(ipTypeString)) { + }else if(3==ipPattern.intValue()) { + if(4==ipType.intValue()) { value.setDestIpAddress(Constants.IPV4_DEFAULT_IP_VALUE); - }else if("ipv6".equals(ipTypeString)) { + }else if(6==ipType.intValue()) { value.setDestIpAddress(Constants.IPV6_DEFAULT_IP_VALUE); - }else if("4over6".equals(ipTypeString)) { + }else if(46==ipType.intValue()) { value.setDestIpAddress(Constants.IPV6_DEFAULT_IP_VALUE); - }else if("6over4".equals(ipTypeString)) { + }else if(64==ipType.intValue()) { value.setDestIpAddress(Constants.IPV4_DEFAULT_IP_VALUE); - }else if("all".equals(ipTypeString)) { + }else if(10==ipType.intValue()) { value.setDestIpAddress(Constants.IPV4_DEFAULT_IP_VALUE); } } @@ -819,13 +815,13 @@ public class BaseController { String info=String.format(prop.getProperty("are_the_same"),prop.getProperty("client_ip"),prop.getProperty("server_ip")); errInfo.append(info+";"); } - _msg=checkIP(prop,prop.getProperty("server_ip"),destIp,ipTypeString,ipPatternString); + _msg=checkIP(prop,prop.getProperty("server_ip"),destIp,ipType,ipPattern); if(StringUtils.isNotBlank(_msg)){ errInfo.append(_msg); } } - if(!"ipmulitiplex".equals(specialItem)&&("4over6".equals(ipTypeString)||"6over4".equals(ipTypeString)||"all".equals(ipTypeString))) { - _msg=checkIp(prop, prop.getProperty("client_ip"), srcIp, prop.getProperty("server_ip"), destIp, ipTypeString, ipPatternString); + if(!"ipmulitiplex".equals(specialItem)&&(46==ipType.intValue()||64==ipType.intValue()||10==ipType.intValue())) { + _msg=checkIp(prop, prop.getProperty("client_ip"), srcIp, prop.getProperty("server_ip"), destIp, ipType, ipPattern); if(StringUtils.isNotBlank(_msg)){ errInfo.append(_msg); } @@ -833,14 +829,12 @@ public class BaseController { //server_ip check end //port_pattern check start Integer portPattern=value.getPortPattern(); - String portPatternString=null; if(portPattern==null){ errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("port_pattern"))+";"); }else{ boolean has=false; for(SysDataDictionaryItem portPatternItem:portPatternList){ if(portPattern==Integer.parseInt(portPatternItem.getItemCode())){ - portPatternString=portPatternItem.getItemValue(); has=true; break; } @@ -853,9 +847,9 @@ public class BaseController { //src_port check start String srcPort=value.getSrcPort(); if("ipmulitiplex".equals(specialItem)) { - _msg=checkPort(prop,prop.getProperty("port"), srcPort, portPatternString); + _msg=checkPort(prop,prop.getProperty("port"), srcPort, portPattern); }else { - _msg=checkPort(prop,prop.getProperty("client_port"), srcPort, portPatternString); + _msg=checkPort(prop,prop.getProperty("client_port"), srcPort, portPattern); } if(StringUtils.isNotBlank(_msg)){ @@ -866,14 +860,14 @@ public class BaseController { String destPort=value.getDestPort(); if("ipmulitiplex".equals(specialItem)) {//set 默认值 if(portPattern!=null) { - if("port_mask".equals(portPatternString)) { + if(2==portPattern.intValue()) { value.setDestPort(Constants.PORT_MASK_DEFAULT); - }else if("port".equals(portPatternString)) { + }else if(1==portPattern.intValue()) { value.setDestPort(Constants.PORT_DEFAULT); } } }else { - _msg=checkPort(prop,prop.getProperty("server_port"), destPort, portPatternString); + _msg=checkPort(prop,prop.getProperty("server_port"), destPort, portPattern); } if(StringUtils.isNotBlank(_msg)){ errInfo.append(_msg); @@ -1144,10 +1138,72 @@ public class BaseController { } return msg.toString(); } - public static String checkIp(Properties prop,String srcIpName,String srcIp,String destIpName,String destIp,String ipType,String ipPattern) { + /** + * + * checkIP(IP格式验证) + * (这里描述这个方法适用条件 – 可选) + * @param ipName + * @param ip + * @param ipType + * @param ipPattern + * @return + *String + * @exception + * @since 1.0.0 + */ + public static String checkIP(Properties prop,String ipName,String ip,Integer ipType,Integer ipPattern){ StringBuffer msg=new StringBuffer(); - if("4over6".equals(ipType)){ - if("ip_subnet".equals(ipPattern)){ + if(StringUtils.isBlank(ip)){ + msg.append(String.format(prop.getProperty("can_not_null"), ipName)+";"); + }else{ + if(4==ipType.intValue()){ + if(1==ipPattern.intValue()){ + Pattern pattern=Pattern.compile(Constants.IPV4_IP_SUBNET_REGEXP); + Matcher matcher=pattern.matcher(ip); + if(!matcher.matches()){//完全匹配 + msg.append(String.format(prop.getProperty("is_in_wrong_format"), ipName)+";"); + } + }else if(2==ipPattern.intValue()){ + Pattern pattern=Pattern.compile(Constants.IPV4_IP_RANGE_REGEXP); + Matcher matcher=pattern.matcher(ip); + if(!matcher.matches()){//完全匹配 + msg.append(String.format(prop.getProperty("is_in_wrong_format"), ipName)+";"); + } + }else if(3==ipPattern.intValue()){ + Pattern pattern=Pattern.compile(Constants.IPV4_IP_REGEXP); + Matcher matcher=pattern.matcher(ip); + if(!matcher.matches()){//完全匹配 + msg.append(String.format(prop.getProperty("is_in_wrong_format"), ipName)+";"); + } + } + }else if(6==ipType.intValue()){ + if(1==ipPattern.intValue()){ + Pattern pattern=Pattern.compile(Constants.IPV6_IP_SUBNET_REGEXP); + Matcher matcher=pattern.matcher(ip); + if(!matcher.matches()){//完全匹配 + msg.append(String.format(prop.getProperty("is_in_wrong_format"), ipName)+";"); + } + }else if(2==ipPattern.intValue()){ + Pattern pattern=Pattern.compile(Constants.IPV6_IP_RANGE_REGEXP); + Matcher matcher=pattern.matcher(ip); + if(!matcher.matches()){//完全匹配 + msg.append(String.format(prop.getProperty("is_in_wrong_format"), ipName)+";"); + } + }else if(3==ipPattern.intValue()){ + Pattern pattern=Pattern.compile(Constants.IPV6_IP_REGEXP); + Matcher matcher=pattern.matcher(ip); + if(!matcher.matches()){//完全匹配 + msg.append(String.format(prop.getProperty("is_in_wrong_format"), ipName)+";"); + } + } + } + } + return msg.toString(); + } + public static String checkIp(Properties prop,String srcIpName,String srcIp,String destIpName,String destIp,Integer ipType,Integer ipPattern) { + StringBuffer msg=new StringBuffer(); + if(46==ipType.intValue()){ + if(1==ipPattern.intValue()){ Pattern patternV4=Pattern.compile(Constants.IPV4_IP_SUBNET_REGEXP); Pattern patternV6=Pattern.compile(Constants.IPV6_IP_SUBNET_REGEXP); Matcher matcherV4=patternV4.matcher(srcIp); @@ -1158,7 +1214,7 @@ public class BaseController { if(!matcherV6.matches()){//完全匹配 msg.append(String.format(prop.getProperty("is_in_wrong_format"), destIpName)+";"); } - }else if("ip_range".equals(ipPattern)){ + }else if(2==ipPattern.intValue()){ Pattern patternV4=Pattern.compile(Constants.IPV4_IP_RANGE_REGEXP); Pattern patternV6=Pattern.compile(Constants.IPV6_IP_RANGE_REGEXP); Matcher matcherV4=patternV4.matcher(srcIp); @@ -1169,7 +1225,7 @@ public class BaseController { if(!matcherV6.matches()){//完全匹配 msg.append(String.format(prop.getProperty("is_in_wrong_format"), destIpName)+";"); } - }else if("ip".equals(ipPattern)){ + }else if(3==ipPattern.intValue()){ Pattern patternV4=Pattern.compile(Constants.IPV4_IP_REGEXP); Pattern patternV6=Pattern.compile(Constants.IPV6_IP_REGEXP); Matcher matcherV4=patternV4.matcher(srcIp); @@ -1181,8 +1237,8 @@ public class BaseController { msg.append(String.format(prop.getProperty("is_in_wrong_format"), destIpName)+";"); } } - }else if("6over4".equals(ipType)) { - if("ip_subnet".equals(ipPattern)){ + }else if(64==ipType.intValue()) { + if(1==ipPattern.intValue()){ Pattern patternV4=Pattern.compile(Constants.IPV4_IP_SUBNET_REGEXP); Pattern patternV6=Pattern.compile(Constants.IPV6_IP_SUBNET_REGEXP); Matcher matcherV4=patternV4.matcher(destIp); @@ -1193,7 +1249,7 @@ public class BaseController { if(!matcherV6.matches()){//完全匹配 msg.append(String.format(prop.getProperty("is_in_wrong_format"), srcIpName)+";"); } - }else if("ip_range".equals(ipPattern)){ + }else if(2==ipPattern.intValue()){ Pattern patternV4=Pattern.compile(Constants.IPV4_IP_RANGE_REGEXP); Pattern patternV6=Pattern.compile(Constants.IPV6_IP_RANGE_REGEXP); Matcher matcherV4=patternV4.matcher(destIp); @@ -1204,7 +1260,7 @@ public class BaseController { if(!matcherV6.matches()){//完全匹配 msg.append(String.format(prop.getProperty("is_in_wrong_format"), srcIpName )+";"); } - }else if("ip".equals(ipPattern)){ + }else if(3==ipPattern.intValue()){ Pattern patternV4=Pattern.compile(Constants.IPV4_IP_REGEXP); Pattern patternV6=Pattern.compile(Constants.IPV6_IP_REGEXP); Matcher matcherV4=patternV4.matcher(destIp); @@ -1216,8 +1272,8 @@ public class BaseController { msg.append(String.format(prop.getProperty("is_in_wrong_format"), srcIpName)+";"); } } - }else if("all".equals(ipType)) { - if("ip_subnet".equals(ipPattern)){ + }else if(10==ipType.intValue()) { + if(1==ipPattern.intValue()){ Pattern patternV4=Pattern.compile(Constants.IPV4_IP_SUBNET_REGEXP); Pattern patternV6=Pattern.compile(Constants.IPV6_IP_SUBNET_REGEXP); Matcher matcherSrcIpV4=patternV4.matcher(srcIp); @@ -1230,7 +1286,7 @@ public class BaseController { if(!matcherDestIpV4.matches()&&!matcherDestIpV6.matches()){//完全匹配 msg.append(String.format(prop.getProperty("is_in_wrong_format"), destIpName)+";"); } - }else if("ip_range".equals(ipPattern)){ + }else if(2==ipPattern.intValue()){ Pattern patternV4=Pattern.compile(Constants.IPV4_IP_RANGE_REGEXP); Pattern patternV6=Pattern.compile(Constants.IPV6_IP_RANGE_REGEXP); Matcher matcherSrcIpV4=patternV4.matcher(srcIp); @@ -1243,7 +1299,7 @@ public class BaseController { if(!matcherDestIpV4.matches()&&!matcherDestIpV6.matches()){//完全匹配 msg.append(String.format(prop.getProperty("is_in_wrong_format"), destIpName)+";"); } - }else if("ip".equals(ipPattern)){ + }else if(3==ipPattern.intValue()){ Pattern patternV4=Pattern.compile(Constants.IPV4_IP_REGEXP); Pattern patternV6=Pattern.compile(Constants.IPV6_IP_REGEXP); Matcher matcherSrcIpV4=patternV4.matcher(srcIp); @@ -1260,12 +1316,12 @@ public class BaseController { } return msg.toString(); } - public static String checkPort(Properties prop,String portName,String port,String portPattern){ + public static String checkPort(Properties prop,String portName,String port,Integer portPattern){ StringBuffer msg=new StringBuffer(); if(StringUtils.isBlank(port)){ msg.append(String.format(prop.getProperty("can_not_null"), portName)+";"); }else{ - if("port".equals(portPattern)){ + if(1==portPattern.intValue()){ try{ Integer portInt=Integer.parseInt(port); if(portInt<0||portInt>65535){ @@ -1275,7 +1331,7 @@ public class BaseController { // TODO: handle exception msg.append(String.format(prop.getProperty("not_number"), portName)+";"); } - }else if("port_mask".equals(portPattern)){ + }else if(2==portPattern.intValue()){ if(port.indexOf("/")==-1){ msg.append(String.format(prop.getProperty("is_in_wrong_format"), portName)+";"); }else{ From fc2e0443fec211a0028e3be5a5f8621191b13627 Mon Sep 17 00:00:00 2001 From: zhanghongqing Date: Mon, 20 Aug 2018 19:58:50 +0800 Subject: [PATCH 07/23] =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E6=97=A5=E5=BF=97=E9=BB=98=E8=AE=A4=E5=80=BC?= =?UTF-8?q?=E5=90=8Cmatt=E9=BB=98=E8=AE=A4=E5=80=BC=EF=BC=8C=E9=98=B2?= =?UTF-8?q?=E6=AD=A2=E5=AE=A1=E6=A0=B8=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/nis/domain/configuration/BaseCfg.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/nis/domain/configuration/BaseCfg.java b/src/main/java/com/nis/domain/configuration/BaseCfg.java index 0973d2c01..8eae2e6f8 100644 --- a/src/main/java/com/nis/domain/configuration/BaseCfg.java +++ b/src/main/java/com/nis/domain/configuration/BaseCfg.java @@ -15,6 +15,7 @@ import com.fasterxml.jackson.annotation.JsonFormat; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; import com.nis.domain.BaseEntity; +import com.nis.util.Constants; import com.nis.util.excel.ExcelField; /** @@ -199,7 +200,7 @@ public class BaseCfg extends BaseEntity implements Cloneable{ /** * do_log属性在界面(do_log:0不需要1记录所有日志2只记录结构化日志。默认是2) */ - protected Integer doLog; + protected Integer doLog = Constants.MAAT_CFG_DOLOG_DEFAULT; public Integer getDoLog() { From 82b63a2ba7db5c35e624229c8d42f3638fa56603 Mon Sep 17 00:00:00 2001 From: wangxin Date: Mon, 20 Aug 2018 20:07:26 +0800 Subject: [PATCH 08/23] =?UTF-8?q?ip=E9=83=A8=E5=88=86=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=BA=E6=A0=B9=E6=8D=AE=E5=85=AC=E5=85=B1?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../configuration/ntc/IpController.java | 10 +- .../sql/update_function_region_dict_data.sql | 14 + .../webapp/WEB-INF/include/excel/importIp.jsp | 2 +- .../webapp/WEB-INF/include/form/areaInfo.jsp | 2 +- .../webapp/WEB-INF/include/form/ipInfo.jsp | 61 +--- .../WEB-INF/views/cfg/common/ipForm.jsp | 160 +++------ .../webapp/static/global/scripts/common.js | 327 +++++++++++++++++- 7 files changed, 406 insertions(+), 170 deletions(-) create mode 100644 src/main/resources/sql/update_function_region_dict_data.sql diff --git a/src/main/java/com/nis/web/controller/configuration/ntc/IpController.java b/src/main/java/com/nis/web/controller/configuration/ntc/IpController.java index 7bd3a945d..d5696f3ac 100644 --- a/src/main/java/com/nis/web/controller/configuration/ntc/IpController.java +++ b/src/main/java/com/nis/web/controller/configuration/ntc/IpController.java @@ -56,11 +56,11 @@ public class IpController extends CommonController{ model.addAttribute("dropAction",Constants.DROP_ACTION); model.addAttribute("urlPrefix","/ntc/iplist"); model.addAttribute("requiresPermissionPrefix","iplist"); - if(specialFunctionId!=null && "ipsec".equals(specialFunctionId)) { - return "/cfg/ipsec/ipForm"; - }else if(specialFunctionId!=null && "ipaddr".equals(specialFunctionId)) { - return "/cfg/ipaddr/ipForm"; - } +// if(specialFunctionId!=null && "ipsec".equals(specialFunctionId)) { +// return "/cfg/ipsec/ipForm"; +// }else if(specialFunctionId!=null && "ipaddr".equals(specialFunctionId)) { +// return "/cfg/ipaddr/ipForm"; +// } return "/cfg/common/ipForm"; } @RequestMapping(value = {"saveOrUpdate"}) diff --git a/src/main/resources/sql/update_function_region_dict_data.sql b/src/main/resources/sql/update_function_region_dict_data.sql new file mode 100644 index 000000000..bb874c7af --- /dev/null +++ b/src/main/resources/sql/update_function_region_dict_data.sql @@ -0,0 +1,14 @@ +#ip地址 +UPDATE function_service_dict SET region_code=1 WHERE function_id=5 AND ACTION IN(16,1); +UPDATE function_service_dict SET region_code=2 WHERE function_id=5 AND ACTION IN(32,96); +UPDATE function_region_dict SET config_ip_port_show='1,2' ,config_ip_type='4,6,46,64,10',config_ip_pattern='1,2,3',config_port_pattern='1,2',config_direction='0,1',config_protocol='0,6,17' WHERE dict_id=27; +UPDATE function_region_dict SET config_service_type='ipaddr',config_ip_port_show='1,2' ,config_ip_type='4,6,46,64,10',config_ip_pattern='1,2,3',config_port_pattern='1,2',config_direction='0,1',config_protocol='0,6,17,1' WHERE dict_id=35; +#ip限流 +UPDATE function_service_dict SET region_code=1 WHERE function_id=302 AND ACTION IN(64); +UPDATE function_region_dict SET config_service_type='ratelimit',config_ip_port_show='1,2' ,config_ip_type='4,6,46,64,10',config_ip_pattern='1,2,3',config_port_pattern='1,2',config_direction='0,1',config_protocol='0,6,17' WHERE dict_id=67; +#IP复用策略 +UPDATE function_service_dict SET region_code=1 WHERE function_id=300 AND ACTION IN(96); +UPDATE function_region_dict SET config_service_type='ipmulitiplex',config_ip_port_show='1' ,config_ip_type='4,6',config_ip_pattern='1,2,3',config_port_pattern='1,2',config_direction='0,1',config_protocol='0,6,17' WHERE dict_id=68; +#IP拦截 +UPDATE function_service_dict SET region_code=1 WHERE function_id=200 AND ACTION IN(1,128,64,80); +UPDATE function_region_dict SET config_service_type='ratelimit',config_ip_port_show='1,2' ,config_ip_type='4,6,46,64,10',config_ip_pattern='1,2,3',config_port_pattern='1,2',config_direction='0,1',config_protocol='0,6,17' WHERE dict_id=53; \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/include/excel/importIp.jsp b/src/main/webapp/WEB-INF/include/excel/importIp.jsp index d14bb3fe1..d3ced21e2 100644 --- a/src/main/webapp/WEB-INF/include/excel/importIp.jsp +++ b/src/main/webapp/WEB-INF/include/excel/importIp.jsp @@ -2,7 +2,7 @@ <%@ include file="/WEB-INF/include/taglib.jsp"%>