All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ken YANG <spng.yang@gmail.com>
To: russell@coker.com.au
Cc: James Morris <jmorris@namei.org>,
	Stephen Smalley <sds@tycho.nsa.gov>,
	SELinux List <selinux@tycho.nsa.gov>,
	Daniel J Walsh <dwalsh@redhat.com>,
	"Christopher J. PeBenito" <cpebenito@tresys.com>
Subject: Re: can not boot with strict policy
Date: Fri, 27 Apr 2007 18:48:20 +0800	[thread overview]
Message-ID: <4631D4F4.20901@gmail.com> (raw)
In-Reply-To: <200704261645.50811.russell@coker.com.au>

Russell Coker wrote:
> On Tuesday 24 April 2007 03:42, James Morris <jmorris@namei.org> wrote:
>>> Boot with "enforcing=0 single" to come up permissive into single-user
>>> mode, then run /sbin/fixfiles relabel -F to forcible relabel everything,
>>> then reboot.
>> I wonder if we could automate this, so that the autorelabel is also run
>> on boot if you switch between different types of policy.
> 
> There are a few ways of doing this.  For my Kickstart configuration of MLS 
> systems and Play machines I used to create an /etc/init.d script that would 
> put the machine in enforcing mode and configure grub with enforcing=1 and 
> then put enforcing=0 on the grub command-line before the final reboot of the 
> install.
> 
> For a more general solution you might want to have /sbin/init search 
> for /.changing-policy-type as a reason to boot in permissive mode.


the general solution sounds good, which can make the process
automatically like the ".autorelabel" way.

by the way, changing policy from targeted to strict also had other
problems in FC. I am not sure whether the problem occurred in other
distribution too.

before rc.sysinit executes, "/dev" has the "tmpfs_t" type because:

fs_use_trans tmpfs gen_context(system_u:object_r:tmpfs_t,s0);

only after rc.sysinit executed, "/dev" had been relabel to "device_t":

if [ -n "$SELINUX_STATE" -a -x /sbin/restorecon ] && LC_ALL=C fgrep -q " 
/dev " /proc/mounts ; then
         /sbin/restorecon  -R /dev 2>/dev/null
fi

so there is the problem:

avc: denied {search} for pid=1 comm="init" name="/" dev=tmpfs ino=824
scontext=system_u:system_r:init_t:s0
tcontext=system_u:object_r:tmpfs_t:s0 tclass=dir

the "name" field in avc messages is obscure, i deduce the conclusion
from the inode that the target is "/dev", not "/"

but if "distro_redhat" tunables had not been turned on, init will not
have search and other permission to perform certain operations on
tmpfs_t

but because my policy is from svn, the default value of DISTRO
is null.

i doubt whether other distribution has the same problem?
are there some measures to avoid this kind of problem? because
not everyone, especially newbie like me, can figure out this part.


additionally, i am using the "te.vim" from Thomas Bleher to make
te file highlight, but i also want to make fc and if file highlight.
any guides? except SLIDE



> 


--
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.

  reply	other threads:[~2007-04-27 10:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-23 12:09 can not boot with strict policy Ken YANG
2007-04-23 15:01 ` Stephen Smalley
2007-04-23 17:42   ` James Morris
2007-04-23 17:48     ` Stephen Smalley
2007-04-23 18:14       ` Daniel J Walsh
2007-04-24  8:11         ` Ken YANG
2007-04-24 12:23           ` Daniel J Walsh
2007-04-24 12:26           ` Christopher J. PeBenito
2007-04-25 12:19             ` Ken YANG
2007-04-24 12:23         ` Christopher J. PeBenito
2007-04-24 12:59           ` Stephen Smalley
2007-04-24 13:08           ` Daniel J Walsh
2007-04-26  6:45     ` Russell Coker
2007-04-27 10:48       ` Ken YANG [this message]
2007-04-24  7:10 ` 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=4631D4F4.20901@gmail.com \
    --to=spng.yang@gmail.com \
    --cc=cpebenito@tresys.com \
    --cc=dwalsh@redhat.com \
    --cc=jmorris@namei.org \
    --cc=russell@coker.com.au \
    --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.