From: Murray McAllister <mmcallis@redhat.com>
To: SE Linux <selinux@tycho.nsa.gov>
Subject: Re: user guide drafts: "Mounting File Systems"
Date: Fri, 10 Oct 2008 17:32:29 +1000 [thread overview]
Message-ID: <48EF050D.3090308@redhat.com> (raw)
In-Reply-To: <48EF03BA.90901@redhat.com>
Murray McAllister wrote:
> Hi,
>
> The following is a rough draft for the "Mounting File Systems" sections.
> Any comments and corrections are appreciated.
>
> Thanks!
>
> Mounting File Systems
>
> By default, when a third extended file system (ext3) is mounted, the
> files and directories on the file system are labeled with the file_t
> type. The mount command can override SELinux contexts when mounting file
> systems. SELinux context changes with the mount command can be
> per-session only (until the file system is unmounted), or persistent
> (context changes are written to disk).
>
> # what are default_t and file_t?
Sorry. I found
<http://fedoraproject.org/wiki/SELinux/Troubleshooting/AVCDecisions>
which looks like it answers it.
>
> Temporary Mount Context Changes
>
> As the Linux root user, use the mount -o
> context=SELinux_user:role:type:level option to temporarily override
> existing SELinux contexts. The -o context option requires a Linux 2.6
> kernel. When a file system is mounted with the -o context option:
>
> # does -o context only work with a 2.6 kernels?
>
> * SELinux context changes only occur in kernel memory, and as such,
> context changes are not written to disk. Any context changes made while
> such a file system is mounted are lost when the file system is unmounted.
>
> * If a file system is already labeled, and the contexts are overridden
> with the -o context option, the original contexts return when the file
> system is un-mounted.
>
> * Newly-created files and directories appear to have the SELinux context
> specified with -o context; however, since context changes are not
> written to disk for these situations, context changes are lost when the
> file system is un-mounted.
>
> * The -o context option works even if the file system to be mounted does
> not support extended attributes, although, any context changes made to
> such a file system are lost when the file system is unmounted.
>
> The following example labels all files on the file system to be mounted
> with the httpd_sys_content_t type:
>
> # mount -t ext3 -o context="system_u:object_r:httpd_sys_content_t:s0"
> /dev/sdax /mount/point
>
> -t ext3: The -t ext3 option specifies that an ext3 file system is to be
> mounted. Use the -t option to specify the correct file system. Refer to
> the mount(8) manual page for a list of file systems.
>
> -o context="system_u:object_r:httpd_sys_content_t:s0": The -o
> context="system_u:object_r:httpd_sys_content_t:s0" option specifies the
> SELinux context for all files on the file system to be mounted, as well
> as the mount point. This option overrides existing contexts.
>
> Type Enforcement is the main permission control used in SELinux targeted
> policy. For the most part, SELinux users and roles can be ignored, so,
> when overriding the SELinux context with mount, use the SELinux system_u
> user and object_r role, and concentrate on the type. In this example,
> all files on the /dev/sdax file system will be labeled with the
> httpd_sys_content_t type.
>
> /dev/sdax /mount/point: Specifies that the /dev/sdax device will be
> mounted to the /mount/point/ directory.
>
> <note>
> When a file system is mounted with the -o context option, it is not
> possible to use the chcon command to change the SELinux context. Using
> chcon on such a file system results in a Operation not supported error.
> </note>
>
> Persistent Mount Context Changes
>
> As the Linux root user, use the mount -o
> defcontext=SELinux_user:role:type:level option to persistently change
> the default SELinux context for a file system. The -o defcontext option
> requires a file system that supports extended attributes, since changes
> are written to disk. When a file system is mounted with the -o
> defcontext option:
>
> * Existing files keep their current contexts.
>
> * Context changes are written to disk, and are not lost if the file
> system is unmounted. Newly-created files and files copied to such a file
> system inherit the SELinux context specified with the -o defcontext
> option. For example, if a file system is mounted with the -o
> defcontext="system_u:object_r:httpd_sys_content_t:s0" option, and a new
> file is created on the mounted file system, that file is labeled with
> the httpd_sys_content_t type. If the file system is unmounted and then
> mounted without a context option, that file is still labeled with the
> httpd_sys_content_t type.
>
> The following example changes the default SELinux context for the file
> system to be mounted to system_u:object_r:httpd_sys_content_t:s0:
>
> # mount -t ext3 -o defcontext="system_u:object_r:httpd_sys_content_t:s0"
> /dev/sdax /mount/point
>
> [fill in similar to the previous section]
>
> # I do not understand the fscontext option. Should that be included?
>
> # Is there any common use cases that should have examples here, such as
> mounting a cd and sharing it via http or nfs?
>
> Apologies for any typos :(
>
--
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.
next prev parent reply other threads:[~2008-10-10 7:32 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-10 7:26 user guide drafts: "Mounting File Systems" Murray McAllister
2008-10-10 7:32 ` Murray McAllister [this message]
2008-10-10 7:45 ` Murray McAllister
2008-10-10 9:55 ` Russell Coker
2008-10-10 13:11 ` Stephen Smalley
2008-10-10 13:45 ` Eric Paris
2008-10-10 13:51 ` Stephen Smalley
2008-10-11 11:18 ` Russell Coker
2008-10-16 0:27 ` Murray McAllister
2008-10-10 13:30 ` Stephen Smalley
2008-10-16 1:43 ` Murray McAllister
2008-10-16 14:07 ` Stephen Smalley
2008-10-20 0:07 ` Murray McAllister
2008-10-20 13:37 ` Stephen Smalley
2008-10-22 5:23 ` Murray McAllister
2008-10-22 15:07 ` Stephen Smalley
2008-10-22 19:25 ` Daniel J Walsh
2008-10-27 2:57 ` Murray McAllister
2008-10-28 23:39 ` Daniel J Walsh
2008-10-23 5:08 ` Murray McAllister
2008-10-23 6:02 ` Murray McAllister
2008-10-20 0:46 ` Murray McAllister
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=48EF050D.3090308@redhat.com \
--to=mmcallis@redhat.com \
--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.