NX-OS SNMP
Rules for SNMP on a Nexus switch: no clear-text communities, no MD5 users, and encryption for every user. They come from the nxos-snmp policy template.
Every example on this page was checked with rConfig Pro's policy engine on Each of the 6 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 nxos-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 Cisco NX-OS templates page lists the file’s known limitations. Run the rules against show running-config.
| Rule | Method | Since |
|---|---|---|
| No SNMPv1 or v2c community | must_not_match_regex |
8.0.2 |
| No SNMP user with MD5 | must_not_match_regex |
8.0.2 |
| Encryption enforced for every SNMP user | must_match_single_string |
8.0.0 |
No SNMPv1 or v2c community
A community string is a clear-text password. This rule fails if any line starts with snmp-server community.
// No SNMPv1 or SNMPv2c community is configured (line snmp-server community is absent)#[must_not_match_regex]/^snmp-server community /msnmp-server contact noc@example.comsnmp-server location Dublin DC1, row Csnmp-server source-interface traps mgmt0snmp-server host 192.0.2.60 traps version 3 priv netmonsnmp-server host 192.0.2.60 use-vrf managementsnmp-server enable traps linksnmp-server enable traps vpcsnmp-server globalEnforcePrivWhy: No snmp-server community line.
snmp-server contact noc@example.comsnmp-server source-interface traps mgmt0snmp-server host 192.0.2.60 traps version 2c dc1-rosnmp-server host 192.0.2.60 use-vrf managementsnmp-server enable traps linksnmp-server enable traps vpcsnmp-server community dc1-ro group network-operatorWhy: A v2c community is configured.
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 NX-OS 10.3(4a) (synthetic). Minimum rConfig 8.0.2 (must_not_match_regex). Editions: Pro, Vector, Enterprise.
No SNMP user with MD5
MD5 is too weak for SNMPv3 authentication. This rule fails on any snmp-server user line with auth md5. Use auth sha instead.
// No SNMP user uses MD5 authentication (fails on snmp-server user ... auth md5)#[must_not_match_regex]/^snmp-server user \S+ .*\bauth md5\b/msnmp-server user admin network-admin auth sha 0xcc46e4ba8cbe8cf82d43dd6dc0275564 priv aes-128 0x54dece4b157150d7165ae38d03a2f97b localizedkeysnmp-server user netmon network-operator auth sha 0xcc46e4ba8cbe8cf82d43dd6dc0275564 priv aes-128 0x54dece4b157150d7165ae38d03a2f97b localizedkeyWhy: Both users authenticate with SHA.
snmp-server user admin network-admin auth md5 0xcc46e4ba8cbe8cf82d43dd6dc0275564 priv 0x54dece4b157150d7165ae38d03a2f97b localizedkeysnmp-server user netmon network-operator auth md5 0xcc46e4ba8cbe8cf82d43dd6dc0275564 priv aes-128 0x54dece4b157150d7165ae38d03a2f97b localizedkeyWhy: Both users authenticate with MD5.
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 NX-OS 10.3(4a) (synthetic). Minimum rConfig 8.0.2 (must_not_match_regex). Editions: Pro, Vector, Enterprise.
Encryption enforced for every SNMP user
snmp-server globalEnforcePriv makes every SNMP user encrypt its messages, so a user set up without privacy cannot read data in the clear. This rule looks for that exact line.
// SNMP message encryption is enforced for all users (snmp-server globalEnforcePriv)#[must_match_single_string]snmp-server globalEnforcePrivsnmp-server host 192.0.2.60 traps version 3 priv netmonsnmp-server host 192.0.2.60 use-vrf managementsnmp-server enable traps linksnmp-server enable traps vpcsnmp-server globalEnforcePrivWhy: Encryption is enforced.
snmp-server host 192.0.2.60 traps version 2c dc1-rosnmp-server host 192.0.2.60 use-vrf managementsnmp-server enable traps linksnmp-server enable traps vpcsnmp-server community dc1-ro group network-operatorWhy: There is no globalEnforcePriv line.
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 NX-OS 10.3(4a) (synthetic). Minimum rConfig 8.0.0 (must_match_single_string). Editions: Pro, Vector, Enterprise.
Related reference
- Cisco NX-OS policy templates: every rule in
nxos-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.