Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 546078 - net-analyzer/net-snmp incorrect security context of /usr/sbin/snmpd
Summary: net-analyzer/net-snmp incorrect security context of /usr/sbin/snmpd
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: SELinux (show other bugs)
Hardware: All Linux
: Normal trivial (vote)
Assignee: Jason Zaman
URL:
Whiteboard: sec-policy r5
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-09 17:52 UTC by Oleg Gawriloff
Modified: 2015-06-05 16:18 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Oleg Gawriloff 2015-04-09 17:52:04 UTC
After installing net-snmp with selinux flag and rlpkg -a -r we see that snmpd binary is in improper context:
albatros2-vbox1 sel # ps ugaxwZ | grep snmpd
system_u:system_r:initrc_t      root      9559  0.0  0.2  43360  4356 ?        S    20:36   0:00 /usr/sbin/snmpd -p /var/run/snmpd.pid -Lf /dev/null
Бинарник был:
albatros2-vbox1 sel # ls -Z /usr/sbin/snmpd
system_u:object_r:bin_t /usr/sbin/snmpd

So in audit logs we see in turn following:
Apr  9 20:26:37 albatros2-vbox1 kernel: audit: type=1400 audit(1428600397.357:1574): avc:  denied  { use } for  pid=8900 comm="syslog-ng" path="pipe:[507602]" dev="pipefs" ino=507602 scontext=system_u:system_r:syslogd_t tcontext=staff_u:sysadm_r:sysadm_t tclass=fd
Apr  9 20:26:37 albatros2-vbox1 kernel: audit: type=1400 audit(1428600397.357:1575): avc:  denied  { write } for  pid=8900 comm="syslog-ng" path="pipe:[507602]" dev="pipefs" ino=507602 scontext=system_u:system_r:syslogd_t tcontext=staff_u:sysadm_r:sysadm_t tclass=fifo_file
Apr  9 20:26:37 albatros2-vbox1 kernel: audit: type=1400 audit(1428600397.387:1576): avc:  denied  { use } for  pid=8902 comm="checkpath" path="pipe:[507602]" dev="pipefs" ino=507602 scontext=system_u:system_r:tmpfiles_t tcontext=staff_u:sysadm_r:sysadm_t tclass=fd
Apr  9 20:26:37 albatros2-vbox1 kernel: audit: type=1400 audit(1428600397.387:1577): avc:  denied  { write } for  pid=8902 comm="checkpath" path="pipe:[507602]" dev="pipefs" ino=507602 scontext=system_u:system_r:tmpfiles_t tcontext=staff_u:sysadm_r:sysadm_t tclass=fifo_file
Apr  9 20:26:37 albatros2-vbox1 kernel: audit: type=1400 audit(1428600397.387:1578): avc:  denied  { getattr } for  pid=8902 comm="openrc" path="/var/lib/syslog-ng" dev="sda1" ino=2041925 scontext=system_u:system_r:tmpfiles_t tcontext=system_u:object_r:syslogd_var_lib_t tclass=dir
Apr  9 20:26:37 albatros2-vbox1 kernel: audit: type=1400 audit(1428600397.387:1579): avc:  denied  { relabelfrom } for  pid=8902 comm="openrc" name="syslog-ng" dev="sda1" ino=2041925 scontext=system_u:system_r:tmpfiles_t tcontext=system_u:object_r:syslogd_var_lib_t tclass=dir
Apr  9 20:26:37 albatros2-vbox1 kernel: audit: type=1400 audit(1428600397.387:1580): avc:  denied  { relabelto } for  pid=8902 comm="openrc" name="syslog-ng" dev="sda1" ino=2041925 scontext=system_u:system_r:tmpfiles_t tcontext=system_u:object_r:syslogd_var_lib_t tclass=dir

After chcon -t snmpd_exec_t /usr/sbin/snmpd all goes well as it should


Reproducible: Always
Comment 1 Jason Zaman gentoo-dev 2015-04-11 11:42:20 UTC
can you post ls -lZ /etc/init.d/snmpd or whatever the init script is called. it should be snmpd_initrc_exec_t, is that correct?

are there any other binaries that get installed that are missing labels?
the policy fc file mentions
/usr/sbin/snmptrap	--	gen_context(system_u:object_r:snmpd_exec_t,s0)
/usr/sbin/snmptrapd	--	gen_context(system_u:object_r:snmpd_exec_t,s0)
are those still correct as well?

if the only thing missing is /usr/sbin/snmpd, then i'll add that to the policy.

Thanks!
Comment 2 Oleg Gawriloff 2015-04-13 05:30:11 UTC
gawriloff@albatros2-vbox1 ~ $ ls -lZ /etc/init.d/snmpd
-rwxr-xr-x. 1 root root system_u:object_r:snmpd_initrc_exec_t 797 апр  9 16:06 /etc/init.d/snmpd


gawriloff@albatros2-vbox1 ~ $ ls -lZ /usr/sbin/snmp*
-rwxr-xr-x. 1 root root system_u:object_r:snmpd_exec_t 31456 апр  9 16:06 /usr/sbin/snmpd
-rwxr-xr-x. 1 root root system_u:object_r:snmpd_exec_t 31520 апр  9 16:06 /usr/sbin/snmptrapd


So, yes. It seems only /usr/sbin/snmpd have missing label.
Comment 3 Jason Zaman gentoo-dev 2015-04-13 16:03:14 UTC
sent this upstream. will apply to our repo once its been applied up there. it'll be in the next release.
Comment 4 Jason Zaman gentoo-dev 2015-04-16 21:57:19 UTC
in policy -r5
Comment 5 Jason Zaman gentoo-dev 2015-06-05 16:18:06 UTC
r5 policy has been stabilized