diff --git a/src/main/java/com/nis/domain/configuration/CfgIndexInfo.java b/src/main/java/com/nis/domain/configuration/CfgIndexInfo.java index 2adcdbd10..197e9891f 100644 --- a/src/main/java/com/nis/domain/configuration/CfgIndexInfo.java +++ b/src/main/java/com/nis/domain/configuration/CfgIndexInfo.java @@ -41,7 +41,8 @@ public class CfgIndexInfo extends BaseCfg { private List httpResHdrList; private List httpReqBodyList; private List httpResBodyList; - + private SslKeywordCfg sslCfg; + private List sslList; public AvVoipAccountCfg getVoipAccount() { return voipAccount; @@ -61,6 +62,18 @@ public class CfgIndexInfo extends BaseCfg { public void setVoipIp(AvVoipIpCfg voipIp) { this.voipIp = voipIp; } + public SslKeywordCfg getSslCfg() { + return sslCfg; + } + public void setSslCfg(SslKeywordCfg sslCfg) { + this.sslCfg = sslCfg; + } + public List getSslList() { + return sslList; + } + public void setSslList(List sslList) { + this.sslList = sslList; + } public void setVoipIps(List voipIps) { this.voipIps = voipIps; } @@ -142,5 +155,4 @@ public class CfgIndexInfo extends BaseCfg { public static String getTablename() { return tableName; } - } diff --git a/src/main/java/com/nis/domain/configuration/SslKeywordCfg.java b/src/main/java/com/nis/domain/configuration/SslKeywordCfg.java index 5e37aa846..98c2acc6a 100644 --- a/src/main/java/com/nis/domain/configuration/SslKeywordCfg.java +++ b/src/main/java/com/nis/domain/configuration/SslKeywordCfg.java @@ -15,8 +15,8 @@ package com.nis.domain.configuration; * @date 2018年2月6日 上午8:59:51 * @version V1.0 */ -public class SslKeywordCfg extends ComplexkeywordCfg{ - public static final String tableName="ssl_cert_cfg"; +public class SslKeywordCfg extends BaseStringCfg{ + public static final String tableName="ssl_keyword_cfg"; /** * @Fields serialVersionUID:TODO(用一句话描述这个变量表示什么) * @@ -36,5 +36,9 @@ public class SslKeywordCfg extends ComplexkeywordCfg{ this.matchMethod=3; this.isHexbin=0; } + + public static String getTablename() { + return tableName; + } } diff --git a/src/main/java/com/nis/util/Constants.java b/src/main/java/com/nis/util/Constants.java index 4eac6b307..dea095134 100644 --- a/src/main/java/com/nis/util/Constants.java +++ b/src/main/java/com/nis/util/Constants.java @@ -295,6 +295,9 @@ public final class Constants { public static final Integer INSERT_ACTION = Configurations.getIntProperty("insert_action",1); public static final Integer UPDATE_ACTION = Configurations.getIntProperty("update_action",2); public static final Integer DELETE_ACTION = Configurations.getIntProperty("delete_action",3); - + public static final String SSL_IP_REGION = Configurations.getStringProperty("ssl_ip_region","ssl_ip"); + public static final String SSL_SNI_REGION = Configurations.getStringProperty("ssl_sni_region","ssl_sni"); + public static final String SSL_SAN_REGION = Configurations.getStringProperty("ssl_san_region","ssl_san"); + public static final String SSL_CA_REGION = Configurations.getStringProperty("ssl_ca_region","ssl_ca"); } diff --git a/src/main/java/com/nis/web/controller/configuration/ntc/WebsiteController.java b/src/main/java/com/nis/web/controller/configuration/ntc/WebsiteController.java index 1203c287b..ab7f3ebc2 100644 --- a/src/main/java/com/nis/web/controller/configuration/ntc/WebsiteController.java +++ b/src/main/java/com/nis/web/controller/configuration/ntc/WebsiteController.java @@ -2,7 +2,9 @@ package com.nis.web.controller.configuration.ntc; import java.util.ArrayList; import java.util.Date; +import java.util.HashMap; import java.util.List; +import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -17,16 +19,20 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.mvc.support.RedirectAttributes; +import com.nis.domain.FunctionRegionDict; import com.nis.domain.Page; import com.nis.domain.configuration.BaseIpCfg; +import com.nis.domain.configuration.BaseStringCfg; import com.nis.domain.configuration.CfgIndexInfo; import com.nis.domain.configuration.HttpBodyCfg; import com.nis.domain.configuration.HttpReqHeadCfg; import com.nis.domain.configuration.HttpResHeadCfg; import com.nis.domain.configuration.HttpUrlCfg; import com.nis.domain.configuration.IpPortCfg; +import com.nis.domain.configuration.SslKeywordCfg; import com.nis.exceptions.MaatConvertException; import com.nis.util.Constants; +import com.nis.util.DictUtils; import com.nis.web.controller.BaseController; import com.nis.web.security.UserUtils; @@ -43,7 +49,7 @@ public class WebsiteController extends BaseController{ @RequiresPermissions(value={"website:http:config"}) public String httpList(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,HttpServletRequest request,HttpServletResponse response) { Page searchPage=new Page(request,response,"a"); - Page page = websiteCfgService.getHttpList(searchPage, cfg); + Page page = websiteCfgService.getWebsiteList(searchPage, cfg); model.addAttribute("page", page); initPageCondition(model,cfg); return "/cfg/website/httpList"; @@ -57,6 +63,7 @@ public class WebsiteController extends BaseController{ initPageCondition(model,cfg); return "/cfg/website/dnsList"; } + @RequestMapping(value = {"httpForm"}) @RequiresPermissions(value={"website:http:config"}) public String httpForm(Model model,String ids,CfgIndexInfo entity) { @@ -146,6 +153,7 @@ public class WebsiteController extends BaseController{ model.addAttribute("_cfg", entity); return "/cfg/website/httpForm"; } + @RequestMapping(value = {"saveHttpCfg"}) @RequiresPermissions(value={"website:http:config"}) public String saveHttpCfg(Model model,HttpServletRequest request,HttpServletResponse response,String ids,CfgIndexInfo entity) { @@ -187,4 +195,87 @@ public class WebsiteController extends BaseController{ } return "redirect:" + adminPath +"/ntc/website/httpList?functionId="+functionId; } + @RequestMapping(value = {"sslList"}) + @RequiresPermissions(value={"website:ssl:config"}) + public String sslList(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,HttpServletRequest request,HttpServletResponse response) { + Page searchPage=new Page(request,response,"a"); + Page page = websiteCfgService.getWebsiteList(searchPage, cfg); + model.addAttribute("page", page); + initPageCondition(model,cfg); + return "/cfg/website/sslList"; + } + @RequestMapping(value = {"sslForm"}) + @RequiresPermissions(value={"website:ssl:config"}) + public String sslForm(Model model,String ids,CfgIndexInfo entity) { + if(StringUtils.isNotBlank(ids)){ + entity = websiteCfgService.getSslCfg(Long.parseLong(ids)); + model.addAttribute("areaCfgs", entity.getAreaCfg()); + } + initFormCondition(model,entity); + model.addAttribute("_cfg", entity); + return "/cfg/website/sslForm"; + } + @RequestMapping(value = {"saveSslCfg"}) + @RequiresPermissions(value={"website:ssl:config"}) + public String saveSslCfg(Model model,HttpServletRequest request,HttpServletResponse response,String ids,CfgIndexInfo entity) { + websiteCfgService.saveSslCfg(entity); + return "redirect:" + adminPath +"/ntc/website/sslList?functionId="+entity.getFunctionId(); + } + @RequestMapping(value = {"ajaxSslSubList"}) + public String ajaxSslSubList(Model model,Long cfgId,Integer index) { + CfgIndexInfo cfg = websiteCfgService.getSslCfg(cfgId); + /*List regionList = DictUtils.getFunctionRegionDictList(cfg.getFunctionId()); + model.addAttribute("regionList", regionList);*/ + List tabList = new ArrayList(); + if(cfg.getIpPortList()!=null){ + String cfgType = null; + for(IpPortCfg ip:cfg.getIpPortList()){ + if(!ip.getCfgType().equals(cfgType)){ + tabList.add(new String[]{"1",ip.getCfgType()}); + cfgType = ip.getCfgType(); + } + } + } + if(cfg.getSslList()!=null){ + String cfgType = null; + for(BaseStringCfg keyword:cfg.getSslList()){ + if(!keyword.getCfgType().equals(cfgType)){ + tabList.add(new String[]{"2",keyword.getCfgType()}); + cfgType = keyword.getCfgType(); + } + } + } + model.addAttribute("_cfg", cfg); + model.addAttribute("index", index); + model.addAttribute("tabList", tabList); + return "/cfg/website/sslSubList"; + } + @RequestMapping(value = {"updateSslCfgValid"}) + @RequiresPermissions(value={"website:ssl:config"}) + public String updateSslCfgValid(Integer isValid,String ids,Integer functionId) { + websiteCfgService.updateSslCfgValid(isValid,ids,functionId); + return "redirect:" + adminPath +"/ntc/website/sslList?functionId="+functionId; + } + @RequestMapping(value = {"auditSslCfg"}) + @RequiresPermissions(value={"website:ssl:audit"}) + public String auditSslCfg(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes) { + CfgIndexInfo entity = new CfgIndexInfo(); + String[] idArray = ids.split(","); + for(String id :idArray){ + entity = websiteCfgService.getHttpCfg(Long.parseLong(id)); + entity.setIsAudit(isAudit); + entity.setIsValid(isValid); + entity.setAuditorId(UserUtils.getUser().getId()); + entity.setAuditTime(new Date()); + entity.setFunctionId(functionId); + try { + websiteCfgService.auditSslCfg(entity,isAudit); + } catch (MaatConvertException e) { + e.printStackTrace(); + logger.info("ssl配置下发失败:"+e.getMessage()); + addMessage(redirectAttributes, e.getMessage()); + } + } + return "redirect:" + adminPath +"/ntc/website/sslList?functionId="+functionId; + } } diff --git a/src/main/java/com/nis/web/dao/configuration/WebsiteCfgDao.java b/src/main/java/com/nis/web/dao/configuration/WebsiteCfgDao.java index dfe9c4d5c..75c01d61e 100644 --- a/src/main/java/com/nis/web/dao/configuration/WebsiteCfgDao.java +++ b/src/main/java/com/nis/web/dao/configuration/WebsiteCfgDao.java @@ -5,6 +5,7 @@ import java.util.List; import com.nis.domain.configuration.AvFileSampleCfg; import com.nis.domain.configuration.AvSignSampleCfg; import com.nis.domain.configuration.BaseCfg; +import com.nis.domain.configuration.BaseStringCfg; import com.nis.domain.configuration.CfgIndexInfo; import com.nis.domain.configuration.DnsDomainCfg; import com.nis.domain.configuration.DnsIpCfg; @@ -13,6 +14,7 @@ import com.nis.domain.configuration.HttpReqHeadCfg; import com.nis.domain.configuration.HttpResHeadCfg; import com.nis.domain.configuration.HttpUrlCfg; import com.nis.domain.configuration.IpPortCfg; +import com.nis.domain.configuration.SslKeywordCfg; import com.nis.web.dao.CrudDao; import com.nis.web.dao.MyBatisDao; @@ -26,7 +28,7 @@ import com.nis.web.dao.MyBatisDao; public interface WebsiteCfgDao extends CrudDao{ public CfgIndexInfo getCfgIndexInfo(Long id); - public List getHttpList(CfgIndexInfo entity); + public List getWebsiteList(CfgIndexInfo entity); public List getIpPortList(CfgIndexInfo entity); public List getHttpUrlList(CfgIndexInfo entity); public List getHttpResHdrList(CfgIndexInfo entity); @@ -34,7 +36,7 @@ public interface WebsiteCfgDao extends CrudDao{ public List getHttpReqHdrList(CfgIndexInfo entity); public List getHttpReqBodyList(CfgIndexInfo entity); public void saveCfgIndex(CfgIndexInfo entity); - public void saveHttpIpCfg(IpPortCfg entity); + public void saveIpPortCfg(IpPortCfg entity); public void saveHttpUrlCfg(HttpUrlCfg entity); public void saveHttpReqHdrCfg(HttpReqHeadCfg entity); public void saveHttpResHdrCfg(HttpResHeadCfg entity); @@ -57,4 +59,9 @@ public interface WebsiteCfgDao extends CrudDao{ public void deleteDnsIpCfg(CfgIndexInfo entity); public void deleteDnsDomainCfg(CfgIndexInfo entity); + public List getSslKewordList(CfgIndexInfo entity); + public void saveSslKeywordCfg(BaseStringCfg entity); + public void deleteSslIpCfg(CfgIndexInfo entity); + public void deleteSslKeywordCfg(CfgIndexInfo entity); + } diff --git a/src/main/java/com/nis/web/dao/configuration/WebsiteCfgDao.xml b/src/main/java/com/nis/web/dao/configuration/WebsiteCfgDao.xml index 4900eb26d..6a54c7e61 100644 --- a/src/main/java/com/nis/web/dao/configuration/WebsiteCfgDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/WebsiteCfgDao.xml @@ -143,7 +143,7 @@ a.audit_time,a.service_id,a.request_id,a.compile_id,a.is_area_effective,a.classify,a.attribute,a.lable, a.expr_type,a.match_method,a.is_hexbin,a.area_effective_ids,a.function_id,a.cfg_region_code - SELECT @@ -289,6 +289,15 @@ ) + ${sqlMap.dsf} @@ -320,7 +329,7 @@ - + @@ -386,7 +402,7 @@ ) - + SELECT LAST_INSERT_ID() @@ -800,4 +816,71 @@ + + + + SELECT LAST_INSERT_ID() + + insert into ssl_keyword_cfg ( + CFG_DESC, + ACTION, + IS_VALID, + IS_AUDIT, + CREATOR_ID, + CREATE_TIME, + EDITOR_ID, + EDIT_TIME, + AUDITOR_ID, + AUDIT_TIME, + SERVICE_ID, + REQUEST_ID, + COMPILE_ID, + IS_AREA_EFFECTIVE, + CLASSIFY, + ATTRIBUTE, + LABLE, + AREA_EFFECTIVE_IDS, + function_id, + cfg_keywords, + cfg_type, + cfg_region_code, + expr_type, + match_method, + is_hexbin + )values ( + #{cfgDesc,jdbcType=VARCHAR}, + #{action,jdbcType=INTEGER}, + 0, + 0, + #{creatorId,jdbcType=INTEGER}, + #{createTime,jdbcType=TIMESTAMP}, + #{editorId,jdbcType=INTEGER}, + #{editTime,jdbcType=TIMESTAMP}, + #{auditorId,jdbcType=INTEGER}, + #{auditTime,jdbcType=TIMESTAMP}, + #{serviceId,jdbcType=INTEGER}, + #{requestId,jdbcType=INTEGER}, + #{compileId,jdbcType=INTEGER}, + #{isAreaEffective,jdbcType=INTEGER}, + #{classify,jdbcType=VARCHAR}, + #{attribute,jdbcType=VARCHAR}, + #{lable,jdbcType=VARCHAR}, + #{areaEffectiveIds,jdbcType=VARCHAR}, + #{functionId,jdbcType=INTEGER}, + #{cfgKeywords,jdbcType=VARCHAR}, + #{cfgType,jdbcType=VARCHAR}, + #{cfgRegionCode,jdbcType=INTEGER}, + #{exprType,jdbcType=INTEGER}, + #{matchMethod,jdbcType=INTEGER}, + #{isHexbin,jdbcType=INTEGER} + ) + + + + delete from ip_port_cfg where compile_id=#{compileId} and protocol_id=10 and function_id=#{functionId} + + + + delete from ssl_keyword_cfg where compile_id=#{compileId} and function_id=#{functionId} + \ No newline at end of file diff --git a/src/main/java/com/nis/web/service/BaseService.java b/src/main/java/com/nis/web/service/BaseService.java index 74ca68700..1ac3093f7 100644 --- a/src/main/java/com/nis/web/service/BaseService.java +++ b/src/main/java/com/nis/web/service/BaseService.java @@ -267,13 +267,8 @@ public abstract class BaseService { * @return */ public static Map cfgConvert(List dstList,List srcList,Integer cfgType,BaseCfg baseCfg,List groupRelationList){ - GroupCfg group = new GroupCfg(); - group.setGroupId(ConfigServiceUtil.getId(2, 1).get(0)); - group.setCompileId(baseCfg.getCompileId()); - group.setAuditTime(baseCfg.getAuditTime()); - group.setIsValid(baseCfg.getIsValid()); - groupRelationList.add(group); Map map = new HashMap(); + String regionValue = null; if(cfgType==1){ List numRegionList = new ArrayList(); Integer groupId = 0; @@ -281,12 +276,22 @@ public abstract class BaseService { BaseIpCfg baseIpCfg = (BaseIpCfg) srcList.get(i); IpCfg cfg = new IpCfg(); BeanUtils.copyProperties(baseIpCfg, cfg); + GroupCfg group = new GroupCfg(); + if(!cfg.getCfgType().equals(regionValue)){ + group.setGroupId(ConfigServiceUtil.getId(2, 1).get(0)); + group.setCompileId(baseCfg.getCompileId()); + group.setAuditTime(baseCfg.getAuditTime()); + group.setIsValid(baseCfg.getIsValid()); + groupRelationList.add(group); + } + cfg.setGroupId(group.getGroupId()); cfg.setRegionId(ConfigServiceUtil.getId(3, 1).get(0)); cfg.setAuditTime(baseCfg.getAuditTime()); cfg.setIsValid(baseCfg.getIsValid()); cfg = ipConvert(cfg,baseIpCfg); dstList.add(cfg); + regionValue = cfg.getCfgType(); //如果protocolId非空非零,需要构造数值型域配置 if(baseIpCfg.getProtocolId()!=null && baseIpCfg.getProtocolId()!=0){ if(groupId==0){//只构造一次配置分组 @@ -313,18 +318,35 @@ public abstract class BaseService { }else if(cfgType==2 || cfgType==3){ for(int i=0;i { entity.setAreaCfg(areaCfg); return entity; } - public Page getHttpList(Page page, CfgIndexInfo entity){ + public CfgIndexInfo getSslCfg(Long cfgId){ + CfgIndexInfo entity = websiteCfgDao.getCfgIndexInfo(cfgId); + List ipPortList = websiteCfgDao.getIpPortList(entity); + List sslList = websiteCfgDao.getSslKewordList(entity); + List areaCfg = areaIpCfgDao.getByCompileId(entity.getCompileId()); + entity.setIpPortList(ipPortList); + entity.setSslList(sslList); + entity.setAreaCfg(areaCfg); + return entity; + } + public Page getWebsiteList(Page page, CfgIndexInfo entity){ // 生成数据权限过滤条件(dsf为dataScopeFilter的简写,在xml中使用 ${sqlMap.dsf}调用权限SQL) entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"a")); entity.setPage(page); - List list = websiteCfgDao.getHttpList(entity); + List list = websiteCfgDao.getWebsiteList(entity); page.setList(list); return page; } @@ -96,24 +108,6 @@ public class WebsiteCfgService extends CrudService { page.setList(list); return page; } - public List getHttpIpList(IpPortCfg entity){ - return null; - } - public List getHttpUrlList(HttpUrlCfg entity){ - return null; - } - public List getHttpResHdrList(HttpResHeadCfg entity){ - return null; - } - public List getHttpResBodyList(HttpBodyCfg entity){ - return null; - } - public List getHttpReqHdrList(HttpReqHeadCfg entity){ - return null; - } - public List getHttpReqBodyList(HttpBodyCfg entity){ - return null; - } public void saveHttpCfg(CfgIndexInfo entity){ if(entity.getCfgId()==null){ Integer compileId = 0; @@ -129,7 +123,7 @@ public class WebsiteCfgService extends CrudService { if(entity.getIpPortList()!=null){ for(IpPortCfg cfg:entity.getIpPortList()){ BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); - websiteCfgDao.saveHttpIpCfg(cfg); + websiteCfgDao.saveIpPortCfg(cfg); } } if(entity.getHttpUrlList()!=null){ @@ -178,7 +172,6 @@ public class WebsiteCfgService extends CrudService { }else{ websiteCfgDao.updateCfgIndex(entity); -// entity = websiteCfgDao.getCfgIndexInfo(entity.getCfgId()); //无效子配置后,再新增子配置 websiteCfgDao.deleteHttpIpCfg(entity); websiteCfgDao.deleteHttpUrlCfg(entity); @@ -194,7 +187,7 @@ public class WebsiteCfgService extends CrudService { if(entity.getIpPortList()!=null){ for(IpPortCfg cfg:entity.getIpPortList()){ BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); - websiteCfgDao.saveHttpIpCfg(cfg); + websiteCfgDao.saveIpPortCfg(cfg); } } if(entity.getHttpUrlList()!=null){ @@ -433,4 +426,216 @@ public class WebsiteCfgService extends CrudService { logger.info("http配置取消配置响应信息:"+result.getMsg()); } } + public void saveSslCfg(CfgIndexInfo entity){ + if(entity.getCfgId()==null){ + Integer compileId = 0; + try { + List idList = ConfigServiceUtil.getId(1, 1); + if(idList!=null && idList.size()>0){ + compileId = idList.get(0); + } + entity.setCompileId(compileId); + entity.setCreateTime(new Date()); + entity.setCreatorId(entity.getCurrentUser().getId()); + websiteCfgDao.saveCfgIndex(entity); + if(entity.getIpPortList()!=null){ + for(IpPortCfg cfg:entity.getIpPortList()){ + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + websiteCfgDao.saveIpPortCfg(cfg); + } + } + if(entity.getSslList()!=null){ + for(BaseStringCfg cfg:entity.getSslList()){ + if(StringUtils.isNotBlank(cfg.getCfgKeywords())){ + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + websiteCfgDao.saveSslKeywordCfg(cfg); + } + } + } + //保存区域IP信息 + if(entity.getAreaCfg()!=null){ + for(AreaIpCfg cfg:entity.getAreaCfg()){ + cfg.initDefaultValue(); + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + areaIpCfgDao.saveAreaIpCfg(cfg); + } + } + } catch (Exception e) { + e.printStackTrace(); + logger.info("获取编译ID出错"); + throw new MaatConvertException(":"+e.getMessage()); + } + + }else{ + websiteCfgDao.updateCfgIndex(entity); + //无效子配置后,再新增子配置 + websiteCfgDao.deleteSslIpCfg(entity); + websiteCfgDao.deleteSslKeywordCfg(entity); + AreaIpCfg area = new AreaIpCfg(); + area.setCompileId(entity.getCompileId()); + area.setFunctionId(entity.getFunctionId()); + areaIpCfgDao.deleteAreaIpCfg(area); + entity.setCreateTime(new Date()); + entity.setCreatorId(entity.getCurrentUser().getId()); + if(entity.getIpPortList()!=null){ + for(IpPortCfg cfg:entity.getIpPortList()){ + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + websiteCfgDao.saveIpPortCfg(cfg); + } + } + if(entity.getSslList()!=null){ + for(BaseStringCfg cfg:entity.getSslList()){ + if(StringUtils.isNotBlank(cfg.getCfgKeywords())){ + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"}); + websiteCfgDao.saveSslKeywordCfg(cfg); + } + } + } + //保存区域IP信息 + if(entity.getAreaCfg()!=null){ + for(AreaIpCfg cfg:entity.getAreaCfg()){ + cfg.initDefaultValue(); + BeanUtils.copyProperties(entity, cfg,new String[]{"cfgDesc","cfgRegionCode","cfgType"}); + areaIpCfgDao.saveAreaIpCfg(cfg); + } + } + } + } + public void updateSslCfgValid(Integer isValid,String ids,Integer functionId){ + CfgIndexInfo entity = new CfgIndexInfo(); + String[] idArray = ids.split(","); + for(String id :idArray){ + entity.setCfgId(Long.parseLong(id)); + entity.setIsValid(isValid); + entity.setEditorId(UserUtils.getUser().getId()); + entity.setEditTime(new Date()); + entity.setTableName(CfgIndexInfo.getTablename()); + entity.setFunctionId(functionId); + websiteCfgDao.updateCfgValid(entity); + //查询子配置 + entity = this.getSslCfg(Long.parseLong(id)); + if(entity.getIpPortList()!=null && entity.getIpPortList().size()>0){ + IpPortCfg cfg = new IpPortCfg(); + BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + cfg.setTableName(IpPortCfg.getTablename()); + websiteCfgDao.updateCfgValid(cfg); + } + if(entity.getSslList()!=null && entity.getSslList().size()>0) + { + SslKeywordCfg cfg = new SslKeywordCfg(); + BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + cfg.setTableName(SslKeywordCfg.getTablename()); + websiteCfgDao.updateCfgValid(cfg); + } + //保存区域IP信息 + if(entity.getAreaCfg()!=null && entity.getAreaCfg().size()>0){ + AreaIpCfg cfg = new AreaIpCfg(); + BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + cfg.setTableName(AreaIpCfg.getTablename()); + websiteCfgDao.updateCfgValid(cfg); + } + + } + + } + public void auditSslCfg(CfgIndexInfo entity,Integer isAudit) throws MaatConvertException{ + //修改数据库审核状态信息 + entity.setTableName(CfgIndexInfo.getTablename()); + websiteCfgDao.auditCfg(entity); + + ToMaatBean maatBean = new ToMaatBean(); + MaatCfg maatCfg = new MaatCfg(); + List configCompileList = new ArrayList(); + List groupRelationList = new ArrayList(); + List ipRegionList = new ArrayList(); + List strRegionList = new ArrayList(); + List numRegionList = new ArrayList(); + List digestRegionList = new ArrayList(); + List areaIpRegionList = new ArrayList(); + + //查询子配置并修改审核状态 + entity = this.getSslCfg(entity.getCfgId()); + if(entity.getIpPortList()!=null && entity.getIpPortList().size()>0){ + IpPortCfg cfg = new IpPortCfg(); + BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + cfg.setTableName(IpPortCfg.getTablename()); + websiteCfgDao.auditCfg(cfg); + if(isAudit==1){ + Map map = cfgConvert(ipRegionList,entity.getIpPortList(),1,entity,groupRelationList); + groupRelationList=map.get("groupList"); + ipRegionList=map.get("dstList"); + if(map.get("numRegionList")!=null){ + numRegionList.addAll(map.get("numRegionList")); + } + } + } + if(entity.getSslList()!=null && entity.getSslList().size()>0){ + SslKeywordCfg cfg = new SslKeywordCfg(); + BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + cfg.setTableName(SslKeywordCfg.getTablename()); + websiteCfgDao.auditCfg(cfg); + if(isAudit==1){ + Map map = cfgConvert(strRegionList,entity.getSslList(),2,entity,groupRelationList); + groupRelationList=map.get("groupList"); + strRegionList=map.get("dstList"); + } + } + //保存区域IP信息 + if(entity.getAreaCfg()!=null && entity.getAreaCfg().size()>0){ + AreaIpCfg cfg = new AreaIpCfg(); + BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + cfg.setTableName(AreaIpCfg.getTablename()); + websiteCfgDao.auditCfg(cfg); + if(isAudit==1){ + Map map = cfgConvert(areaIpRegionList,entity.getAreaCfg(),1,entity,groupRelationList); + groupRelationList=map.get("groupList"); + areaIpRegionList=map.get("dstList"); + } + } + + //构造提交综合服务参数格式,一条配置提交一次综合服务 + if(isAudit==1){ + maatCfg.initDefaultValue(); + BeanUtils.copyProperties(entity, maatCfg); + maatCfg.setAction(entity.getAction()); + maatCfg.setAuditTime(entity.getAuditTime()); + maatCfg.setIpRegionList(ipRegionList); + maatCfg.setStrRegionList(strRegionList); + maatCfg.setNumRegionList(numRegionList); + maatCfg.setDigestRegionList(digestRegionList); + maatCfg.setGroupRelationList(groupRelationList); + maatCfg.setGroupNum(groupRelationList.size()); + maatCfg.setAreaIpRegionList(areaIpRegionList); + maatCfg.setIsValid(entity.getIsValid()); + configCompileList.add(maatCfg); + maatBean.setConfigCompileList(configCompileList); + maatBean.setAuditTime(entity.getAuditTime()); + maatBean.setCreatorName(entity.getCurrentUser().getName()); + maatBean.setVersion(Constants.MAAT_VERSION); + maatBean.setOpAction(Constants.INSERT_ACTION); + //调用服务接口下发配置数据 + String json=gsonToJson(maatBean); + logger.info("ssl配置下发配置参数:"+json); + //调用服务接口下发配置 + ToMaatResult result = ConfigServiceUtil.postCallbackCfg(json); + logger.info("ssl配置下发响应信息:"+result.getMsg()); + + }else if(isAudit==3){ + maatCfg.setCompileId(entity.getCompileId()); + maatCfg.setServiceId(entity.getServiceId()); + maatCfg.setIsValid(0);//无效 + configCompileList.add(maatCfg); + maatBean.setConfigCompileList(configCompileList); + maatBean.setAuditTime(entity.getAuditTime()); + maatBean.setCreatorName(entity.getCurrentUser().getName()); + maatBean.setVersion(Constants.MAAT_VERSION); + maatBean.setOpAction(Constants.UPDATE_ACTION); + //调用服务接口取消配置 + String json=gsonToJson(maatBean); + logger.info("ssl配置下发配置参数:"+json); + //调用服务接口下发配置 + ToMaatResult result = ConfigServiceUtil.put(json,1); + logger.info("ssl配置取消配置响应信息:"+result.getMsg()); + } + } } diff --git a/src/main/resources/messages/message_zh_CN.properties b/src/main/resources/messages/message_zh_CN.properties index 6ebfb39f4..f128750ad 100644 --- a/src/main/resources/messages/message_zh_CN.properties +++ b/src/main/resources/messages/message_zh_CN.properties @@ -241,7 +241,7 @@ has_approved=\u5DF2\u7ECF\u901A\u8FC7\u5BA1\u6838\uFF0C\u65E0\u6CD5\u8FDB\u884C\ hasnot_approved=\u672A\u901A\u8FC7\u5BA1\u6838\uFF0C\u65E0\u6CD5\u8FDB\u884C\u8BE5\u64CD\u4F5C\uFF01 check_one=\u8BF7\u9009\u62E9\u4E00\u6761\u6570\u636E\uFF01 one_more=\u8BF7\u81F3\u5C11\u9009\u62E9\u4E00\u6761\u6570\u636E\! -one_more_area=\u533A\u57DF\u7BA1\u63A7\uFF0C\u5FC5\u987B\u586B\u5199\u8FD0\u8425\u5546\u6216ip\u4FE1\u606F! +one_more_area=\u533A\u57DF\u7BA1\u63A7\uFF0C\u5FC5\u987B\u586B\u5199\u8FD0\u8425\u5546\u6216ip\u4FE1\u606F\! custom_columns=\u81EA\u5B9A\u4E49\u5217\u5B57\u6BB5 maxlength_64=\u8BF7\u8F93\u5165\u4E00\u4E2A\u957F\u5EA6\u6700\u591A\u662F 64\u7684\u5B57\u7B26\u4E32\uFF01 maxlength_128=\u8BF7\u8F93\u5165\u4E00\u4E2A\u957F\u5EA6\u6700\u591A\u662F 128\u7684\u5B57\u7B26\u4E32\uFF01 @@ -572,3 +572,8 @@ http_req_hdr_title=HTTP\u8BF7\u6C42\u5934\u57DF\u914D\u7F6E http_req_body_title=HTTP\u8BF7\u6C42\u5185\u5BB9\u914D\u7F6E http_res_hdr_title=HTTP\u5E94\u7B54\u5934\u57DF\u914D\u7F6E http_res_body_title=HTTP\u5E94\u7B54\u5185\u5BB9\u914D\u7F6E +ssl_ip=SSL IP\u914D\u7F6E +ssl_sni=SSL SNI\u5173\u952E\u5B57\u914D\u7F6E +ssl_san=SSL SAN\u5173\u952E\u5B57\u914D\u7F6E +ssl_ca=SSL CA\u5173\u952E\u5B57\u914D\u7F6E +http_control=http\u914D\u7F6E diff --git a/src/main/resources/nis.properties b/src/main/resources/nis.properties index 35d2648cc..7fbbc25ec 100644 --- a/src/main/resources/nis.properties +++ b/src/main/resources/nis.properties @@ -219,7 +219,7 @@ clusterBStartTime=1503504000725 isCommit=true ############################################################################################################################################ ############################################################################################################################################ -httpUrl=http://10.0.6.249:8080/galaxy/service/cfg/v1/ +httpUrl=http://10.0.6.201:8090/galaxy/service/cfg/v1/ maatCfg=configSources fileUploadCfg=fileUploadSources callbackCfg=commonSources @@ -259,3 +259,7 @@ http_res_body_region=http_res_body http_url_region=http_url voip_ip=av_voip_ip voip_account=av_voip_account +ssl_sni_region=ssl_sni +ssl_san_region=ssl_san +ssl_ca_region=ssl_ca +ssl_ip_region=ssl_ip \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/cfg/complexCfgForm.jsp b/src/main/webapp/WEB-INF/views/cfg/complexCfgForm.jsp index 507af8b6d..f2c6fc66e 100644 --- a/src/main/webapp/WEB-INF/views/cfg/complexCfgForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/complexCfgForm.jsp @@ -15,8 +15,8 @@ $(function(){ and regionDistrict.regionType eq 3 and regionValue eq regionDistrict.configRegionValue}"> - - + + @@ -32,7 +32,7 @@ $(function(){
-
-
+
@@ -55,10 +55,10 @@ $(function(){
-
+
@@ -70,18 +70,18 @@ $(function(){
-
+
@@ -89,7 +89,7 @@ $(function(){
-
-
+
@@ -116,7 +116,7 @@ $(function(){
-
-
+
diff --git a/src/main/webapp/WEB-INF/views/cfg/ipCfgForm.jsp b/src/main/webapp/WEB-INF/views/cfg/ipCfgForm.jsp index ef2b73b1c..fc5b6fbcb 100644 --- a/src/main/webapp/WEB-INF/views/cfg/ipCfgForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/ipCfgForm.jsp @@ -13,11 +13,11 @@ $(function(){ - - + + - +
*
-
-
+
@@ -49,7 +49,7 @@ $(function(){
-
-
+
@@ -70,10 +70,10 @@ $(function(){
-
+
@@ -83,7 +83,7 @@ $(function(){
-
-
+
@@ -101,10 +101,10 @@ $(function(){
-
+
@@ -115,10 +115,10 @@ $(function(){
-
+
@@ -127,10 +127,10 @@ $(function(){
-
+
@@ -140,7 +140,7 @@ $(function(){
-
-
+
@@ -160,7 +160,7 @@ $(function(){
-
-
+
diff --git a/src/main/webapp/WEB-INF/views/cfg/stringCfgForm.jsp b/src/main/webapp/WEB-INF/views/cfg/stringCfgForm.jsp index 4e6ae7a42..49ef3f70d 100644 --- a/src/main/webapp/WEB-INF/views/cfg/stringCfgForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/stringCfgForm.jsp @@ -15,8 +15,8 @@ $(function(){ and regionDistrict.regionType eq 2 and regionValue eq regionDistrict.configRegionValue}"> - - + +
@@ -32,10 +32,10 @@ $(function(){
-
+
@@ -47,17 +47,17 @@ $(function(){
-
+
@@ -65,7 +65,7 @@ $(function(){
-
-
+
@@ -92,7 +92,7 @@ $(function(){
-
-
+
diff --git a/src/main/webapp/WEB-INF/views/cfg/website/httpForm.jsp b/src/main/webapp/WEB-INF/views/cfg/website/httpForm.jsp index fd52c9945..8f60720e3 100644 --- a/src/main/webapp/WEB-INF/views/cfg/website/httpForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/website/httpForm.jsp @@ -188,10 +188,11 @@ class="glyphicon glyphicon-plus ${tabName}Add" onClick="addContent(this,'${tabName}')" title="add"> - + -
hidden disabled" > + +
<%-- @@ -201,6 +202,7 @@ --%> <%@include file="/WEB-INF/views/cfg/ipCfgForm.jsp"%>
+
@@ -213,11 +215,12 @@ class="glyphicon glyphicon-plus ${tabName}Add" onClick="addContent(this,'${tabName}')" title="add"> - + -
hidden disabled" > + +
<%-- @@ -239,11 +242,12 @@ class="glyphicon glyphicon-plus ${tabName}Add" onClick="addContent(this,'${tabName}')" title="add"> - + -
hidden disabled"> + +
<%-- @@ -265,11 +269,12 @@ class="glyphicon glyphicon-plus ${tabName}Add" onClick="addContent(this,'${tabName}')" title="add"> - + -
hidden disabled" > + +
<%-- @@ -291,11 +296,12 @@ class="glyphicon glyphicon-plus ${tabName}Add" onClick="addContent(this,'${tabName}')" title="add"> - + -
hidden disabled"> + +
<%-- @@ -316,11 +322,12 @@ class="glyphicon glyphicon-plus ${tabName}Add" onClick="addContent(this,'${tabName}')" title="add"> - + -
hidden disabled" > + +
<%-- @@ -328,7 +335,7 @@ --%> - <%@include file="/WEB-INF/views/cfg/stringCfgForm.jsp"%>%> + <%@include file="/WEB-INF/views/cfg/stringCfgForm.jsp"%>
diff --git a/src/main/webapp/WEB-INF/views/cfg/website/httpList.jsp b/src/main/webapp/WEB-INF/views/cfg/website/httpList.jsp index c9bc123f0..2c9872e3f 100644 --- a/src/main/webapp/WEB-INF/views/cfg/website/httpList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/website/httpList.jsp @@ -105,7 +105,7 @@

- +

diff --git a/src/main/webapp/WEB-INF/views/cfg/website/httpSubList.jsp b/src/main/webapp/WEB-INF/views/cfg/website/httpSubList.jsp index b493d76d1..c2dfc8e36 100644 --- a/src/main/webapp/WEB-INF/views/cfg/website/httpSubList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/website/httpSubList.jsp @@ -8,18 +8,6 @@ })