Teach the fake test agent SNMPv3/USM so v3 is testable without snmpd#33
Merged
Conversation
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.
The test suite's scriptable fake SNMP agent previously spoke only v1/v2c, so
exercising the daemon's SNMPv3 stack required a real net-snmp agent
(t/real-snmpd.t, opt-in and environment-dependent). This PR makes v3 behavior
and misbehavior testable deterministically with
make testalone.localization for sha1/sha224/sha256/sha384/sha512, truncated HMAC,
AES-128-CFB per RFC 3826), unit-tested against RFC 3414 known-answer
vectors in t/usm.t. Being independent of the C implementation, it
cross-validates the daemon's v3_keys.c / v3_crypto.c end-to-end.
into a shared
_process_pdu(behavior-neutral refactor), and a v3envelope layer is added on top: engine boots/time discovery via a
not-in-time-windows REPORT, request-side HMAC verification, AES-CFB
decryption, and encrypted+authenticated replies (authPriv only, matching
what the daemon emits). Misbehavior knobs:
v3_never_sync(agent stayssilent),
v3_report(forced usmStats report type), andv3_reply_fault(reply signed with a corrupted key, wrong engine id, or wrong username).
daemon: discovery → time-sync → authPriv GET happy path, plus one
scenario per misbehavior knob asserting the daemon drops the bad reply
and
bad_snmp_responsesclimbs.Crypt::Rijndael(the one new test-only CPAN dependency) addedto all cpanm install steps; README's test-dependency list updated.
AES-256 privacy is out of scope: the daemon's setopt path rejects it, so it
is unreachable from tests.
Test plan
make test— 19 files, 393 tests, all green, no snmpd/docker/rootPDU-core refactor
a real net-snmp agent)