SNMPv3:未找到远程 snmptrap 引擎 ID

SNMPv3:未找到远程 snmptrap 引擎 ID

我无法snmptrapd接受远程 SNMPv3 TRAP 消息。

这是我的简单 snmptrapd.conf:

root@snmptrapper:~# cat /tmp/testsnmptrapd.conf
createUser -e 0x80001f8880013da3af54da7882 skohrs MD5 PaSSWoRD DES
createUser -e 0x80001f888047483cc654cfeee8 skohrs MD5 PaSSWoRD DES
authUser log skohrs

当我启动服务时,我可以看到它创建了两个用户。但是,当远程消息传入时,它无法匹配远程引擎ID:

root@snmptrapper:~# snmptrapd -f -C -c /tmp/testsnmptrapd.conf -Le -Dusm,usmUser,snmptrapd
registered debug token usm, 1
registered debug token usmUser, 1
registered debug token snmptrapd, 1
netsnmp_assert !"registration != duplicate" failed agent_registry.c:535 netsnmp_subtree_load()
netsnmp_assert !"registration != duplicate" failed agent_registry.c:535 netsnmp_subtree_load()
netsnmp_assert !"registration != duplicate" failed agent_registry.c:535 netsnmp_subtree_load()
usmUser: created a new user skohrs at 80 00 1F 88 80 01 3D A3 AF 54 DA 78 82
usmUser: created a new user skohrs at 80 00 1F 88 80 47 48 3C C6 54 CF EE E8
NET-SNMP version 5.4.1


usm: USM processing begun...
usm: match on user skohrs
usm: no match on engineID (80 00 1F 88 80 47 48 3C C6 54 CF EE E8 )
usm: match on user skohrs
usm: Verification succeeded.
usm: USM processing completed.
snmptrapd: input: a7
snmptrapd: Trap OID: DISMAN-EVENT-MIB::sysUpTimeInstance
snmptrapd: Running auth trap handlers
snmptrapd:auth: Comparing auth types: result=8, request=0, result=1
snmptrapd:auth: Calling VACM for checking phase 0:read
snmptrapd:auth:   result: not authorized
snmptrapd:auth: Calling VACM for checking phase 1:write
snmptrapd:auth:   result: not authorized
snmptrapd:auth: Calling VACM for checking phase 2:notify
snmptrapd:auth:   result: not authorized
snmptrapd:auth: Calling VACM for checking phase 3:log
snmptrapd:auth:   result: not authorized
snmptrapd:auth: Calling VACM for checking phase 4:execute
snmptrapd:auth:   result: not authorized
snmptrapd:auth: Calling VACM for checking phase 5:net
snmptrapd:auth:   result: not authorized
snmptrapd:auth: Calling VACM for checking phase 6:(null)
snmptrapd:auth:   result: not authorized
snmptrapd:auth: Calling VACM for checking phase 7:(null)
snmptrapd:auth:   result: not authorized
snmptrapd:auth: Final bitmask auth: 0
snmptrapd:auth: Dropping unauthorized message

如果我从本地主机发送 SNMPv3 TRAP,则会记录以下消息:

usm: USM processing begun...
usm: match on user skohrs
usm: Verification succeeded.
usm: USM processing completed.
snmptrapd: input: a7
snmptrapd: Trap OID: DISMAN-EVENT-MIB::sysUpTimeInstance
snmptrapd: Running auth trap handlers
snmptrapd:auth: Comparing auth types: result=0, request=0, result=1
snmptrapd:auth: Calling VACM for checking phase 0:read
snmptrapd:auth:   result: not authorized
snmptrapd:auth: Calling VACM for checking phase 1:write
snmptrapd:auth:   result: not authorized
snmptrapd:auth: Calling VACM for checking phase 2:notify
snmptrapd:auth:   result: not authorized
snmptrapd:auth: Calling VACM for checking phase 3:log
snmptrapd:auth:   result: authorized
snmptrapd:auth: Calling VACM for checking phase 4:execute
snmptrapd:auth:   result: not authorized
snmptrapd:auth: Calling VACM for checking phase 5:net
snmptrapd:auth:   result: not authorized
snmptrapd:auth: Calling VACM for checking phase 6:(null)
snmptrapd:auth:   result: not authorized
snmptrapd:auth: Calling VACM for checking phase 7:(null)
snmptrapd:auth:   result: not authorized
snmptrapd:auth: Final bitmask auth: 8
snmptrapd: Running pre-global trap handlers
snmptrapd:auth: Comparing auth types: result=8, request=8, result=1
snmptrapd: print_handler
snmptrapd: v2/3 format
2015-02-11 09:40:51 localhost [UDP: [127.0.0.1]:48403]:
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (55) 0:00:00.55        SNMPv2-MIB::snmpTrapOID.0 = OID: DISMAN-EVENT-MIB::sysUpTimeInstance
snmptrapd: Running trap specific handlers
snmptrapd: get_traphandler default (0)
snmptrapd: Running global handlers
snmptrapd:auth: Comparing auth types: result=8, request=8, result=1
snmptrapd: notification_handler

snmptrap如果出现问题,下面是我使用的命令:

root@client:~# snmptrap -v3 -a MD5 -A PaSSWoRD -x DES -X PaSSWoRD -u skohrs -mALL -l authPriv -Dusm snmptrapper 55 sysUpTime.0

net-snmp 维基手册页没有多大帮助。我希望这里有人可以提供一些指导。

答案1

snmptrapd我通过启用所有调试选项发现了问题-Dall

root@snmptrapper:~# snmptrapd -f -C -c /root/testsnmptrapd.conf -Le -Dall

问题原来是 中设置了错误的上下文~/.snmp/snmp.conf。我在初始 SNMPv3 设置中创建了这个文件。

root@client:~# cat ~/.snmp/snmp.conf
defContext none
defVersion 3
defSecurityName skohrs
defAuthType MD5
defAuthPassphrase PaSSWoRD
defPrivType DES
defPrivPassphrase PaSSWoRD
defSecurityLevel authPriv

我误解了这defContext none与将上下文设置为不同""。当我删除该令牌时,远程 SNMPv3 TRAP 消息被正确记录。

相关内容