Junos SNMP
Rules for SNMP, the protocol monitoring tools use to poll the device. SNMPv1 and v2c send a shared community string in clear text. SNMPv3 can check who is asking and encrypt the answer. They come from the junos-snmp policy template.
Every example on this page was checked with rConfig Pro's policy engine on Each of the 4 configs below was run through rConfig Pro’s evaluator with the rule above it, and gave the result shown. The configs are sanitised excerpts of the sample configs that come with the template.
All the rules come from junos-snmp.policy in the policy templates (v1.5.0). Import the whole file with Import Templates (see importing a policy template), or copy one rule into your own definition. The Juniper Junos templates page lists the file’s known limitations. Run the rules against show configuration | display set.
| Rule | Method | Since |
|---|---|---|
| No SNMPv1 or v2c communities | must_not_match_regex |
8.0.2 |
| SNMPv3 with SHA and AES | evaluate_block |
8.3.0 |
No SNMPv1 or v2c communities
A community string is a shared password sent in clear text with every poll. This rule fails on any set snmp community line.
// No SNMPv1 or SNMPv2c community is configured (fails on set snmp community)#[must_not_match_regex]/^set snmp community /mset snmp location "Example site"set snmp contact "noc@example.net"set snmp v3 usm local-engine user nms-poller authentication-sha256 authentication-key "$9$EXAMPLEONLYFAKEKEY0003"Why: There is no set snmp community line.
set snmp location "Example site"set snmp contact "noc@example.net"set snmp community EXAMPLECOMM authorization read-onlyWhy: A read-only community is set.
Expected result in rConfig, with this rule as the only rule in a definition:
| Config | Rule result | Overall result |
|---|---|---|
| Passing config | pass | PASS |
| Failing config | fail | FAIL |
Framework mapping. The rule provides evidence towards these controls. It does not certify anything.
| Framework | Reference |
|---|---|
| NIST SP 800-53 | SC-12 |
| HIPAA (45 CFR) | 164.312(e)(1) |
| ISO/IEC 27001:2022 Annex A | A.8.5 |
Tested with: sample excerpts from Junos 15.1 (synthetic) and Junos 23.2 (synthetic). Minimum rConfig 8.0.2 (must_not_match_regex). Editions: Pro, Vector, Enterprise.
SNMPv3 with SHA and AES
SNMPv3 users can use weak settings too. This rule needs a local user with SHA authentication and AES-128 privacy, and fails if any user uses MD5, DES, 3DES or none.
// SNMPv3 USM users use SHA authentication and AES-128 privacy, and none uses MD5, DES, 3DES or none#[evaluate_block]all: - regex: '/^set snmp v3 usm local-engine user \S+ authentication-sha/m' - regex: '/^set snmp v3 usm local-engine user \S+ privacy-aes128 /m' - not: regex: '/^set snmp v3 usm \S+(?: \S+)? user \S+ (authentication-(md5|none)|privacy-(des|3des|none))\b/m'set snmp v3 usm local-engine user nms-poller authentication-sha256 authentication-key "$9$EXAMPLEONLYFAKEKEY0003"set snmp v3 usm local-engine user nms-poller privacy-aes128 privacy-key "$9$EXAMPLEONLYFAKEKEY0004"Why: SHA-256 authentication and AES-128 privacy.
set snmp v3 usm local-engine user nms-poller authentication-md5 authentication-key "$9$EXAMPLEONLYFAKEKEY0003"set snmp v3 usm local-engine user nms-poller privacy-des privacy-key "$9$EXAMPLEONLYFAKEKEY0004"Why: MD5 authentication and DES privacy are both weak.
Expected result in rConfig, with this rule as the only rule in a definition:
| Config | Rule result | Overall result |
|---|---|---|
| Passing config | pass | PASS |
| Failing config | fail | FAIL |
Framework mapping. The rule provides evidence towards these controls. It does not certify anything.
| Framework | Reference |
|---|---|
| NIST SP 800-53 | SC-12 |
| HIPAA (45 CFR) | 164.312(e)(1) |
| ISO/IEC 27001:2022 Annex A | A.8.5, A.8.24 |
Tested with: sample excerpts from Junos 15.1 (synthetic) and Junos 23.2 (synthetic). Minimum rConfig 8.3.0 (evaluate_block). Editions: Pro, Vector, Enterprise.
Related reference
- Juniper Junos policy templates: every rule in
junos-snmp.policy, its references and known limitations. - Policy Definitions: the definition file format and every method.
- Policy Assignments: run a definition against your devices.
- Policy Compliance Results: read the pass and fail results.