Skip to content
Guides & References

Junos SNMP

Worked examples for Juniper Junos SNMP: no SNMPv1 or v2c community strings, and SNMPv3 users with SHA authentication and AES encryption.

Policy LibraryUpdated
Platform
juniper-junos
Minimum version
rConfig 8.3.0
Editions
Pro, Vector, Enterprise
On this page

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.

Definition
// No SNMPv1 or SNMPv2c community is configured (fails on set snmp community)
#[must_not_match_regex]
/^set snmp community /m
passPassing config: Hardened EX2300 sample (Junos 23.2, synthetic)
set 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.

failFailing config: Unhardened EX2300 sample (Junos 15.1, synthetic)
set snmp location "Example site"
set snmp contact "noc@example.net"
set snmp community EXAMPLECOMM authorization read-only

Why: A read-only community is set.

Expected result in rConfig, with this rule as the only rule in a definition:

ConfigRule resultOverall result
Passing configpassPASS
Failing configfailFAIL

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.

Definition
// 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'
passPassing config: Hardened EX2300 sample (Junos 23.2, synthetic)
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.

failFailing config: Unhardened EX2300 sample (Junos 15.1, synthetic)
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:

ConfigRule resultOverall result
Passing configpassPASS
Failing configfailFAIL

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.


Type to search.