Skip to content
Guides & References

FortiOS SNMP

Worked examples for the FortiOS SNMP template: no SNMPv1 or v2c communities, and SHA authentication with AES privacy for every SNMPv3 user.

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

FortiOS SNMP

Rules for SNMP, the protocol monitoring tools use to poll the firewall. SNMPv1 and v2c send a shared community name in clear text. SNMPv3 with SHA and AES checks who is asking and encrypts the answer. They come from the fortios-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. A card marked changed has one line edited to show a failure.

All the rules come from fortios-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 Fortinet FortiOS templates page lists the file’s known limitations. Run the rules against show full-configuration.

Rule Method Since
No SNMPv1 or v2c communities must_not_match_regex 8.0.2
SNMPv3 users use SHA and AES evaluate_block 8.3.0

No SNMPv1 or v2c communities

A community is a shared password sent in clear text with every poll. This rule fails if there is a config system snmp community block at all.

Definition
// No SNMPv1 or SNMPv2c community is configured (config system snmp community is absent)
#[must_not_match_regex]
/^\s*config\s+system\s+snmp\s+community\b/m
passPassing config: Hardened FortiGate 60F sample (FortiOS 7.4.4, synthetic)
config system snmp sysinfo
set status enable
set contact-info "it@example.net"
set location "Example site"
end
config system snmp user
edit "nms-poller"
set notify-hosts 192.0.2.60
set security-level auth-priv
next
end

Why: There is an SNMPv3 user and no community block.

failFailing config: FortiGate 100F sample (FortiOS 7.4.4, synthetic)
config system snmp community
edit 1
set name "EXAMPLECOMM"
config hosts
edit 1
set ip 192.0.2.60 255.255.255.255
next
end
next
end

Why: A community is set up.

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 FortiOS 7.4.4 (synthetic). Minimum rConfig 8.0.2 (must_not_match_regex). Editions: Pro, Vector, Enterprise.


SNMPv3 users use SHA and AES

This rule checks every config system snmp user block. Each user must use SHA for authentication and AES for privacy, and nothing older. MD5 or DES on any user fails the rule.

Definition
// Every SNMPv3 user uses SHA authentication and AES privacy
#[evaluate_block]
scope: ^config system snmp user$
all:
- regex: '/^\s*set auth-proto sha/m'
- regex: '/^\s*set priv-proto aes/m'
- not:
regex: '/^\s*set auth-proto (?!sha)/m'
- not:
regex: '/^\s*set priv-proto (?!aes)/m'
passPassing config: Hardened FortiGate 60F sample (FortiOS 7.4.4, synthetic)
config system snmp user
edit "nms-poller"
set notify-hosts 192.0.2.60
set security-level auth-priv
set auth-proto sha256
set auth-pwd ENC EXAMPLEONLYAuthKey0001
set priv-proto aes256
set priv-pwd ENC EXAMPLEONLYPrivKey0001
next
end

Why: SHA-256 and AES-256.

failFailing config: Hardened FortiGate 60F sample (FortiOS 7.4.4, synthetic), changed: auth-proto md5 instead of sha256
config system snmp user
edit "nms-poller"
set notify-hosts 192.0.2.60
set security-level auth-priv
set auth-proto md5
set auth-pwd ENC EXAMPLEONLYAuthKey0001
set priv-proto aes256
set priv-pwd ENC EXAMPLEONLYPrivKey0001
next
end

Why: MD5 is not SHA.

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 FortiOS 7.4.4 (synthetic). Minimum rConfig 8.3.0 (evaluate_block). Editions: Pro, Vector, Enterprise.


Type to search.