miguan v1
This commit is contained in:
@@ -113,6 +113,53 @@ func SendSecurityAlertMail(ip, provider string, proxied bool, samplePaths []stri
|
||||
return sendTemplateMail(conf.Security.SecurityAlertEmail, "【狼的提问箱】检测到疑似批量扫描,已自动封禁 IP", templates.FS, "mail/security-alert.html", params)
|
||||
}
|
||||
|
||||
// HoneypotAlert 蜜罐捕获到破解尝试时的告警载荷。
|
||||
type HoneypotAlert struct {
|
||||
IP string
|
||||
Provider string
|
||||
Proxied bool
|
||||
Path string
|
||||
Username string
|
||||
Password string
|
||||
Banned bool
|
||||
DurationMin int
|
||||
}
|
||||
|
||||
// SendHoneypotAlertMail 发送「蜜罐捕获到破解尝试」告警。
|
||||
//
|
||||
// 与 SendSecurityAlertMail 共用 conf.Security.SecurityAlertEmail 收件人,不新增配置项。
|
||||
// 邮件中直接给出捕获到的用户名/密码:这是本功能的核心价值(拿到攻击者正在用的字典),
|
||||
// 但也意味着这封邮件是敏感物 —— 收件人应当只有运维本人,不要转发到公共群组。
|
||||
func SendHoneypotAlertMail(a HoneypotAlert) error {
|
||||
proxyHint := ""
|
||||
if a.Proxied {
|
||||
proxyHint = "1"
|
||||
}
|
||||
disposition := "已记录,未触发封禁"
|
||||
if a.Banned {
|
||||
disposition = fmt.Sprintf("已记录并自动临时封禁 %d 分钟", a.DurationMin)
|
||||
}
|
||||
password := a.Password
|
||||
if password == "" {
|
||||
password = "(空)"
|
||||
}
|
||||
username := a.Username
|
||||
if username == "" {
|
||||
username = "(空)"
|
||||
}
|
||||
params := map[string]string{
|
||||
"ip": a.IP,
|
||||
"provider": a.Provider,
|
||||
"proxy_hint": proxyHint,
|
||||
"path": a.Path,
|
||||
"username": username,
|
||||
"password": password,
|
||||
"disposition": disposition,
|
||||
"time": time.Now().Format("2006-01-02 15:04:05"),
|
||||
}
|
||||
return sendTemplateMail(conf.Security.SecurityAlertEmail, "【狼的提问箱】蜜罐捕获到后台破解尝试", templates.FS, "mail/honeypot-alert.html", params)
|
||||
}
|
||||
|
||||
// SendAbuseAlertMail 发送「某箱主收到集中举报」的阈值告警。
|
||||
//
|
||||
// 与 SendSecurityAlertMail 共用 conf.Security.SecurityAlertEmail 收件人,不新增配置项。
|
||||
|
||||
Reference in New Issue
Block a user