All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel J Walsh <dwalsh@redhat.com>
To: Stephen Smalley <sds@tycho.nsa.gov>
Cc: SELinux <selinux@tycho.nsa.gov>,
	Joshua Brindle <method@manicmethod.com>,
	Eric Paris <eparis@parisplace.org>,
	Chad Sellers <csellers@tresys.com>
Subject: Re: Fixfiles using new setfiles/restorecon simplification
Date: Fri, 26 Feb 2010 13:59:24 -0500	[thread overview]
Message-ID: <4B881A0C.5010607@redhat.com> (raw)
In-Reply-To: <1267206984.9997.38.camel@moss-pluto.epoch.ncsc.mil>

On 02/26/2010 12:56 PM, Stephen Smalley wrote:
> Problems with the new fixfiles logic even with kernels>= 2.6.30:
>
> - Bind mounts are not excluded (and note that they aren't marked with
> bind as an option in /proc/mounts - only in /etc/mtab aka mount output):
> # mkdir /foo
> # mount -o bind /etc /foo
> # grep /foo /proc/mounts
> /dev/root /foo ext4 rw,seclabel,relatime,barrier=1,data=ordered 0 0
> # grep /foo /etc/mtab
> /etc /foo none rw,bind 0 0
>
> - You are assuming fixed option ordering and that no other options can
> appear between "rw" and "seclabel" in your grep pattern for
> FILESYSTEMSRW.  As a trivial counterexample, if the user mounts with a
> rootcontext= option (override the root directory context, but allow
> setting of individual file contexts), it won't match.  If we can assume
> that seclabel always follows rw, then you can use grep
> 'rw,.*seclabel' /proc/self/mounts.  If they used a regular context=
> mount option, then seclabel won't be displayed so that will get
> excluded.
>
> - The definition for FILESYSTEMSRO appears to be wrong.  I think
> possibly you want grep 'ro,.*seclabel' there (i.e. filesystems mounted
> read-only that support labeling).  Simple test case:
> # mount -o remount,ro /boot
> # grep 'ro,.*seclabel' /proc/mounts
> /dev/sda1 /boot ext3
> ro,seclabel,relatime,errors=continue,user_xattr,acl,data=ordered 0 0
>
>    


How about this script,  It searches mount eliminating context and bind 
mounts and then
searches /proc/self/mounts for seclabel.

get_mounts() {
FS=`mount | grep -v "context=" | egrep -v '\((|.*,)bind(,.*|)\)' | awk 
'/rw/{print $3}';`
for i in $FS; do
     grep --silent "$i ".*seclabel /proc/self/mounts && echo $i
done
}
FILESYSTEMRW=`get_mounts`
echo $FILESYSTEMRW



--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

  parent reply	other threads:[~2010-02-26 18:59 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-24 20:46 Fixfiles using new setfiles/restorecon simplification Daniel J Walsh
2010-02-26  1:41 ` Joshua Brindle
2010-02-26 12:56   ` Stephen Smalley
2010-02-26 13:41   ` Daniel J Walsh
2010-02-26 14:10     ` Stephen Smalley
2010-02-26 14:23       ` Daniel J Walsh
2010-02-26 14:36         ` Stephen Smalley
2010-02-26 18:12           ` Daniel J Walsh
2010-02-26 20:16             ` Stephen Smalley
2010-02-26 20:25               ` Daniel J Walsh
2010-02-26 20:33                 ` Stephen Smalley
2010-02-26 20:47                 ` Stephen Smalley
2010-02-26 20:52                   ` Daniel J Walsh
2010-02-26 20:57                     ` Stephen Smalley
2010-02-26 21:04                       ` Daniel J Walsh
2010-02-26 17:56 ` Stephen Smalley
2010-02-26 18:36   ` Daniel J Walsh
2010-02-26 18:59   ` Daniel J Walsh [this message]
2010-02-26 20:49     ` Stephen Smalley
2010-02-26 21:14       ` Daniel J Walsh

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=4B881A0C.5010607@redhat.com \
    --to=dwalsh@redhat.com \
    --cc=csellers@tresys.com \
    --cc=eparis@parisplace.org \
    --cc=method@manicmethod.com \
    --cc=sds@tycho.nsa.gov \
    --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.