fix auth-required not sending immediate challenge, benchmark leak

This commit is contained in:
2025-11-18 18:21:11 +00:00
parent 038d1959ed
commit 1d4d877a10
6 changed files with 615 additions and 91 deletions

View File

@@ -253,6 +253,12 @@ func (l *Listener) HandleEvent(msg []byte) (err error) {
).Write(l); chk.E(err) {
return
}
// Send AUTH challenge to prompt authentication
log.D.F("HandleEvent: sending AUTH challenge to %s", l.remote)
if err = authenvelope.NewChallengeWith(l.challenge.Load()).
Write(l); chk.E(err) {
return
}
return
}

View File

@@ -118,7 +118,8 @@ whitelist:
chal := make([]byte, 32)
rand.Read(chal)
listener.challenge.Store([]byte(hex.Enc(chal)))
if s.Config.ACLMode != "none" {
// Send AUTH challenge if ACL mode requires it, or if auth is required/required for writes
if s.Config.ACLMode != "none" || s.Config.AuthRequired || s.Config.AuthToWrite {
log.D.F("sending AUTH challenge to %s", remote)
if err = authenvelope.NewChallengeWith(listener.challenge.Load()).
Write(listener); chk.E(err) {