fix:ssl task logic

This commit is contained in:
samwaf
2025-01-06 13:51:30 +08:00
parent e92efb1620
commit 2b8a01059a
4 changed files with 5 additions and 4 deletions
+1 -1
View File
@@ -163,7 +163,7 @@ func (receiver *WafSSLOrderService) RenewAdd(orderId string) (model.SslOrder, er
func (receiver *WafSSLOrderService) GetLastedInfo(hostCode string) (model.SslOrder, error) {
var bean model.SslOrder
global.GWAF_LOCAL_DB.Model(&model.SslOrder{}).Where("host_code=?", hostCode).Where("result_certificate is null").Order("create_time desc").Limit(1).First(&bean)
global.GWAF_LOCAL_DB.Model(&model.SslOrder{}).Where("host_code=?", hostCode).Where("result_certificate is not null").Order("create_time desc").Limit(1).First(&bean)
return bean, nil
}
+1 -1
View File
@@ -45,7 +45,7 @@ func GetCurrentDir() string {
zlog.Error("Failed to get executable path:", err)
return ""
}
zlog.Info("当前程序所在文件位置", exePath)
zlog.Debug("当前程序所在文件位置", exePath)
exeDir := filepath.Dir(exePath)
return exeDir
}
+1 -1
View File
@@ -284,7 +284,7 @@ func (waf *WafEngine) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
err := json.Unmarshal([]byte(hostTarget.Host.DEFENSE_JSON), &hostDefense)
if err != nil {
zlog.Error("解析defense json失败")
zlog.Debug("解析defense json失败")
}
//检测爬虫bot
if hostDefense.DEFENSE_BOT == 1 {
+2 -1
View File
@@ -88,6 +88,7 @@ func SSLOrderReload() {
allSSLHost, _, err := wafHostService.GetAllSSLBindHost()
if err == nil {
for _, hostBean := range allSSLHost {
zlog.Info(innerLogName, fmt.Sprintf("正在检测域名: %s:%d", hostBean.Host, hostBean.Port))
lastSslOrderInfo, err := wafSslOrderService.GetLastedInfo(hostBean.Code)
if err != nil {
zlog.Error(innerLogName, "ssl order get lasted info:", err.Error())
@@ -101,7 +102,7 @@ func SSLOrderReload() {
zlog.Error(innerLogName, "ssl order get lasted info:", err.Error())
} else {
zlog.Info(innerLogName, "ssl order expire:", isExpire, availDay, msg)
if isExpire && availDay <= int(global.GCONFIG_RECORD_SSLOrder_EXPIRE_DAY) {
if isExpire == false && availDay <= int(global.GCONFIG_RECORD_SSLOrder_EXPIRE_DAY) {
//没过期 且是知单天数 就才处理
var chanInfo = spec.ChanSslOrder{
Type: enums.ChanSslOrderrenew,