Convert SNMP traps from v1 to v3

1.2k views Asked by At

I'm trying to convert snmp v1 traps to v3. I've followed this discussion but it's vague. I've also looked here but without success.

To be more clear: I have a Centos 6 station, with net-snmp 5.5 on it. I need to generate v1 traps, receive them, convert them to v3, then forward them.

Regarding the first guide, this is what I managed so far:

Master:

snmpd  -Lo --master=agentx --agentXSocket=tcp:192.168.58.64:42000 udp:1161

Listen:

snmpwalk -v3 -u snmpv3user -A snmpv3pass -a MD5 -l authnoPriv 192.168.58.64:1161

Later edit:

I have made some progress, I was able to run snmpd as master, connect snmptrapd as agent to it, then have v1 traps mechanism functional.

I did the following:

    In order to get snmptrapd connected as a subagent to snmpd you need to do the following:

###1  EDIT /etc/hosts.allow and add

snmpd: $(your_ip)
smptrapd: $(your_ip)

this is important because snmptrapd fails silently if rejected
by tcp wrap.

###2 EDIT /etc/snmp/snmpd.conf and add at the bottom of the other
com2sec directives.

com2sec infwnet  $(your_ip)  YOUR-COMMUNITY



add these lines 

group MyROGroup v1         infwnet
group MyROGroup v2c        infwnet
group MyROGroup usm        infwnet

under 

"# Second, map the security names into group names:"

add this view at the bottom of the other views
view all    included  .1                               80  

add this group acces at the bottom of other group access directives

access MyROGroup  ""      any       noauth    exact  all    none   none


add  this line as well:

master agentx

###3 TEST it with this: 

snmpwalk -v1 -c YOUR_COMMUNITY $(your_ip) .


###4 CREATE THE FOLLOWING TRAP TEST EXAMPLE:


touch /usr/share/snmp/mibs/UCD-TRAP-TEST-MIB.txt


###5 COPY PASTE THE TEXT BELOW INTO IT:


 UCD-TRAP-TEST-MIB DEFINITIONS ::= BEGIN
       IMPORTS ucdExperimental FROM UCD-SNMP-MIB;

 demotraps OBJECT IDENTIFIER ::= { ucdExperimental 990 }

 demoTrap TRAP-TYPE
       ENTERPRISE demotraps
       VARIABLES { sysLocation }
       DESCRIPTION "An example of an SMIv1 trap"
       ::= 17

 END


###6 EDIT /etc/sysconfig/snmptrapd (not /etc/default/snmptrapd !!)

replace OPTIONS with this:  

OPTIONS="-Lsd -m ALL -M /usr/share/snmp/mibs  -p /var/run/snmptrapd.pid"

###7 TEST IT WITH


snmptrap -v 1 -c public $(your_ip) UCD-TRAP-TEST-MIB::demotraps "" 6 17 "" SNMPv2-MIB::sysLocation.0 s "Just here"

Now I just need to find a way to convert them to v3 and read/receive them from a remote snmpd

0

There are 0 answers