mirror of
https://gitee.com/samwaf/SamWaf.git
synced 2026-11-01 10:41:43 +08:00
fix:ssl task logic
This commit is contained in:
@@ -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
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user