feat: Warn on missing signing keys when persisting challenges (#1088)

This commit is contained in:
Jason Cameron 2025-09-07 15:43:58 -04:00 committed by GitHub
parent 7e1b5d9951
commit abf6c8de57
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 37 additions and 6 deletions

View file

@ -317,6 +317,16 @@ func main() {
log.Fatalf("can't parse policy file: %v", err)
}
// Warn if persistent storage is used without a configured signing key
if policy.Store.IsPersistent() {
if *hs512Secret == "" && *ed25519PrivateKeyHex == "" && *ed25519PrivateKeyHexFile == "" {
slog.Warn("[misconfiguration] persistent storage backend is configured, but no private key is set. " +
"Challenges will be invalidated when Anubis restarts. " +
"Set HS512_SECRET, ED25519_PRIVATE_KEY_HEX, or ED25519_PRIVATE_KEY_HEX_FILE to ensure challenges survive service restarts. " +
"See: https://anubis.techaro.lol/docs/admin/installation#key-generation")
}
}
ruleErrorIDs := make(map[string]string)
for _, rule := range policy.Bots {
if rule.Action != config.RuleDeny {