Gentoo Archives: gentoo-hardened

From: Ben Pritchard <ben@××××××.org>
To: gentoo-hardened@l.g.o
Subject: [gentoo-hardened] Incorrect contexts in /run
Date: Sun, 02 Mar 2014 21:36:39
Message-Id: <20140302213622.GA2191@imap.bennyp.org:5982>
1 Hello
2
3 I have a few files/directories in /run (or /var/run) that do not have the
4 correct selinux contexts. Notably, files belonging to samba and fail2ban,
5 but there may be others.
6
7 I thought this might be related to the /run migration bug (424173) but
8 it seems to restore to the correct contexts, just that the files are not
9 created with the correct contexts. How are the contexts of these files
10 usually managed?
11
12
13 #output from matchpathcon:
14 /run/dbus.pid has context system_u:object_r:system_dbusd_var_run_t, should be <<none>>
15 /run/fail2ban has context system_u:object_r:initrc_var_run_t, should be system_u:object_r:fail2ban_var_run_t
16 /run/lvm has context system_u:object_r:initrc_var_run_t, should be system_u:object_r:var_run_t
17 /run/ntpd.pid has context system_u:object_r:initrc_var_run_t, should be system_u:object_r:ntpd_var_run_t
18 /run/privoxy-tor.pid has context system_u:object_r:privoxy_var_run_t, should be <<none>>
19 /run/samba has context system_u:object_r:initrc_var_run_t, should be system_u:object_r:smbd_var_run_t
20 /run/saslauthd has context system_u:object_r:initrc_var_run_t, should be system_u:object_r:var_run_t
21 /run/sepermit has context system_u:object_r:initrc_var_run_t, should be system_u:object_r:pam_var_run_t
22 /run/sshd.pid has context system_u:object_r:sshd_var_run_t, should be <<none>>
23 /run/syslog-ng.ctl has context system_u:object_r:devlog_t, should be system_u:object_r:syslogd_var_run_t
24
25 #output from restorcon -rv /run
26 restorecon: Warning no default label for /run/sshd.pid
27 restorecon: Warning no default label for /run/privoxy-tor.pid
28 restorecon reset /run/ntpd.pid context system_u:object_r:initrc_var_run_t->system_u:object_r:ntpd_var_run_t
29 restorecon reset /run/fail2ban context system_u:object_r:initrc_var_run_t->system_u:object_r:fail2ban_var_run_t
30 restorecon reset /run/fail2ban/fail2ban.sock context system_u:object_r:initrc_var_run_t->system_u:object_r:fail2ban_var_run_t
31 restorecon reset /run/fail2ban/fail2ban.pid context system_u:object_r:initrc_var_run_t->system_u:object_r:fail2ban_var_run_t
32 restorecon reset /run/syslog-ng.ctl context system_u:object_r:devlog_t->system_u:object_r:syslogd_var_run_t
33 restorecon: Warning no default label for /run/dbus.pid
34 restorecon reset /run/sepermit context system_u:object_r:initrc_var_run_t->system_u:object_r:pam_var_run_t
35 restorecon reset /run/samba context system_u:object_r:initrc_var_run_t->system_u:object_r:smbd_var_run_t
36 restorecon reset /run/samba/nmbd.pid context system_u:object_r:initrc_var_run_t->system_u:object_r:nmbd_var_run_t
37 restorecon reset /run/samba/smbd.pid context system_u:object_r:initrc_var_run_t->system_u:object_r:smbd_var_run_t
38 restorecon reset /run/lvm context system_u:object_r:initrc_var_run_t->system_u:object_r:var_run_t
39 restorecon reset /run/saslauthd context system_u:object_r:initrc_var_run_t->system_u:object_r:var_run_t
40 restorecon reset /run/lock/lvm context system_u:object_r:var_lock_t->system_u:object_r:lvm_lock_t
41
42 #from the mount command:
43 tmpfs on /run type tmpfs (rw,rootcontext=system_u:object_r:var_run_t,seclabel,nosuid,nodev,relatime,mode=755)
44
45
46 Thanks
47 --
48 Ben Pritchard
49 ben@××××××.org