aliyun sensor server
This commit is contained in:
+35
-6
@@ -12,6 +12,19 @@ var (
|
||||
BuildCommit = "dev"
|
||||
)
|
||||
|
||||
// 文本审核服务通道取值([security] text_censor_source)。
|
||||
//
|
||||
// 定义在 conf 侧是为了让「配置校验」(conf.Init)与「通道装配」
|
||||
// (internal/security/censor)引用同一份字面量,避免两边各写一份字符串而漂移。
|
||||
const (
|
||||
// CensorSourceAuto 七牛优先、阿里云兜底(历史行为,留空同义)。
|
||||
CensorSourceAuto = "auto"
|
||||
// CensorSourceQiniu 只用七牛。
|
||||
CensorSourceQiniu = "qiniu"
|
||||
// CensorSourceAliyun 只用阿里云。
|
||||
CensorSourceAliyun = "aliyun"
|
||||
)
|
||||
|
||||
var (
|
||||
App struct {
|
||||
Production bool `ini:"production"`
|
||||
@@ -51,12 +64,28 @@ var (
|
||||
// (域名/题目不存在等均走 302 业务跳转,不产生计数)一律放行,仅命中后台扫描特征
|
||||
// 路径(KindSensitive)才参与统计封禁。避免共享出口(CDN 边缘 / CGNAT NAT444)下
|
||||
// 正常用户被 404 探测流量连坐误伤。如需恢复对纯 404 字典扫描的封禁再置 true。
|
||||
BanTrackNotFound bool `ini:"ban_track_notfound"`
|
||||
BanThresholdSensitive int `ini:"ban_threshold_sensitive"` // 窗口内敏感路径命中次数
|
||||
BanThreshold404 int `ini:"ban_threshold_404"` // 窗口内 404 次数
|
||||
BanWindowSeconds int `ini:"ban_window_seconds"` // 统计窗口(秒)
|
||||
BanDurationMinutes int `ini:"ban_duration_minutes"` // 封禁时长(分钟)
|
||||
SecurityAlertEmail string `ini:"security_alert_email"` // 触发封禁时告警收件人(留空不发送)
|
||||
BanTrackNotFound bool `ini:"ban_track_notfound"`
|
||||
BanThresholdSensitive int `ini:"ban_threshold_sensitive"` // 窗口内敏感路径命中次数
|
||||
BanThreshold404 int `ini:"ban_threshold_404"` // 窗口内 404 次数
|
||||
BanWindowSeconds int `ini:"ban_window_seconds"` // 统计窗口(秒)
|
||||
BanDurationMinutes int `ini:"ban_duration_minutes"` // 封禁时长(分钟)
|
||||
// DefaultModerationStrictness 站点默认的「内容审核严格度」档位
|
||||
// (lax / standard / strict)。仅对未单独设置档位的账号生效:
|
||||
// 账号一旦显式选择了档位就以账号设置为准(见 moderation.StrictnessFor)。
|
||||
// 留空或非法值回退 strict(最严档)—— 保证升级不会放宽任何拦截;
|
||||
// 严格档拦截面不小于升级前,部署后默认拦截面可能略有扩大;
|
||||
// 若希望默认更少误伤,在本段显式写 standard 即可,无需改代码。
|
||||
DefaultModerationStrictness string `ini:"default_moderation_strictness"`
|
||||
// TextCensorSource 文本审核服务通道,取值:
|
||||
// qiniu —— 只用七牛(凭据见 [app] qiniu_access_key / qiniu_access_secret)
|
||||
// aliyun —— 只用阿里云(走内容安全 2.0 / 文本审核增强版 TextModeration;
|
||||
// 开通只需实名认证,个人账号可用。凭据见 [app] aliyun_access_key / aliyun_access_key_secret)
|
||||
// auto(默认,留空同义)—— 保持历史行为:七牛优先,未通过时用阿里云二次复核
|
||||
// 仅显式选定的通道会被调用;选定通道缺少凭据时启动即报错(见 conf.Init),
|
||||
// 避免运行时审核必然失败 —— 审核失败是 fail-closed(拒绝提交),
|
||||
// 会让发布/私信整站不可用,且现象隐蔽(只在日志里)。
|
||||
TextCensorSource string `ini:"text_censor_source"`
|
||||
SecurityAlertEmail string `ini:"security_alert_email"` // 触发封禁时告警收件人(留空不发送)
|
||||
}
|
||||
|
||||
Server struct {
|
||||
|
||||
Reference in New Issue
Block a user