Skip to contentSkip to conversation

patch: add assert statement for syslog

PATCH Thomas Bleher 4 participants 5 messages Nov 1, 2004 – Nov 5, 2004 SELinux security module

lore
Share & tools
lore
#0 lore raw

The following patch adds an assertion so that only domains with the "privlog"-attribute can actually syslog.

Please apply.
Thomas

Signature · 2 lines
http://www.cip.ifi.lmu.de/~bleher/selinux/ - my SELinux pages
GPG-Fingerprint: BC4F BB16 30D6 F253 E3EA  D09E C562 2BAE B2F4 ABE7
assert.te +5 -0
@@ -68,6 +68,11 @@
 neverallow { domain -privmem } memory_device_t:devfile_class_set { read write append };
 
 #
+# Verify that only domains with the privlog attribute can actually syslog
+#
+neverallow { domain -unrestricted -privlog } devlog_t:sock_file { read write append };
+
+#
 # Verify that /proc/kmsg is only accessible to klogd.
 #
 ifdef(`klogd.te', `
attrib.te +2 -6
@@ -76,12 +76,8 @@
 
 # The privlog attribute identifies every domain that can 
 # communicate with syslogd through its Unix domain socket.
-# This attribute is used in the TE rules in 
-# domains/program/syslogd.te to grant such access.  
-# XXX If you want to mandate the use of this attribute for all 
-# XXX domains that can log, then you should also write corresponding 
-# XXX assertions in assert.te to enforce this restriction.  Otherwise,
-# XXX it is just an optional convenience for domain writers.
+# There is an assertion that other domains can not do it,
+# and an allow rule to permit it
 attribute privlog;
 
 # The privmodule attribute identifies every domain that can run
#1 lore raw
Quoted 2 lines · Thomas Bleher

The following patch adds an assertion so that only domains with the "privlog"-attribute can actually syslog.

Unless I'm missing a 'privlog' entry on a 'type' line someplace, this basically means that unless you write some policy, an arbitrary program can't syslog() at all. This does help prevent "flood the syslog" attacks, but I'm not sure we want to be *that* draconian without a site-settable flag.

It sort of renders /usr/bin/logger in a shell script useless, for starters...

#2 lore raw
Quoted 6 lines · On Mon, 2004-11-01 at 12:45, [email protected] wrote:

Unless I'm missing a 'privlog' entry on a 'type' line someplace, this basically means that unless you write some policy, an arbitrary program can't syslog() at all. This does help prevent "flood the syslog" attacks, but I'm not sure we want to be *that* draconian without a site-settable flag.

It sort of renders /usr/bin/logger in a shell script useless, for starters...

The patch merely adds an assertion to verify what should already be true in the policy, i.e. that every domain authorized to write to the /dev/log socket has the privlog attribute. syslogd.te includes the following rules that allow this to happen for such domains:

# Domains with the privlog attribute may log to syslogd. allow privlog devlog_t:sock_file rw_file_perms; can_unix_send(privlog,syslogd_t) can_unix_connect(privlog,syslogd_t)

Signature · 8 lines
Stephen Smalley <[email protected]>
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#3 lore raw
Quoted 3 lines · Stephen Smalley

The patch merely adds an assertion to verify what should already be true in the policy, i.e. that every domain authorized to write to the /dev/log socket has the privlog attribute.

Pass me the caffeine, will ya? ;)

For some reason, I was convinced that macros/user-macros.te had a ifdef that lopped out the privlog stuff - in fact, it sticks a 'dontaudit' on it.

#4 lore raw
In reply to Thomas Bleher

Merged.

Quoted 5 lines · Thomas Bleher

The following patch adds an assertion so that only domains with the "privlog"-attribute can actually syslog.

Please apply.
Thomas

Signature · 7 lines
James Carter <[email protected]>
National Security Agency

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.