All of lore.kernel.org
 help / color / mirror / Atom feed
From: Russell Coker <russell@coker.com.au>
To: jwcart2@epoch.ncsc.mil
Cc: SELinux <selinux@tycho.nsa.gov>
Subject: Re: policy patch
Date: Sat, 28 Aug 2004 23:46:05 +1000	[thread overview]
Message-ID: <200408282346.05926.russell@coker.com.au> (raw)
In-Reply-To: <1093640295.24188.29.camel@moss-lions.epoch.ncsc.mil>

[-- Attachment #1: Type: text/plain, Size: 1122 bytes --]

On Sat, 28 Aug 2004 06:58, James Carter <jwcart2@epoch.ncsc.mil> wrote:
> Also added:
>  allow hotplug_t udev_helper_exec_t:lnk_file read;
> It seems reasonable and I was seeing a lot of denials, but it might be
> possible to use a dontaudit.

I think that a better thing to do is to use "--" on the file_contexts entry 
for an executable file and have any sym-links with similar named get bin_t or 
sbin_t.  The contents of a sym-link are almost never of any relevance to the 
security of the system, but adding more rules increases the size of the 
policy and the work for all of us.  Also as a side-affect specifying the 
class of the object to be labelled makes setfiles run faster.

I have attached a patch which adds -- to all types ending in _exec_t.  It also 
fixes some bugs in the spamassasin policy and adds a couple of other file 
contexts things as well.

-- 
http://www.coker.com.au/selinux/   My NSA Security Enhanced Linux packages
http://www.coker.com.au/bonnie++/  Bonnie++ hard drive benchmark
http://www.coker.com.au/postal/    Postal SMTP/POP benchmark
http://www.coker.com.au/~russell/  My home page

[-- Attachment #2: fc.diff --]
[-- Type: text/x-diff, Size: 9876 bytes --]

diff -ru /usr/src/se/policy/file_contexts/program/distcc.fc file_contexts/program/distcc.fc
--- /usr/src/se/policy/file_contexts/program/distcc.fc	2004-07-29 06:04:18.000000000 +1000
+++ file_contexts/program/distcc.fc	2004-08-28 23:28:02.000000000 +1000
@@ -1,2 +1,2 @@
 # distcc
-/usr/bin/distccd		system_u:object_r:distccd_exec_t
+/usr/bin/distccd	--	system_u:object_r:distccd_exec_t
diff -ru /usr/src/se/policy/file_contexts/program/dovecot.fc file_contexts/program/dovecot.fc
--- /usr/src/se/policy/file_contexts/program/dovecot.fc	2004-07-13 09:08:03.000000000 +1000
+++ file_contexts/program/dovecot.fc	2004-08-24 18:08:10.000000000 +1000
@@ -1,6 +1,12 @@
 # for Dovecot POP and IMAP server
 /usr/sbin/dovecot		--	system_u:object_r:dovecot_exec_t
+ifdef(`distro_redhat', `
 /usr/libexec/dovecot/dovecot-auth --	system_u:object_r:dovecot_auth_exec_t
+')
+ifdef(`distro_debian', `
+/usr/lib/dovecot/dovecot-auth	--	system_u:object_r:dovecot_auth_exec_t
+/usr/lib/dovecot/.+		--	system_u:object_r:bin_t
+')
 /usr/share/ssl/certs/dovecot.pem --	system_u:object_r:dovecot_cert_t
 /usr/share/ssl/private/dovecot.pem --	system_u:object_r:dovecot_cert_t
 /var/run/dovecot(-login)?(/.*)?		system_u:object_r:dovecot_var_run_t
diff -ru /usr/src/se/policy/file_contexts/program/dpkg.fc file_contexts/program/dpkg.fc
--- /usr/src/se/policy/file_contexts/program/dpkg.fc	2004-08-19 17:10:38.000000000 +1000
+++ file_contexts/program/dpkg.fc	2004-08-28 23:25:01.000000000 +1000
@@ -15,7 +15,7 @@
 /usr/sbin/dpkg-preconfigure --	system_u:object_r:dpkg_exec_t
 /usr/sbin/install-menu	--	system_u:object_r:install_menu_exec_t
 /usr/share/applnk(/.*)?		system_u:object_r:debian_menu_t
-/usr/share/debconf(/.*)?	system_u:object_r:dpkg_exec_t
+/usr/share/debconf/.+	--	system_u:object_r:dpkg_exec_t
 /usr/share/debiandoc-sgml/saspconvert -- system_u:object_r:bin_t
 /usr/share/lintian/.+	--	system_u:object_r:bin_t
 /usr/share/kernel-package/.+ -- system_u:object_r:bin_t
diff -ru /usr/src/se/policy/file_contexts/program/firstboot.fc file_contexts/program/firstboot.fc
--- /usr/src/se/policy/file_contexts/program/firstboot.fc	2004-04-03 21:37:23.000000000 +1000
+++ file_contexts/program/firstboot.fc	2004-08-28 23:25:18.000000000 +1000
@@ -1,4 +1,4 @@
 # firstboot
 /usr/sbin/firstboot	-- system_u:object_r:firstboot_exec_t
 /usr/share/firstboot	system_u:object_r:firstboot_rw_t
-/usr/share/firstboot/firstboot.py	system_u:object_r:firstboot_exec_t
+/usr/share/firstboot/firstboot.py --	system_u:object_r:firstboot_exec_t
diff -ru /usr/src/se/policy/file_contexts/program/initrc.fc file_contexts/program/initrc.fc
--- /usr/src/se/policy/file_contexts/program/initrc.fc	2004-08-28 12:05:09.000000000 +1000
+++ file_contexts/program/initrc.fc	2004-08-28 23:29:40.000000000 +1000
@@ -13,8 +13,12 @@
 /var/run/setmixer_flag	--	system_u:object_r:initrc_var_run_t
 # run_init
 /usr/sbin/run_init	--	system_u:object_r:run_init_exec_t
+ifdef(`distro_debian', `
 /usr/sbin/open_init_pty	--	system_u:object_r:initrc_exec_t
+')
 /etc/nologin.*		--	system_u:object_r:etc_runtime_t
 /etc/nohotplug		--	system_u:object_r:etc_runtime_t
+ifdef(`distro_redhat', `
 /halt                   --      system_u:object_r:etc_runtime_t
 /\.autofsck             --      system_u:object_r:etc_runtime_t
+')
diff -ru /usr/src/se/policy/file_contexts/program/jabberd.fc file_contexts/program/jabberd.fc
--- /usr/src/se/policy/file_contexts/program/jabberd.fc	2004-06-17 15:10:43.000000000 +1000
+++ file_contexts/program/jabberd.fc	2004-08-28 23:25:26.000000000 +1000
@@ -1,3 +1,3 @@
 # jabberd
-/usr/sbin/jabberd		system_u:object_r:jabberd_exec_t
+/usr/sbin/jabberd	--	system_u:object_r:jabberd_exec_t
 /var/lib/jabber(/.*)?		system_u:object_r:jabberd_var_lib_t
diff -ru /usr/src/se/policy/file_contexts/program/kerberos.fc file_contexts/program/kerberos.fc
--- /usr/src/se/policy/file_contexts/program/kerberos.fc	2004-06-24 22:50:07.000000000 +1000
+++ file_contexts/program/kerberos.fc	2004-08-28 23:25:48.000000000 +1000
@@ -1,11 +1,11 @@
 # MIT Kerberos krbkdc, kadmind
 /etc/krb5\.keytab       		system_u:object_r:krb5_keytab_t
-/usr(/local)?(/kerberos)?/sbin/krb5kdc 	system_u:object_r:krb5kdc_exec_t
-/usr(/local)?(/kerberos)?/sbin/kadmind	system_u:object_r:kadmind_exec_t
+/usr(/local)?(/kerberos)?/sbin/krb5kdc --	system_u:object_r:krb5kdc_exec_t
+/usr(/local)?(/kerberos)?/sbin/kadmind --	system_u:object_r:kadmind_exec_t
 /var/kerberos/krb5kdc(/.*)?		system_u:object_r:krb5kdc_conf_t
 /usr/local/var/krb5kdc(/.*)?		system_u:object_r:krb5kdc_conf_t
 /var/kerberos/krb5kdc/principal.*	system_u:object_r:krb5kdc_principal_t
 /usr/local/var/krb5kdc/principal.*	system_u:object_r:krb5kdc_principal_t
 /var/log/krb5kdc.log			system_u:object_r:krb5kdc_log_t
 /var/log/kadmind.log			system_u:object_r:kadmind_log_t
-/usr(/local)?/bin/ksu			system_u:object_r:su_exec_t
+/usr(/local)?/bin/ksu		--	system_u:object_r:su_exec_t
diff -ru /usr/src/se/policy/file_contexts/program/named.fc file_contexts/program/named.fc
--- /usr/src/se/policy/file_contexts/program/named.fc	2004-08-28 12:05:10.000000000 +1000
+++ file_contexts/program/named.fc	2004-08-28 22:53:56.000000000 +1000
@@ -1,8 +1,10 @@
 # named
+ifdef(`distro_redhat', `
 /var/named(/.*)?		system_u:object_r:named_zone_t
 /var/named/slaves(/.*)?		system_u:object_r:named_cache_t
 /var/named/data(/.*)?		system_u:object_r:named_cache_t
 /etc/named\.conf	--	system_u:object_r:named_conf_t
+') dnl end distro_redhat
 
 ifdef(`distro_debian', `
 /etc/bind(/.*)?			system_u:object_r:named_zone_t
diff -ru /usr/src/se/policy/file_contexts/program/openca-ca.fc file_contexts/program/openca-ca.fc
--- /usr/src/se/policy/file_contexts/program/openca-ca.fc	2004-06-17 15:10:43.000000000 +1000
+++ file_contexts/program/openca-ca.fc	2004-08-28 23:26:09.000000000 +1000
@@ -5,4 +5,4 @@
 /var/lib/openca/crypto/keys(/.*)?	system_u:object_r:openca_var_lib_keys_t
 /usr/share/openca(/.*)?		system_u:object_r:openca_usr_share_t
 /usr/share/openca/htdocs(/.*)?	system_u:object_r:httpd_sys_content_t
-/usr/share/openca/cgi-bin/ca(/.*)?	system_u:object_r:openca_ca_exec_t
+/usr/share/openca/cgi-bin/ca/.+ --	system_u:object_r:openca_ca_exec_t
diff -ru /usr/src/se/policy/file_contexts/program/prelink.fc file_contexts/program/prelink.fc
--- /usr/src/se/policy/file_contexts/program/prelink.fc	2004-02-25 17:05:05.000000000 +1100
+++ file_contexts/program/prelink.fc	2004-08-25 21:42:00.000000000 +1000
@@ -1,5 +1,8 @@
 # prelink - prelink ELF shared libraries and binaries to speed up startup time
 /usr/sbin/prelink		--	system_u:object_r:prelink_exec_t
+ifdef(`distro_debian', `
+/usr/sbin/prelink\.bin		--	system_u:object_r:prelink_exec_t
+')
 /etc/prelink.conf		--	system_u:object_r:etc_prelink_t
 /var/log/prelink.log		--	system_u:object_r:prelink_log_t
 /etc/prelink.cache		--	system_u:object_r:prelink_cache_t
diff -ru /usr/src/se/policy/file_contexts/program/rssh.fc file_contexts/program/rssh.fc
--- /usr/src/se/policy/file_contexts/program/rssh.fc	2004-08-24 05:46:54.000000000 +1000
+++ file_contexts/program/rssh.fc	2004-08-28 23:28:07.000000000 +1000
@@ -1,2 +1,2 @@
 # rssh
-/usr/bin/rssh			system_u:object_r:rssh_exec_t
+/usr/bin/rssh		--	system_u:object_r:rssh_exec_t
diff -ru /usr/src/se/policy/file_contexts/program/seuser.fc file_contexts/program/seuser.fc
--- /usr/src/se/policy/file_contexts/program/seuser.fc	2003-11-27 05:04:46.000000000 +1100
+++ file_contexts/program/seuser.fc	2004-08-28 23:26:21.000000000 +1000
@@ -1,4 +1,4 @@
 # seuser
-/usr/bin/seuser	system_u:object_r:seuser_exec_t
+/usr/bin/seuser	--	system_u:object_r:seuser_exec_t
 /usr/apol/seuser.conf system_u:object_r:seuser_conf_t
 
diff -ru /usr/src/se/policy/file_contexts/program/spamassassin.fc file_contexts/program/spamassassin.fc
--- /usr/src/se/policy/file_contexts/program/spamassassin.fc	2004-05-05 05:35:53.000000000 +1000
+++ file_contexts/program/spamassassin.fc	2004-08-28 23:27:21.000000000 +1000
@@ -1,3 +1,3 @@
-/usr/bin/spamassassin		system_u:object_r:spamassassin_exec_t
-/root/\.spamassassin(/.*)?	system_u:object_r:staff_home_spamassassin_t
-/home/[^/]+/\.spamassassin(/.*)?	system_u:object_r:user_home_spamassassin_t
+# spamassasin
+/usr/bin/spamassassin	--	system_u:object_r:spamassassin_exec_t
+HOME_DIR/\.spamassassin(/.*)?	system_u:object_r:ROLE_home_spamassassin_t
diff -ru /usr/src/se/policy/file_contexts/program/spamc.fc file_contexts/program/spamc.fc
--- /usr/src/se/policy/file_contexts/program/spamc.fc	2004-05-05 05:35:53.000000000 +1000
+++ file_contexts/program/spamc.fc	2004-08-28 23:27:27.000000000 +1000
@@ -1 +1 @@
-/usr/bin/spamc		system_u:object_r:spamc_exec_t
+/usr/bin/spamc	--	system_u:object_r:spamc_exec_t
diff -ru /usr/src/se/policy/file_contexts/program/udev.fc file_contexts/program/udev.fc
--- /usr/src/se/policy/file_contexts/program/udev.fc	2004-08-28 12:05:11.000000000 +1000
+++ file_contexts/program/udev.fc	2004-08-28 23:27:56.000000000 +1000
@@ -3,7 +3,7 @@
 /sbin/udev	--	system_u:object_r:udev_exec_t
 /sbin/udevd	--	system_u:object_r:udev_exec_t
 /usr/bin/udevinfo --	system_u:object_r:udev_exec_t
-/etc/dev\.d(/.*)? 	system_u:object_r:udev_helper_exec_t
-/etc/hotplug.d/default/udev.* system_u:object_r:udev_helper_exec_t
+/etc/dev\.d/.+	--	system_u:object_r:udev_helper_exec_t
+/etc/hotplug.d/default/udev.* -- system_u:object_r:udev_helper_exec_t
 /dev/udev\.tbl	--	system_u:object_r:udev_tbl_t
 /dev/\.udev\.tdb --	system_u:object_r:udev_tbl_t
diff -ru /usr/src/se/policy/file_contexts/program/xfs.fc file_contexts/program/xfs.fc
--- /usr/src/se/policy/file_contexts/program/xfs.fc	2004-01-24 12:15:54.000000000 +1100
+++ file_contexts/program/xfs.fc	2004-08-26 00:11:03.000000000 +1000
@@ -1,3 +1,5 @@
 # xfs
 /tmp/\.font-unix(/.*)?		system_u:object_r:xfs_tmp_t
 /usr/X11R6/bin/xfs	--	system_u:object_r:xfs_exec_t
+/usr/X11R6/bin/xfs-xtt	--	system_u:object_r:xfs_exec_t
+/usr/bin/xfstt		--	system_u:object_r:xfs_exec_t

  reply	other threads:[~2004-08-28 13:46 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-24  8:18 policy patch Russell Coker
2004-08-24 12:23 ` Stephen Smalley
2004-08-24 16:54   ` Russell Coker
2004-08-27 20:58 ` James Carter
2004-08-28 13:46   ` Russell Coker [this message]
2004-08-30 20:24     ` James Carter
2004-09-02 12:46       ` Latest Patches Daniel J Walsh
2004-09-02 12:54         ` Stephen Smalley
2004-09-02 15:23           ` Daniel J Walsh
2004-09-02 15:46             ` Stephen Smalley
2004-09-02 15:53               ` Daniel J Walsh
2004-09-02 16:48                 ` Stephen Smalley
2004-09-02 16:57                   ` Stephen Smalley
2004-09-02 19:48                 ` Luke Kenneth Casson Leighton
2004-09-02 19:42                   ` Daniel J Walsh
2004-09-02 20:23                     ` Luke Kenneth Casson Leighton
2004-09-02 13:10         ` Stephen Smalley
2004-09-02 13:38           ` Russell Coker
2004-09-02 14:46             ` Stephen Smalley
2004-09-02 15:52               ` Proposed Hardware File Context file Daniel J Walsh
2004-09-02 19:38                 ` Stephen Smalley
2004-09-02 19:48                   ` Daniel J Walsh
2004-09-02 19:59                     ` Stephen Smalley
2004-09-02 20:08                       ` Daniel J Walsh
2004-09-02 20:09                         ` Stephen Smalley
2004-09-02 20:15                           ` Daniel J Walsh
2004-09-02 23:30                             ` Colin Walters
2004-09-03 11:28                               ` Stephen Smalley
2004-09-03 13:17                                 ` Luke Kenneth Casson Leighton
2004-09-03 13:33                                   ` Stephen Smalley
2004-09-03 14:38                                     ` Luke Kenneth Casson Leighton
2004-09-03 16:28                                       ` Stephen Smalley
2004-09-03 17:03                                         ` Luke Kenneth Casson Leighton
2004-09-09 16:52                                           ` Daniel J Walsh
2004-09-02 22:45                         ` Luke Kenneth Casson Leighton
2004-09-02 20:11                       ` Please review openssh patch for selinux Daniel J Walsh
2004-09-03 12:48                         ` Stephen Smalley
2004-09-04 11:21                           ` Daniel J Walsh
2004-09-07 19:14                             ` Stephen Smalley
2004-09-06 18:23                         ` Nigel Kukard
2004-09-07 16:28                         ` Nigel Kukard
2004-09-02 22:59                   ` Proposed Hardware File Context file Luke Kenneth Casson Leighton
2004-09-02 19:54                 ` Luke Kenneth Casson Leighton
2004-09-02 19:51                   ` Daniel J Walsh
2004-09-02 15:38           ` Latest Patches Daniel J Walsh
2004-09-02 17:15           ` Luke Kenneth Casson Leighton
2004-09-02 18:56           ` James Carter
2004-09-02 13:27         ` Russell Coker
2004-09-02 16:30         ` Joshua Brindle
2004-09-02 16:40           ` Stephen Smalley
2004-09-02 18:00           ` Daniel J Walsh
  -- strict thread matches above, loose matches on Subject: below --
2005-08-18  7:31 policy patch Russell Coker
2005-01-12 18:46 [Fwd: New policy patch] Daniel J Walsh
2005-01-21 20:36 ` James Carter
2005-03-29 16:47   ` Policy Patch Daniel J Walsh
2005-04-01 20:28     ` James Carter
2004-11-25 13:27 policy patch Russell Coker
2004-11-25 16:32 ` Luke Kenneth Casson Leighton
2004-11-25 19:05   ` Russell Coker
2004-11-25 20:34     ` Luke Kenneth Casson Leighton
2004-11-29 19:23 ` James Carter
2004-11-29 21:47 ` Daniel J Walsh
2004-11-30 16:42 ` Daniel J Walsh
2004-10-13  5:55 Russell Coker
2004-10-13 20:17 ` James Carter
2004-07-12 14:12 Russell Coker
2004-07-12 19:46 ` Luke Kenneth Casson Leighton
2004-07-11  7:59 Russell Coker
2004-07-12 13:30 ` Stephen Smalley
2004-07-04  5:04 Russell Coker
2004-07-07 20:47 ` Stephen Smalley
2002-12-03 14:47 Stephen D. Smalley
2002-11-29 11:45 Russell Coker
2002-09-21  4:39 Russell Coker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200408282346.05926.russell@coker.com.au \
    --to=russell@coker.com.au \
    --cc=jwcart2@epoch.ncsc.mil \
    --cc=selinux@tycho.nsa.gov \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.