Bug 401211 - snmptrapd when using traphandlers defaults to /tmp for temp files, breaks selinux rules
snmptrapd when using traphandlers defaults to /tmp for temp files, breaks sel...
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: net-snmp (Show other bugs)
All Linux
low Severity low
: ---
: ---
Assigned To: Jan Safranek
Depends On:
Blocks: 417921
  Show dependency treegraph
Reported: 2007-11-27 11:03 EST by Larry Low
Modified: 2008-05-21 11:42 EDT (History)
1 user (show)

See Also:
Fixed In Version: RHBA-2008-0376
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2008-05-21 11:42:13 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
audit log (5.14 KB, text/plain)
2007-12-03 07:29 EST, Jan Safranek
no flags Details

  None (edit)
Description Larry Low 2007-11-27 11:03:14 EST
Description of problem:
snmptrapd requires write access to /tmp/snmpdXXXXXX when using traphandlers. 
This can be defined through NETSNMP_TEMP_FILE_PATTERN.

I suggest creating a new context for these files as well as a context for
executing the external traphandlers.

I also see that the "self:udp_socket connect" context must be allowed as well. 
This I do not completely understand.

How reproducible:

Steps to Reproduce:
1. SELinux set to enforcing
2. Create traphandler in /etc/snmp/snmptrapd.conf
3. Send trap to snmptrapd that will be executed by traphandler
4. Review audit log
Comment 2 Jan Safranek 2007-12-03 07:29:23 EST
Created attachment 275641 [details]
audit log
Comment 3 Jan Safranek 2007-12-03 07:30:26 EST
Please ignore traphandler.pl in the log, focus on snmptrapd.
Comment 4 Daniel Walsh 2007-12-03 13:05:51 EST
Daemons should not be using /tmp for anything.  /tmp is for users.
/var/run is for daemons.

/tmp can be attacked by a user.

/var/run can not.

So smpmtrapd should be setup to write its temp files to /var/run.  If it needs
to have the temporary files survive a reboot it should use /var/cache.  

Comment 5 Jan Safranek 2007-12-05 06:24:08 EST
Good point, I'll put it there. Thanks!
Comment 6 RHEL Product and Program Management 2007-12-05 06:24:26 EST
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
Comment 12 errata-xmlrpc 2008-05-21 11:42:13 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.


Note You need to log in before you can comment on or make changes to this bug.