Bug 192447

Summary: snmpconf generates snmpd.conf file with wrong SELINUX context
Product: Red Hat Enterprise Linux 4 Reporter: Chris Stankaitis <cstankaitis>
Component: net-snmpAssignee: Jan Safranek <jsafrane>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 4.0CC: dwalsh
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: RHBA-2007-0738 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-11-15 16:00:09 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:
Bug Depends On:    
Bug Blocks: 247461, 247462, 248329    
Attachments:
Description Flags
Example of using matchpathcon and setfscreatecon none

Description Chris Stankaitis 2006-05-19 19:10:41 UTC
Description of problem:

used snmpconf to generate an snmpd.conf file.  file was created without proper
SELINUX user/context as compared to the stock snmpd.conf file.

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

net-snmp-libs-5.1.2-11.EL4.6
net-snmp-5.1.2-11.EL4.6
net-snmp-utils-5.1.2-11.EL4.6


How reproducible:

Always

Steps to Reproduce:
1. cd /etc/snmp
2. mv snmpd.conf snmpd.conf.orig
3. snmpdconf
  
Actual results:

# ls -lZ
-rw-r--r--  root     root     root:object_r:etc_t              snmpd.conf
-rw-r--r--  root     root     system_u:object_r:snmpd_etc_t    snmpd.conf.orig


Expected results:

-rw-r--r--  root     root     system_u:object_r:snmpd_etc_t    snmpd.conf
-rw-r--r--  root     root     system_u:object_r:snmpd_etc_t    snmpd.conf.orig

Additional info:

had to manually - chcon -u system_u -t snmpd_etc_t snmpd.conf

Comment 2 Daniel Walsh 2006-05-30 12:56:05 UTC
snmpd_etc_t is the correct context.  

You can use matchpathcon to get the correct context for the file, and then
setfscreatecon to cause the file to be created with the correct context.

setfilecon will change the file context after it has been created.

I will attach a patch with examples of how this was done in MAKEDEV





Comment 3 Daniel Walsh 2006-05-30 12:57:41 UTC
Created attachment 130225 [details]
Example of using matchpathcon and setfscreatecon

Comment 5 RHEL Program Management 2007-06-13 16:05:24 UTC
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
release.

Comment 10 errata-xmlrpc 2007-11-15 16:00:09 UTC
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.

http://rhn.redhat.com/errata/RHBA-2007-0738.html