Bug 153758

Summary: snmpd exec not returning output
Product: Red Hat Enterprise Linux 4 Reporter: Steve Cleveland <steve.cleveland>
Component: net-snmpAssignee: Radek Vokál <rvokal>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 4.0   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-05-09 09:13:01 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Steve Cleveland 2005-04-05 17:48:05 UTC
Description of problem:

Using the 'exec' keyword, you can run custom scripts and have the output
available in snmp queries.  However, after upgrading to rhel4 (from rhel3), I no
longer get the ouput.

Version-Release number of selected component (if applicable):

net-snmp-5.1.2-11

How reproducible:

Every time

Steps to Reproduce:

1. Create a simple shell script.
    #!/bin/csh
    echo "Test";
2. Save it to /usr/bin/mytest.  chmod a+x. Make sure you can run it manually.
3. Add this line to /etc/snmp/snmpd.conf:
    exec testing /usr/bin/mytest
4. Restart snmpd service
5. Run an snmp query:
    snmpwalk -v 2c -c <community> <host> 1.3.6.1.4.1.2021.8
  
Actual results:

UCD-SNMP-MIB::extIndex.1 = INTEGER: 1
UCD-SNMP-MIB::extNames.1 = STRING: testing
UCD-SNMP-MIB::extCommand.1 = STRING: /usr/bin/mytest
UCD-SNMP-MIB::extResult.1 = INTEGER: 1
UCD-SNMP-MIB::extOutput.1 = STRING:
UCD-SNMP-MIB::extErrFix.1 = INTEGER: 0
UCD-SNMP-MIB::extErrFixCmd.1 = STRING:

Expected results:

UCD-SNMP-MIB::extOutput.1 = STRING: Test

Additional info:

This also occurs with custom OID's.  With custom OID's, the extOutput entry
(.101.1) doesn't even show up.

Comment 1 Steve Cleveland 2005-04-22 15:47:18 UTC
It turned out to be SELinux not allowing snmpd to execute anything.  Changing
selinux to permissive allowed snmp to work as expected.  Now I just need to read
up on selinux and figure out how to get them to work together.

Comment 2 Radek Vokál 2005-05-09 09:13:01 UTC
Yep, works same for me. SELinux retrains the output of the script so this only
needs SELinux audit tune-up.