rfc2869: add Message-Authenticator (RFC 3579) sign/validate helpers#144
Open
jamiesun wants to merge 1 commit into
Open
rfc2869: add Message-Authenticator (RFC 3579) sign/validate helpers#144jamiesun wants to merge 1 commit into
jamiesun wants to merge 1 commit into
Conversation
The library exposed accessors for the Message-Authenticator attribute
but provided no way to compute or verify its HMAC-MD5 value. RFC 3579
and RFC 5997 require this attribute to be validated (for example, on
Status-Server requests, and as mitigation for Blast-RADIUS style
attacks), so users had to implement the HMAC themselves.
Add opt-in helpers to rfc2869:
- AddMessageAuthenticator places a zeroed placeholder attribute on a
packet before it is encoded.
- SignMessageAuthenticator computes the HMAC-MD5 over the encoded
packet (with the attribute value zeroed) and writes it back.
- ValidateMessageAuthenticator verifies it, returning typed errors for
the missing and mismatched cases.
The computation operates on wire bytes, matching IsAuthenticRequest /
IsAuthenticResponse, and is correct for Access-Request and Status-Server
packets. The output was cross-checked against an independent HMAC-MD5
implementation.
Closes layeh#43
Co-authored-by: Copilot <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The library exposed accessors for the
Message-Authenticatorattribute (RFC 2869, type 80) but provided no way to compute or verify its HMAC-MD5 value. RFC 3579 §3.2 and RFC 5997 require validating this attribute — for example onStatus-Serverrequests, and as part of mitigations for Blast-RADIUS style attacks — so users had to implement the HMAC by hand.This adds opt-in helpers in
rfc2869:The computation operates on wire bytes, matching
IsAuthenticRequest/IsAuthenticResponse, and is correct forAccess-RequestandStatus-Serverpackets (whose own Authenticator field is the HMAC input). The output was cross-checked against an independent HMAC-MD5 implementation.Validating responses additionally requires the original request's authenticator and interacts with
Encode()'s Response-Authenticator computation; that is intentionally left to the caller and documented rather than auto-wired here, keeping this change focused on the request/Status-Server path that the issue is about.Changes
rfc2869/message_authenticator.go(new): sentinel errors +AddMessageAuthenticator,SignMessageAuthenticator,ValidateMessageAuthenticator.rfc2869/message_authenticator_test.go(new): sign/validate (with independent HMAC cross-check), tampered, missing, malformed.This addresses the Message-Authenticator portion of #43.
Closes #43