配置清理,增加vpn信息清理
dns欺骗增加一个初始化无策略-默认组-欺骗ip配置(存储+下发)
This commit is contained in:
@@ -21,6 +21,7 @@ import com.nis.domain.configuration.DnsIpCfg;
|
||||
import com.nis.domain.maat.ToMaatResult;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.web.dao.configuration.DnsIpCfgDao;
|
||||
import com.nis.web.security.UserUtils;
|
||||
import com.nis.web.service.BaseService;
|
||||
@@ -47,6 +48,9 @@ public class DnsIpCfgService extends BaseService{
|
||||
return page;
|
||||
}
|
||||
|
||||
public List<DnsIpCfg> findDnsIpCfg(DnsIpCfg entity) {
|
||||
return dnsIpCfgDao.findDnsIpCfg(entity);
|
||||
}
|
||||
public DnsIpCfg getDnsIpCfg(Long cfgId) {
|
||||
return dnsIpCfgDao.getDnsIpCfg(cfgId);
|
||||
}
|
||||
@@ -115,6 +119,75 @@ public class DnsIpCfgService extends BaseService{
|
||||
dnsIpCfgDao.update(entity);
|
||||
}
|
||||
}
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void saveAndAudit(){
|
||||
DnsIpCfg dnsIp=new DnsIpCfg();
|
||||
dnsIp.setIpType(4);
|
||||
dnsIp.setDirection(0);
|
||||
dnsIp.setProtocolId(0);
|
||||
dnsIp.setProtocol(0);
|
||||
dnsIp.setIsValid(1);
|
||||
dnsIp.setIsAudit(1);
|
||||
dnsIp.setRequestId(0);
|
||||
dnsIp.setClassify("0");
|
||||
dnsIp.setAttribute("0");
|
||||
dnsIp.setLable("0");
|
||||
dnsIp.setFunctionId(401);
|
||||
dnsIp.setCfgRegionCode(1);
|
||||
dnsIp.setCfgType("dns_fake_ip");
|
||||
dnsIp.setIpPattern(3);
|
||||
dnsIp.setSrcIpAddress("0.0.0.0");
|
||||
dnsIp.setDestPort("0");
|
||||
dnsIp.setSrcPort("0");
|
||||
dnsIp.setPortPattern(1);
|
||||
dnsIp.setDnsStrategyId(0);
|
||||
dnsIp.setAction(16);
|
||||
dnsIp.setServiceId(64);
|
||||
dnsIp.setIsAreaEffective(0);
|
||||
dnsIp.setAreaEffectiveIds("");
|
||||
dnsIp.setCreateTime(new Date());
|
||||
dnsIp.setCreatorId(UserUtils.getUser().getId());
|
||||
dnsIp.setAuditorId(UserUtils.getUser().getId());
|
||||
dnsIp.setAuditTime(new Date());
|
||||
dnsIp.setCfgDesc(Constants.DNS_SPOOFING_IP_DESC);
|
||||
dnsIp.setDestIpAddress(Constants.DNS_SPOOFING_IP_IP);
|
||||
//调用服务接口获取compileId
|
||||
List<Integer> compileIds = new ArrayList<Integer>();
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,1);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
if(compileIds != null && compileIds.size() >0 && compileIds.get(0) != 0){
|
||||
dnsIp.setCompileId(compileIds.get(0));
|
||||
|
||||
}else{
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
||||
}
|
||||
|
||||
dnsIpCfgDao.insert(dnsIp);
|
||||
|
||||
String json="";
|
||||
List<InlineIp> resStrategyList=new ArrayList<InlineIp>();
|
||||
InlineIp resStrategy=convertCallBackIp(dnsIp,dnsIp.getDnsStrategyId());
|
||||
resStrategyList.add(resStrategy);
|
||||
//调用服务接口下发配置数据
|
||||
json=gsonToJson(resStrategyList);
|
||||
logger.info("DNS欺骗ip配置下发配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
try {
|
||||
ToMaatResult result = ConfigServiceUtil.postCallbackCfg(json);
|
||||
if(result!=null){
|
||||
logger.info("DNS欺骗ip配置下发响应信息:"+result.getMsg());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("DNS欺骗ip配置下发失败",e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param isAudit
|
||||
|
||||
Reference in New Issue
Block a user