b8788c239e
MCP Docker / build-and-push (push) Has been cancelled
- Remove telemetry: disabled all phone-home (installation notify, false positives, behavior tracking, upgrade tips) - Version branding: removed 'ce-' prefix, product name changed to '长亭雷池 WAF' - Detection engine enhancement: strict preset enables all 17 modules with aggressive configs - Multi-user RBAC: admin/operator/viewer roles with password + TOTP 2FA - Rate limiting: nginx limit_req per website (RPS, burst, action) - JS Challenge: browser fingerprint verification page with cookie-based bypass - Security fixes: removed InsecureSkipVerify, hardcoded credentials, NO_AUTH backdoor
46 lines
786 B
Go
46 lines
786 B
Go
package model
|
|
|
|
import (
|
|
"gorm.io/gorm"
|
|
|
|
"chaitin.cn/patronus/safeline-2/management/webserver/pkg/database"
|
|
)
|
|
|
|
func InitModels() error {
|
|
db := database.GetDB()
|
|
err := db.Transaction(func(tx *gorm.DB) error {
|
|
//
|
|
if err := DBPatch140(tx); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
})
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := db.AutoMigrate(&User{}, &DetectLogBasic{}, &DetectLogDetail{}, &Behaviour{}, &Options{}, &Website{}, &PolicyRule{}, &SystemStatistics{}); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := initAdminUser(); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := initOptions(); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := initPolicyGroupGlobal(); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := initSrcIPConfig(); err != nil {
|
|
return err
|
|
}
|
|
|
|
//InitDetectLogSamples()
|
|
|
|
return nil
|
|
}
|