Files
SafeLine/management/tcontrollerd/pkg/ngcmd/ngcmd.go
T
Binbim b8788c239e
MCP Docker / build-and-push (push) Has been cancelled
feat: SafeLine CE 9.3.9 with pro features
- 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
2026-07-04 07:59:04 +08:00

44 lines
1.1 KiB
Go

package ngcmd
import (
"fmt"
"os/exec"
"strings"
"chaitin.cn/dev/go/errors"
"chaitin.cn/patronus/safeline-2/management/tcontrollerd/pkg/log"
)
var logger = log.GetLogger("ngcmd")
// NginxConfTest exec nginx -t and return stderr
func NginxConfTest() error {
out, err := exec.Command("nginx", "-t").CombinedOutput()
logger.Debugf("nginx -t output: %v", string(out))
if err != nil {
return errors.Wrap(err, string(out))
}
//logger.Debugf("nginx -t output: %v", out)
if strings.Contains(string(out), "syntax is ok") && strings.Contains(string(out), "test is successful") {
return nil
} else {
return errors.New(fmt.Sprintf("nginx conf test error: %s", string(out)))
}
}
// NginxConfReload exec nginx -t and return stderr
func NginxConfReload() error {
out, err := exec.Command("nginx", "-s", "reload").CombinedOutput()
logger.Debugf("nginx -s reload output: %v", string(out))
if err != nil {
return errors.Wrap(err, string(out))
}
if len(out) == 0 {
return nil
} else {
return errors.New(fmt.Sprintf("nginx conf reload error: %s", string(out)))
}
}