Problem with traphandlers
Centos 6.1
SNMP version 5.5
Hello.
I'm currently having issues getting trap handling to work. My snmptrapd.conf is
as follows:
# Example configuration file for snmptrapd
#
# No traps are handled by default, you must edit this file!
#
authUser log,execute,net rwlatis
# the generic traps
traphandle default /usr/bin/reboot
logoption s 2
logoption f /var/log/snmptrapd-direct.log
To start with I'm just trying to execute the reboot script (before I move onto
writing my own script). I am testing it by sending the following arbitrary
inform using the command:
snmpinform -v 3 -u rwlatis -l authPriv -a SHA -A "trustno1" -x AES -X
"trustno1" -l authPriv localhost 1 SNMPv2-MIB::coldStart
Now I know the trap is getting through OK because it logs it to the file
'/var/log/snmptrapd-direct.log' which has the following output:
NET-SNMP version 5.5
2012-07-20 14:59:56 localhost [UDP: [127.0.0.1]:55481->[127.0.0.1]]:
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (1) 0:00:00.01
SNMPv2-MIB::snmpTrapOID.0 = OID: SNMPv2-MIB::coldStart
So I'm assuming I've set the user account up properly. It just won't do the
'execute'. I've also ran snmptrapd using the debug flag. The following is a
section of the output:
...
...
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (1) 0:00:00.01
SNMPv2-MIB::snmpTrapOID.0 = OID: SNMPv2-MIB::coldStart
trace: snmp_input(): snmptrapd_handlers.c, 1039:
snmptrapd: Running trap specific handlers
trace: netsnmp_get_traphandler(): snmptrapd_handlers.c, 551:
snmptrapd:lookup: Looking up Trap OID: SNMPv2-MIB::coldStart
trace: netsnmp_get_traphandler(): snmptrapd_handlers.c, 602:
snmptrapd:lookup: get_traphandler default (0x14df408)
trace: netsnmp_trapd_check_auth(): snmptrapd_auth.c, 166:
snmptrapd:auth: Comparing auth types: result=56, request=16, result=1
trace: command_handler(): snmptrapd_handlers.c, 788:
snmptrapd: command_handler
trace: command_handler(): snmptrapd_handlers.c, 789:
snmptrapd: token = '/usr/bin/reboot'
trace: netsnmp_ds_set_boolean(): default_store.c, 205:
netsnmp_ds_set_boolean: Setting LIB:13 = 1/True
trace: command_handler(): snmptrapd_handlers.c, 826:
snmptrapd: execute format
trace: sprint_realloc_by_type(): mib.c, 1961:
output: sprint_by_type, type 67
trace: run_shell_command(): mibgroup/utilities/execute.c, 55:
run_shell_command: running /usr/bin/reboot
trace: run_shell_command(): mibgroup/utilities/execute.c, 56:
run:shell: running '/usr/bin/reboot'
trace: netsnmp_ds_set_string(): default_store.c, 283:
netsnmp_ds_set_string: Setting LIB:15 = "/var/run/net-snmp/snmp-tmp-XXXXXX"
trace: netsnmp_mktemp(): system.c, 1264:
netsnmp_mktemp: temp file created: /var/run/net-snmp/snmp-tmp-Hglejk
trace: netsnmp_ds_set_boolean(): default_store.c, 205:
netsnmp_ds_set_boolean: Setting LIB:13 = 0/False
trace: snmp_input(): snmptrapd_handlers.c, 1039:
...
...
Judging by the line 'run:shell: running '/usr/bin/reboot'' it looks like it's
trying to execute the reboot script. It just doesn't seem to work. I've tried
executing a few other things, like an executable and shell script too, but with
the same result.
If anyone has any ideas I'd be very grateful. I feel like I've hit a brickwall
Thanks
Stuart
Stuart Matson
Senior Software Engineer
Electronics & Integrated Solutions
BAE Systems
Marconi Way
Rochester Kent ME1 2XX
BAE Systems (Operations) Limited
Registered Office: Warwick House, PO Box 87, Farnborough Aerospace Centre,
Farnborough, Hants, GU14 6YU, UK
Registered in England & Wales No: 1996687
Email:
stuart.mat...@baesystems.com<blocked::mailto:stuart.mat...@baesystems.com>
Phone: +44 1634 204081
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users