diff --git a/src/main/java/com/nis/domain/restful/NtcPzReport.java b/src/main/java/com/nis/domain/restful/NtcPzReport.java index c593f61..115bedc 100644 --- a/src/main/java/com/nis/domain/restful/NtcPzReport.java +++ b/src/main/java/com/nis/domain/restful/NtcPzReport.java @@ -1,67 +1,16 @@ package com.nis.domain.restful; -import java.io.Serializable; -import java.util.Date; -import java.util.Map; - -import javax.xml.bind.annotation.XmlTransient; - import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.google.common.collect.Maps; -import com.nis.domain.Page; -import com.nis.util.JsonDateSerializer; import com.wordnik.swagger.annotations.ApiModelProperty; -public class NtcPzReport implements Serializable{ +public class NtcPzReport extends NtcReportEntity{ private static final long serialVersionUID = 987165268916441272L; @ApiModelProperty(value="配置ID", required=true) protected Long cfgId; - @ApiModelProperty(value="业务类型", required=true) - protected Integer service; - @ApiModelProperty(value="日志数量", required=true) - protected Long sum; - @ApiModelProperty(value="统计时间", required=true) - protected Date reportTime; - /** - * 业务类型:1:配置命中总量业务 2:配置报表业务 - */ - protected String searchBusinessType = "1"; - protected String searchReportStartTime; - protected String searchReportEndTime; - protected Long searchReportStartTimeCluster; - protected Long searchReportEndTimeCluster; - protected String searchService; protected String searchCfgId; - protected Page page; - - /** - * 自定义SQL(SQL标识,SQL内容) - */ - protected Map sqlMap; - - /** - * - */ - public NtcPzReport() { - super(); - // TODO Auto-generated constructor stub - } - - /** - * @param cfgId - * @param service - */ - public NtcPzReport(Long cfgId, Long sum) { - super(); - this.cfgId = cfgId; - this.sum = sum; - } - - public Long getCfgId() { return cfgId; } @@ -70,78 +19,6 @@ public class NtcPzReport implements Serializable{ this.cfgId = cfgId; } - public Integer getService() { - return service; - } - - public void setService(Integer service) { - this.service = service; - } - - public Long getSum() { - return sum; - } - - public void setSum(Long sum) { - this.sum = sum; - } - - @JsonSerialize(using=JsonDateSerializer.class) - public Date getReportTime() { - return reportTime; - } - - public void setReportTime(Date reportTime) { - this.reportTime = reportTime; - } - @JsonIgnore - public String getSearchBusinessType() { - return searchBusinessType; - } - - public void setSearchBusinessType(String searchBusinessType) { - this.searchBusinessType = searchBusinessType; - } - @JsonIgnore - public String getSearchReportStartTime() { - return searchReportStartTime; - } - - public void setSearchReportStartTime(String searchReportStartTime) { - this.searchReportStartTime = searchReportStartTime; - } - @JsonIgnore - public String getSearchReportEndTime() { - return searchReportEndTime; - } - - public void setSearchReportEndTime(String searchReportEndTime) { - this.searchReportEndTime = searchReportEndTime; - } - @JsonIgnore - public Long getSearchReportStartTimeCluster() { - return searchReportStartTimeCluster; - } - - public void setSearchReportStartTimeCluster(Long searchReportStartTimeCluster) { - this.searchReportStartTimeCluster = searchReportStartTimeCluster; - } - @JsonIgnore - public Long getSearchReportEndTimeCluster() { - return searchReportEndTimeCluster; - } - - public void setSearchReportEndTimeCluster(Long searchReportEndTimeCluster) { - this.searchReportEndTimeCluster = searchReportEndTimeCluster; - } - @JsonIgnore - public String getSearchService() { - return searchService; - } - - public void setSearchService(String searchService) { - this.searchService = searchService; - } @JsonIgnore public String getSearchCfgId() { return searchCfgId; @@ -150,31 +27,4 @@ public class NtcPzReport implements Serializable{ public void setSearchCfgId(String searchCfgId) { this.searchCfgId = searchCfgId; } - - @JsonIgnore - @XmlTransient - public Page getPage() { - if (page == null){ - page = new Page(); - } - return page; - } - - public Page setPage(Page page) { - this.page = page; - return page; - } - - @JsonIgnore - @XmlTransient - public Map getSqlMap() { - if (sqlMap == null){ - sqlMap = Maps.newHashMap(); - } - return sqlMap; - } - - public void setSqlMap(Map sqlMap) { - this.sqlMap = sqlMap; - } } diff --git a/src/main/java/com/nis/domain/restful/NtcReportEntity.java b/src/main/java/com/nis/domain/restful/NtcReportEntity.java new file mode 100644 index 0000000..fa1dce0 --- /dev/null +++ b/src/main/java/com/nis/domain/restful/NtcReportEntity.java @@ -0,0 +1,160 @@ +package com.nis.domain.restful; + +import java.io.Serializable; +import java.util.Date; +import java.util.Map; + +import javax.xml.bind.annotation.XmlTransient; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.google.common.collect.Maps; +import com.nis.domain.Page; +import com.nis.util.JsonDateSerializer; +import com.wordnik.swagger.annotations.ApiModelProperty; + +public abstract class NtcReportEntity implements Serializable{ + + @ApiModelProperty(value="业务类型", required=true) + protected Integer service; + @ApiModelProperty(value="日志数量", required=true) + protected Long sum; + @ApiModelProperty(value="统计时间", required=true) + protected Date reportTime; + + /** + * 业务类型:1:配置命中总量业务 2:配置报表业务 + */ + protected String searchBusinessType = "1"; + protected String searchReportStartTime; + protected String searchReportEndTime; + protected Long searchReportStartTimeCluster; + protected Long searchReportEndTimeCluster; + protected String searchService; + + protected Page page; + + /** + * 自定义SQL(SQL标识,SQL内容) + */ + protected Map sqlMap; + + /** + * + */ + public NtcReportEntity() { + super(); + // TODO Auto-generated constructor stub + } + + /** + * @param cfgId + * @param service + */ + public NtcReportEntity(Long cfgId, Long sum) { + super(); + this.sum = sum; + } + + public Integer getService() { + return service; + } + + public void setService(Integer service) { + this.service = service; + } + + public Long getSum() { + return sum; + } + + public void setSum(Long sum) { + this.sum = sum; + } + + @JsonSerialize(using=JsonDateSerializer.class) + public Date getReportTime() { + return reportTime; + } + + public void setReportTime(Date reportTime) { + this.reportTime = reportTime; + } + @JsonIgnore + public String getSearchBusinessType() { + return searchBusinessType; + } + + public void setSearchBusinessType(String searchBusinessType) { + this.searchBusinessType = searchBusinessType; + } + @JsonIgnore + public String getSearchReportStartTime() { + return searchReportStartTime; + } + + public void setSearchReportStartTime(String searchReportStartTime) { + this.searchReportStartTime = searchReportStartTime; + } + @JsonIgnore + public String getSearchReportEndTime() { + return searchReportEndTime; + } + + public void setSearchReportEndTime(String searchReportEndTime) { + this.searchReportEndTime = searchReportEndTime; + } + @JsonIgnore + public Long getSearchReportStartTimeCluster() { + return searchReportStartTimeCluster; + } + + public void setSearchReportStartTimeCluster(Long searchReportStartTimeCluster) { + this.searchReportStartTimeCluster = searchReportStartTimeCluster; + } + @JsonIgnore + public Long getSearchReportEndTimeCluster() { + return searchReportEndTimeCluster; + } + + public void setSearchReportEndTimeCluster(Long searchReportEndTimeCluster) { + this.searchReportEndTimeCluster = searchReportEndTimeCluster; + } + @JsonIgnore + public String getSearchService() { + return searchService; + } + + public void setSearchService(String searchService) { + this.searchService = searchService; + } + + @JsonIgnore + @XmlTransient + public Page getPage() { + if (page == null){ + page = new Page(); + } + return page; + } + + public Page setPage(Page page) { + this.page = page; + return page; + } + + @JsonIgnore + @XmlTransient + public Map getSqlMap() { + if (sqlMap == null){ + sqlMap = Maps.newHashMap(); + } + return sqlMap; + } + + public void setSqlMap(Map sqlMap) { + this.sqlMap = sqlMap; + } + + +} diff --git a/src/main/java/com/nis/util/Constants.java b/src/main/java/com/nis/util/Constants.java index 84ff63c..f1b434a 100644 --- a/src/main/java/com/nis/util/Constants.java +++ b/src/main/java/com/nis/util/Constants.java @@ -157,6 +157,10 @@ public final class Constants { */ public static final Long REPORT_LOCAL_TIME = Configurations.getLongProperty("reportLocalTime", 1); + /** + * 实时报表统计默认时间,单位分钟 + */ + public static final Long PZ_REPORT_TIME = Configurations.getLongProperty("pzReportTime", 5); /** * 日志是否从hive中查询 */ diff --git a/src/main/java/com/nis/util/DateUtils.java b/src/main/java/com/nis/util/DateUtils.java index ccdb286..701fc88 100644 --- a/src/main/java/com/nis/util/DateUtils.java +++ b/src/main/java/com/nis/util/DateUtils.java @@ -222,6 +222,20 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils { return timeMap; } + //实时报表统计,默认查询最近5分钟 + if("minute".equals(type) && startTime == null && endTime == null){ + Calendar cal=Calendar.getInstance(); + timeMap.put("startTime", sdf.format(cal.getTime())); + if(localLen != null){ + cal.add(Calendar.MINUTE, -localLen.intValue()); + }else{ + cal.add(Calendar.MINUTE, -5); + } + timeMap.put("endTime", sdf.format(cal.getTime())); + logger.info("实时报表统计默认开始时间条件:"+timeMap.get("startTime")); + logger.info("默认结束时间条件:"+timeMap.get("endTime")); + return timeMap; + } if(startTime == null && endTime == null && localLen != null){ Calendar cal=Calendar.getInstance(); cal.add(Calendar.HOUR, -localLen.intValue()); diff --git a/src/main/java/com/nis/web/controller/restful/LogController.java b/src/main/java/com/nis/web/controller/restful/LogController.java index 196ae62..eadf2d9 100644 --- a/src/main/java/com/nis/web/controller/restful/LogController.java +++ b/src/main/java/com/nis/web/controller/restful/LogController.java @@ -30,6 +30,7 @@ import com.nis.domain.restful.NtcMailLog; import com.nis.domain.restful.NtcOpenvpnLog; import com.nis.domain.restful.NtcPptpLog; import com.nis.domain.restful.NtcPzReport; +import com.nis.domain.restful.NtcReportEntity; import com.nis.domain.restful.NtcSshLog; import com.nis.domain.restful.NtcSslLog; import com.nis.restful.RestServiceException; @@ -43,6 +44,7 @@ import com.nis.web.service.HiveSqlService; import com.nis.web.service.SaveRequestLogThread; import com.nis.web.service.ServicesRequestLogService; import com.nis.web.service.restful.LogTestService; +import com.nis.web.service.restful.NtcReportService; import com.wordnik.swagger.annotations.Api; import com.wordnik.swagger.annotations.ApiOperation; @@ -63,6 +65,9 @@ public class LogController extends BaseRestController { public LogTestService testService; @Autowired protected ServicesRequestLogService servicesRequestLogService; + + @Autowired + protected NtcReportService ntcReportService; @RequestMapping(value = "/ntcIpLogs", method = RequestMethod.GET) @ApiOperation(value = "IP地址日志查询", httpMethod = "GET", notes = "对应配置为IP地址管理,存储动作为阻断与监测的命中日志。对日志功能IP地址提供数据基础查询服务") @@ -842,28 +847,60 @@ public class LogController extends BaseRestController { return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "DDos日志检索成功", ntcDdosLogPage, 0); } + @RequestMapping(value = "/ntcPzReport", method = RequestMethod.GET) @ApiOperation(value = "配置日志总量统计", httpMethod = "GET", notes = "配置命中日志数量实时统计报表,对外提供多种数据表现形式,具体可应用于界面配置命中总量业务、配置报表业务等") public Map ntcPzReport(Page page, NtcPzReport ntcPzReport, Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); - SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, + SaveRequestLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); Page ntcPzReportPage = null; try { - ntcPzReportPage = testService.findNtcPzReport(new Page(request, response, NtcPzReport.class), + resetReportTime(ntcPzReport); + //验证实时报表 + ntcReportService.queryReportConditionCheck(saveLogThread, start, ntcPzReport, NtcDdosLog.class, page); + //验证serachCfgId + ntcReportService.checkNumericCondition(saveLogThread,start,ntcPzReport.getSearchCfgId(),"searchCfgId"); + String orderBy = ""; + if (null != page.getOrderBy() && !page.getOrderBy().equals("")) { + orderBy = Page.getOrderBySql(NtcPzReport.class.getSimpleName(), page.getOrderBy()); + } else { + orderBy = "report_time"; + } + page.setOrderBy(orderBy); + ntcPzReportPage = ntcReportService.findNtcPzReport(new Page(request, response, NtcPzReport.class), ntcPzReport); } catch (Exception e) { + saveLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause()); e.printStackTrace(); + logger.error(e.getMessage()); + if (!(e instanceof RestServiceException)) { + e = new RestServiceException(saveLogThread, System.currentTimeMillis() - start, "配置日志总量统计失败"); + } + throw ((RestServiceException) e); } - return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "配置总量统计成功", + return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "配置日志总量统计成功", ntcPzReportPage, 0); } - + /** + * @Description: + * @author (zdx) + * @date 2018年7月12日 上午11:01:30 + * @param entity + * @throws Exception + */ + public void resetReportTime(NtcReportEntity entity) throws Exception { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Map map = DateUtils.getLocalTime(entity.getSearchReportStartTime(), + entity.getSearchReportEndTime(), Constants.PZ_REPORT_TIME, "minute"); + entity.setSearchReportStartTime(map.get("startTime")); + entity.setSearchReportEndTime(map.get("endTime")); + } /** diff --git a/src/main/java/com/nis/web/dao/NtcReportDao.java b/src/main/java/com/nis/web/dao/NtcReportDao.java new file mode 100644 index 0000000..ccf6481 --- /dev/null +++ b/src/main/java/com/nis/web/dao/NtcReportDao.java @@ -0,0 +1,20 @@ +package com.nis.web.dao; + +import java.util.List; + +import com.nis.domain.DfReportEntity; +import com.nis.domain.restful.NtcPzReport; + +/** + * + * @ClassName:NtcReportDao + * @Description:TODO(这里用一句话描述这个类的作用) + * @author (zdx) + * @date 2018年7月11日 下午5:47:55 + * @version V1.0 + */ +@MyBatisDao +public interface NtcReportDao extends CrudDao { + List findNtcPzReport(NtcPzReport pz); + +} diff --git a/src/main/java/com/nis/web/dao/NtcReportDao.xml b/src/main/java/com/nis/web/dao/NtcReportDao.xml new file mode 100644 index 0000000..715e854 --- /dev/null +++ b/src/main/java/com/nis/web/dao/NtcReportDao.xml @@ -0,0 +1,60 @@ + + + + + + + + + + + SERVICE,SUM,REPORT_TIME + + + + + + \ No newline at end of file diff --git a/src/main/java/com/nis/web/service/BaseLogService.java b/src/main/java/com/nis/web/service/BaseLogService.java index 2d871eb..9d3a2eb 100644 --- a/src/main/java/com/nis/web/service/BaseLogService.java +++ b/src/main/java/com/nis/web/service/BaseLogService.java @@ -22,6 +22,7 @@ import com.nis.domain.DfReportEntity; import com.nis.domain.LogEntity; import com.nis.domain.Page; import com.nis.domain.StatLogEntity; +import com.nis.domain.restful.NtcReportEntity; import com.nis.restful.RestBusinessCode; import com.nis.restful.RestServiceException; import com.nis.util.StringUtil; @@ -240,7 +241,105 @@ public abstract class BaseLogService { logger.info("请求参数校验结束----" + System.currentTimeMillis()); } + /** + * + * @Description: + * @author (zdx) + * @date 2018年7月12日 上午11:43:32 + * @param thread + * @param start + * @param entity + * @param clazz + * @param page + */ + public void queryReportConditionCheck(SaveRequestLogThread thread, long start, NtcReportEntity entity, Class clazz, + Page page) { + logger.info("实时报表统计查询参数校验开始----" + System.currentTimeMillis()); + if (!StringUtil.isBlank(entity.getSearchBusinessType())&&!StringUtil.isNumeric(entity.getSearchBusinessType())) { + logger.error(RestBusinessCode.param_formate_error.getErrorReason()+",searchBusinessType参数格式错误"); + thread.setExceptionInfo("searchBusinessType参数格式错误"); + throw new RestServiceException(thread, + System.currentTimeMillis() - start, + "searchBusinessType参数格式错误", + RestBusinessCode.param_formate_error.getValue()); + } + //searchService + checkNumericCondition(thread, start, entity.getSearchService(), "searchService"); + + try { + if (!StringUtil.isBlank(entity.getSearchReportStartTime())) { + sdf.parse(entity.getSearchReportStartTime()); + } + } catch (ParseException e) { + thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); + logger.error(e); + throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchReportStartTime参数格式错误", + RestBusinessCode.param_formate_error.getValue()); + } catch (Exception e) { + thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); + logger.error(e); + throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchReportStartTime参数错误"); + } + + try { + if (!StringUtil.isBlank(entity.getSearchReportEndTime())) { + sdf.parse(entity.getSearchReportEndTime()); + } + } catch (ParseException e) { + thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); + logger.error(e); + throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchReportEndTime参数格式错误", + RestBusinessCode.param_formate_error.getValue()); + } catch (Exception e) { + thread.setExceptionInfo(e.getMessage() + " " + e.getCause()); + logger.error(e); + throw new RestServiceException(thread, System.currentTimeMillis() - start, "searchReportEndTime参数错误"); + } + if (!StringUtil.isBlank(entity.getSearchBusinessType())&&!StringUtil.isNumeric(entity.getSearchBusinessType())) { + logger.error(RestBusinessCode.param_formate_error.getErrorReason()+",searchBusinessType参数格式错误"); + thread.setExceptionInfo("searchBusinessType参数格式错误"); + throw new RestServiceException(thread, + System.currentTimeMillis() - start, + "searchBusinessType参数格式错误", + RestBusinessCode.param_formate_error.getValue()); + } + + logger.info("实时报表统计查询参数校验结束----" + System.currentTimeMillis()); + } + /** + * @Description:用于验证数值类型格式,多个值以","分隔 + * @author (zdx) + * @date 2018年7月12日 下午12:47:35 + * @param thread + * @param start + * @param condition + * @param condName + */ + public void checkNumericCondition(SaveRequestLogThread thread, long start,String condition,String condName) { + if (!StringUtil.isEmpty(condition)){ + Boolean flag = false; + if (condition.contains(",")) { + String services[] =condition.split(","); + for (String service : services) { + if(!StringUtil.isNumeric(service)) { + flag = true; + break; + } + } + }else if(!StringUtil.isNumeric(condition)) { + flag = true; + } + if (flag) { + logger.error(RestBusinessCode.param_formate_error.getErrorReason()+","+condName+"参数格式错误"); + thread.setExceptionInfo(condName+"参数格式错误"); + throw new RestServiceException(thread, + System.currentTimeMillis() - start, + condName+"参数格式错误", + RestBusinessCode.param_formate_error.getValue()); + } + } + } /** * wx 报表查询条件检查 * diff --git a/src/main/java/com/nis/web/service/restful/NtcReportService.java b/src/main/java/com/nis/web/service/restful/NtcReportService.java new file mode 100644 index 0000000..bea1546 --- /dev/null +++ b/src/main/java/com/nis/web/service/restful/NtcReportService.java @@ -0,0 +1,53 @@ +package com.nis.web.service.restful; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.nis.domain.Page; +import com.nis.domain.restful.NtcPzReport; +import com.nis.web.dao.NtcReportDao; +import com.nis.web.service.BaseLogService; + +/** + * @Description:TODO(这里用一句话描述这个类的作用) + * @author (zdx) + * @date 2018年7月10日 上午9:47:39 + * @version V1.0 + */ +@Service +public class NtcReportService extends BaseLogService { + + @Autowired + protected NtcReportDao dao; + + public Page findNtcPzReport(Page page, NtcPzReport entity) + throws Exception { + page.setList(dao.findNtcPzReport(entity)); + if ("1".equals(entity.getSearchBusinessType())) { + Page pageTotal = new Page(); + pageTotal.setPageNo(page.getPageNo()); + pageTotal.setPageSize(page.getPageSize()); + List restList = new ArrayList(); + List list = page.getList(); + for (NtcPzReport ntcPzReport : list) { + Map restMap = new HashMap(); + restMap.put("cfgId", ntcPzReport.getCfgId()); + restMap.put("sum", ntcPzReport.getSum()); + restList.add(restMap); + } + pageTotal.setCount(restList.size()); + pageTotal.setList(restList); + return pageTotal; + } else if ("2".equals(entity.getSearchBusinessType())) { + return page; + } + return null; + + } + +} diff --git a/src/main/resources/maatXml/maat.xml b/src/main/resources/maatXml/maat.xml index 36920e8..0d36516 100644 --- a/src/main/resources/maatXml/maat.xml +++ b/src/main/resources/maatXml/maat.xml @@ -15,7 +15,7 @@ EFFECTIVE_RULE;:;{un_maat_table_name};,;[cfg_id] - [cfg_id];\t;[is_valid];\t;[dst_file];\t;[dst_file_md5];\t;[op_time]; [level];\t;[file_id];\n + [cfg_id];\t;[service];\t;[action];\t;[level];\t;[dst_file];\t;[dst_file_md5];\t;[is_valid];\t;[op_time]; [file_id];\n 1 @@ -41,7 +41,7 @@ EFFECTIVE_RULE;:;{un_maat_table_name};,;[cfg_id] - [cfg_id];\t;[service];\t;[level];\t;[description];\t;[is_valid];\n + [cfg_id];\t;[service];\t;[action];\t;[level];\t;[description];\t;[is_valid];\n 1 @@ -63,12 +63,13 @@ #0x04 IP地址丢弃 4=0:INLINE_IP_CB #0x19 IPSec丢弃 25=0:INLINE_IP_CB #0x1C GRE 丢弃 28=0:INLINE_IP_CB - #0x1D IPSEC丢弃 29=0:INLINE_IP_CB + #0x1D IPSEC丢弃 29=0:INLINE_IP_CB + #0x05 DDOS流量丢弃 5=0:DDOS_PROTECT_TARGET_IP_CB --> - + EFFECTIVE_RULE;:;{un_maat_table_name};,;[cfg_id] - [cfg_id];\t;[service];\t;[action];\t;[addr_type];\t;[src_ip];\t;[mask_src_ip];\t;[src_port];\t;[mask_src_port];\t;[dst_ip];\t;[mask_dst_ip];\t;[dst_port];\t;[mask_dst_port];\t;[protocol];\t;[direction];\t;[is_valid];\t;[op_time]; \n + [cfg_id];\t;[addr_type];\t;[src_ip];\t;[mask_src_ip];\t;[src_port];\t;[mask_src_port];\t;[dst_ip];\t;[mask_dst_ip];\t;[dst_port];\t;[mask_dst_port];\t;[protocol];\t;[direction];\t;[is_valid];\t;[action];\t;[service];\t;[op_time]; \n 1 @@ -86,13 +87,12 @@ - + EFFECTIVE_RULE;:;{un_maat_table_name};,;[cfg_id] - [cfg_id];\t;[service];\t;[action];\t;[policyGroup];\t;[addr_type];\t;[src_ip];\t;[mask_src_ip];\t;[src_port];\t;[mask_src_port];\t;[dst_ip];\t;[mask_dst_ip];\t;[dst_port];\t;[mask_dst_port];\t;[protocol];\t;[direction];\t;[is_valid];\t;[op_time]; \n + [cfg_id];\t;[policy_group];\t;[addr_type];\t;[src_ip];\t;[mask_src_ip];\t;[src_port];\t;[mask_src_port];\t;[dst_ip];\t;[mask_dst_ip];\t;[dst_port];\t;[mask_dst_port];\t;[protocol];\t;[direction];\t;[is_valid];\t;[op_time]; [service];\t;[action];\n 1 @@ -115,7 +115,7 @@ EFFECTIVE_RULE;:;{un_maat_table_name};,;[cfg_id] - [cfg_id];\t;[service];\t;[action];\t;[req_strate_id];\t;[strate_name];\t;[res_group_1_id];\t;[res_group_1_num];\t;[res_group_2_id];\t;[res_group_2_num];\t;[res_group_3_id];\t;[res_group_3_num];\t;[res_group_4_id];\t;[res_group_4_num];\t;[res_group_5_id];\t;[res_group_5_num];\t;[min_ttl];\t;[max_ttl];\t;[is_valid];\n + [cfg_id];\t;[req_strate_id];\t;[strate_name];\t;[res_group_1_id];\t;[res_group_1_num];\t;[res_group_2_id];\t;[res_group_2_num];\t;[res_group_3_id];\t;[res_group_3_num];\t;[res_group_4_id];\t;[res_group_4_num];\t;[res_group_5_id];\t;[res_group_5_num];\t;[min_ttl];\t;[max_ttl];\t;[is_valid];\t;[service];\t;[action];\n 1 @@ -138,7 +138,7 @@ EFFECTIVE_RULE;:;{un_maat_table_name};,;[cfg_id] - [cfg_id];\t;[service];\t;[action];\t;[policy_group];\t;[addr_type];\t;[ip];\t;[port];\t;[user_region];\t;[location];\t;[is_valid];\t;[op_time]; \n + [cfg_id];\t;[policy_group];\t;[addr_type];\t;[ip];\t;[port];\t;[user_region];\t;[location];\t;[is_valid];\t;[op_time]; [service];\t;[action];\n diff --git a/src/main/resources/nis.properties b/src/main/resources/nis.properties index e45d006..90b689b 100644 --- a/src/main/resources/nis.properties +++ b/src/main/resources/nis.properties @@ -206,6 +206,8 @@ serviceValidate=true logLocalTime=48 #\u5B9E\u65F6\u7EDF\u8BA1\u9ED8\u8BA4\u67E5\u8BE2\u672C\u5730\u4E00\u4E2A\u5C0F\u65F6\u7684\u6570\u636E(\u5355\u4F4D\uFF1A\u5C0F\u65F6) reportLocalTime=1 +#实时报表统计时间,单位:分钟 +pzReportTime=5 #\u795E\u901A\u6570\u636E\u5E93\u6700\u65E9\u65E5\u5FD7\u65F6\u95F4(A\u7248\u6BEB\u79D2) #2017-08-13 10:07:25 diff --git a/src/main/resources/serviceTable.properties b/src/main/resources/serviceTable.properties index dbd6ed2..f4c7075 100644 --- a/src/main/resources/serviceTable.properties +++ b/src/main/resources/serviceTable.properties @@ -226,12 +226,10 @@ unMaatService=3:32;4:96;5:32;25:32;28:32;29:32;64:16;65:16;261:16;262:16;263:16; ##MAAT配置 #0x01 全局IP白名单 1:2,3,4,6,7; #0x02 全局域名白名单 2:2,3,4,6,7; -#0x89 IPSec监测 137:2,7; -#0x8C GRE监测 140:2,7; +#0x21 APP阻断 33:2,6,7; #0x91 APP监测 145:2,6,7; #0x200 PXY拦截IP 512:4,7; #0x201 PXY拦截域名 513:4,2,7; -#0x21 APP阻断 33:2,6,7; #0x400 APP HTTP特征发现 1024:2,6,7; #0x402 APP DOMAIN特征发现 1026:2,6,7; #0x404 APP IP特征 1028:2,6,7; @@ -242,16 +240,27 @@ unMaatService=3:32;4:96;5:32;25:32;28:32;29:32;64:16;65:16;261:16;262:16;263:16; ##回调类配置 #0x03 IP地址丢弃 3:2,7; #0x04 IP地址回流 4:2,7; -#0x19 IPSec丢弃 25:2,7; #0x1C GRE 丢弃 28:2,7; +#0x19 IPSec丢弃 25:2,7; #0x340 IP复用地址池配置(回调)832:2,4,7 ########## -serviceDBIndex=1:2,3,4,6,7;2:2,3,4,6,7;16:2;17:2;18:2;19:2;20:2;21:2;22:2;23:2;24:2;26:2;27:2;30:2;31:2;32:2;33:2,6,7;34:2;128:2;129:2;130:2;131:2;132:2;133:2;134:2;135:2;136:2;137:2,7;138:2;139:2;140:2,7;141:2;143:2;144:2;145:2,6,7;256:3;257:3;258:3;259:3;260:3;384:3;385:3;386:3;387:3;388:3;512:4,7;513:4,2,7;528:4;529:4;544:4;545:4;560:4;561:4;768:4;848:2;1024:2,6,7;1025:2;1026:2,6,7;1027:2;1028:2,6,7;1040:2,6,7;1056:2,6,7;1057:6,7;1058:6,2,7;3:2,7;4:2,7;5:2;25:2,7;28:2,7;29:2;64:2;65:2;261:3;262:3;263:3;264:3;265:3;266:3;389:3;390:3;391:3;392:3;393:3;394:3;832:2,4,7 +serviceDBIndex=1:2,3,4,6,7;2:2,3,4,6,7;16:2;17:2;18:2;19:2;20:2;21:2;22:2;23:2;24:2;26:2;27:2;30:2;31:2;32:2;33:2,6,7;34:2;128:2;129:2;130:2;131:2;132:2;133:2;134:2;135:2;136:2;137:2;138:2;139:2;140:2;141:2;143:2;144:2;145:2,6,7;256:3;257:3;258:3;259:3;260:3;384:3;385:3;386:3;387:3;388:3;512:4,7;513:4,2,7;528:4;529:4;544:4;545:4;560:4;561:4;768:4;848:2;1024:2,6,7;1025:2;1026:2,6,7;1027:2;1028:2,6,7;1040:2,6,7;1056:2,6,7;1057:6,7;1058:6,2,7;3:2,7;4:2,7;5:2;25:2,7;28:2,7;29:2;64:2;65:2;261:3;262:3;263:3;264:3;265:3;266:3;389:3;390:3;391:3;392:3;393:3;394:3;832:2,4,7 ##maat配置入阀门需要将编译中的部分参数写到域配置中,目前最多包含ACTION,SERVICE,USER_REGION三个属性 ##业务ID:域类型1|域类型2@属性1&属性2&属性3 ##域类型:IP域 =ipRegion 字符串域=strRegion 增强字符串域=strStrRegion 数值域=numRegion ############ -maat2Valve=512:ipRegion@ACTION&SERVICE;513:strRegion@ACTION&SERVICE&USER_REGION;1024:strRegion|strStrRegion@USER_REGION;1040:strRegion@ACTION&SERVICE&USER_REGION;1056:strRegion@ACTION&SERVICE&USER_REGION;1028:ipRegion@ACTION&SERVICE&USER_REGION;1057:ipRegion@ACTION&SERVICE&USER_REGION;1058:strRegion@ACTION&SERVICE&USER_REGION +#0x21 APP阻断 33 +#0x91 APP监测 145 +#0x200 PXY拦截IP 512 +#0x201 PXY拦截域名 513 +#0x400 APP HTTP特征发现 1024 +#0x402 APP DOMAIN特征发现 1026 +#0x404 APP IP特征 1028 +#0x410 APP丢弃 1040 +#0x420 APP限流 1056 +#0x421 IP限流 1057 +#0x422 域名限流 1058 +maat2Valve=33:strRegion@ACTION&SERVICE&USER_REGION;145:strRegion@ACTION&SERVICE&USER_REGION;512:ipRegion@ACTION&SERVICE;513:strRegion@ACTION&SERVICE&USER_REGION;1024:strRegion|strStrRegion@USER_REGION;1026:strRegion|strStrRegion@USER_REGION;1028:ipRegion@ACTION&SERVICE&USER_REGION;1040:strRegion@ACTION&SERVICE&USER_REGION;1056:strRegion@ACTION&SERVICE&USER_REGION;1057:ipRegion@ACTION&SERVICE&USER_REGION;1058:strRegion@ACTION&SERVICE&USER_REGION diff --git a/src/main/resources/spring-mvc.xml b/src/main/resources/spring-mvc.xml index 84df7c9..878c7c9 100644 --- a/src/main/resources/spring-mvc.xml +++ b/src/main/resources/spring-mvc.xml @@ -189,6 +189,8 @@ + +