All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dale Amon <amon@vnl.com>
To: Russell Coker <russell@coker.com.au>
Cc: Dale Amon <amon@vnl.com>, SELinux Mail List <selinux@tycho.nsa.gov>
Subject: Re: Trivial debian bootscript for selinuxfs on 2.6
Date: Wed, 17 Sep 2003 17:56:20 +0100	[thread overview]
Message-ID: <20030917165620.GB22480@vnl.com> (raw)
In-Reply-To: <200309172243.31840.russell@coker.com.au>

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

Okay, here's a second pass with most of what Russ asked for.
I didn't consider the pivot_root yet. That would also have
to worked out with Colin, and since set up the whole of the
selinux mkinitrd and policy infrastructure packages, he's
the one to think about how this all fits.

Here's the second cut. Note the questions I have on the
timing of this at halt/reboot.




[-- Attachment #2: Selinux --]
[-- Type: text/plain, Size: 1840 bytes --]

#! /bin/sh
#
# Selinux	Mount the selinux fs.
#		Written by Dale Amon <amon@islandone.org>.
#
# Version:	@(#)Selinux  1.0.0  15-Sep-2003  amon@vnl.com
#               @(#)Selinux  1.0.1  17-Sep-2003  amon@vnl.com
#
# Recommended levels:
#		update-rc.d Selinux start 00 S . stop 99 0 6 .
#
# Note: It should run before anything else at boot time; it
#       should be the very last thing down at halt or reboot.
#
#       One could have a rc0.d/K99XXXXX that executed after it.
#       Also, all of the rc0.d/S* scripts run after it and we
#       have no way to make a kill script be the last thing 
#       after Starts, short of a serious kludge I can think of
#       by using a second script, S99XXXXXX that calls 
#       Selinux stop.
#       Could this cause any problems, security or otherwise?
#

PATH=/sbin:/bin:/usr/sbin:/usr/bin
NAME=Selinux
SELF=/etc/init.d/$NAME
POLICY=/etc/security/selinux/policy.15
LOADPOLICY=/usr/sbin/load_policy

set -e

function can_load_policy () {
    if [ ! -x $LOADPOLICY ]; then
	return 0
    fi
    if [ ! -f $POLICY ]; then
       echo "Failed."
       echo -n "...Cannot find $POLICY, try: make -C /etc/selinux install"
       return 0
    fi
    return 1
}

function do_load_policy () {
   echo -n "Reloading policy"
   if can_load_policy; then
        $LOADPOLICY $POLICY || (echo -n "...Policy load failed")
   fi
   echo "."
}

case "$1" in
  start)
	echo "Mounting selinuxfs."
	mount -t selinuxfs none /selinux
	do_load_policy;
	;;

  stop)
	echo -n "Unmounting selinuxfs."
	umount -t selinuxfs /selinux
	echo "."
	;;

  reload|force-reload)
	do_load_policy;
	;;

  restart)
	echo "Remounting selinuxfs."
	umount -t selinuxfs /selinux
	mount  -t selinuxfs none /selinux
	do_load_policy;
	;;

  *)
	echo "Usage: $SELF {start|stop|restart|reload|force-reload}" >&2
	exit 1
	;;
esac

exit 0



      parent reply	other threads:[~2003-09-17 16:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-16 15:54 Trivial debian bootscript for selinuxfs on 2.6 Dale Amon
2003-09-16 19:10 ` Dale Amon
2003-09-17 10:36 ` Russell Coker
2003-09-17 11:10   ` Dale Amon
2003-09-17 12:15     ` Dale Amon
2003-09-17 12:43     ` Russell Coker
2003-09-17 12:54       ` Dale Amon
2003-09-17 16:56       ` Dale Amon [this message]

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=20030917165620.GB22480@vnl.com \
    --to=amon@vnl.com \
    --cc=russell@coker.com.au \
    --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.