Add verbose logging for message integrity.

This commit is contained in:
ghost 2025-12-28 22:31:07 +01:00
parent 95c06a4dae
commit d02771b4f8

View File

@ -204,8 +204,12 @@ impl<S: CredentialStore + Clone> AuthManager<S> {
return AuthStatus::Granted { username, key };
}
let key_hex = hex::encode(&key);
warn!("auth reject: bad credentials username={} realm={} peer={} a1_md5={} (debug)", username, realm, peer, key_hex);
// No acceptance without MI validation.
let mi_attr = find_message_integrity(msg).map(|a| hex::encode(&a.value));
let mi_long = hex::encode(&crate::stun::compute_message_integrity(&key, msg.raw.as_slice()));
let mi_short = hex::encode(&crate::stun::compute_message_integrity(short_key, msg.raw.as_slice()));
warn!("auth reject: bad credentials username={} realm={} peer={} a1_md5={} mi_attr={:?} mi_long(fullmsg)={} mi_short(fullmsg)={}",
username, realm, peer, hex::encode(&key), mi_attr, mi_long, mi_short);
AuthStatus::Reject {
code: 401,
reason: "Bad Credentials",