jeessy2/ddns-go · warning
密码不安全!尝试使用更复杂的密码
Error message
密码不安全!尝试使用更复杂的密码
What it means
CheckPassword validates the new password with passwordvalidator against a minimum entropy of 30 bits (25 if WAN access is allowed). If the password fails the entropy check, ResetPassword returns this error meaning the chosen password is too weak. The message is the user-facing fix hint: pick a more complex password.
Source
Thrown at config/config.go:223
util.Log(err.Error())
return
}
// 保存配置
conf.Password = hashedPwd
conf.SaveConfig()
util.Log("用户名 %s 的密码已重置成功! 请重启ddns-go", conf.Username)
}
// CheckPassword 检查密码
func (conf *Config) CheckPassword(newPassword string) (hashedPwd string, err error) {
var minEntropyBits float64 = 30
if conf.NotAllowWanAccess {
minEntropyBits = 25
}
err = passwordvalidator.Validate(newPassword, minEntropyBits)
if err != nil {
return "", errors.New(util.LogStr("密码不安全!尝试使用更复杂的密码"))
}
// 加密密码
hashedPwd, err = util.HashPassword(newPassword)
if err != nil {
return "", errors.New(util.LogStr("异常信息: %s", err.Error()))
}
return
}
func (conf *DnsConfig) getIpv4AddrFromInterface() string {
ipv4, _, err := GetNetInterface()
if err != nil {
util.Log("从网卡获得IPv4失败")
return ""
}
for _, netInterface := range ipv4 {View on GitHub (pinned to 5874c2e666)
Solutions
- Choose a longer, more complex password (add length, mixed case, digits, symbols) so entropy meets the threshold
- Check whether NotAllowWanAccess is set — if true the stricter 30-bit threshold applies; either strengthen the password or adjust the setting consciously
- If legitimate passwords are rejected, lower minEntropyBits in config.go or adjust validator configuration
Example fix
// before
err = passwordvalidator.Validate(newPassword, minEntropyBits)
if err != nil {
return "", errors.New(util.LogStr("密码不安全!尝试使用更复杂的密码"))
}
// after
// no code change: pick a stronger password, e.g. >= 12 chars with mixed classes
// newPassword = "Tr0ub4dor&3LongerPhrase!" Defensive patterns
Strategy: validation
Validate before calling
// client-side pre-check before calling ResetPassword
function passwordLooksStrong(pw, minLen = 10) {
return typeof pw === 'string' &&
pw.length >= minLen &&
/[a-z]/.test(pw) && /[A-Z]/.test(pw) &&
/\d/.test(pw) && /[^A-Za-z0-9]/.test(pw);
} Type guard
null
Try / catch
newPwd, err := conf.CheckPassword(input)
if err != nil {
if strings.Contains(err.Error(), "密码不安全") {
// prompt user to choose a stronger password
return fmt.Errorf("密码强度不足: %w", err)
}
return err
} Prevention
- Enforce a client-side password strength meter before submission
- Require a minimum length (>= 10-12) plus mixed character classes
- Account for stricter thresholds when NotAllowWanAccess is enabled (30-bit minimum)
- Standardize on passphrases rather than short complex strings
When it happens
Trigger: Calling ResetPassword (which invokes CheckPassword) with a newPassword whose estimated entropy is below minEntropyBits — e.g. short passwords, dictionary words, no digits/symbols/case mix.
Common situations: User picks a simple password like '123456' or 'password'; minEntropyBits is raised to 30 when NotAllowWanAccess is true, so a password acceptable in LAN mode is rejected; validator version change tightened scoring.
Related errors
AI-assisted analysis of jeessy2/ddns-go@5874c2e666 (2026-09-03).
Data as JSON: /api/errors/935669f7fd29e22a.
Report an issue: GitHub.