-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
…/git/jmorris/security-testing-2.6 * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6: selinux: Fix an uninitialized variable BUG/panic in selinux_secattr_to_sid() selinux: use default proc sid on symlinks file capabilities: uninline cap_safe_nice Update selinux info in MAINTAINERS and Kconfig help text SELinux: add gitignore file for mdp script SELinux: add boundary support and thread context assignment securityfs: do not depend on CONFIG_SECURITY selinux: add support for installing a dummy policy (v2) security: add/fix security kernel-doc selinux: Unify for- and while-loop style selinux: conditional expression type validation was off-by-one smack: limit privilege by label SELinux: Fix a potentially uninitialised variable in SELinux hooks SELinux: trivial, remove unneeded local variable SELinux: Trivial minor fixes that change C null character style make selinux_write_opts() static
- Loading branch information
Showing
36 changed files
with
995 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
If you want to use SELinux, chances are you will want | ||
to use the distro-provided policies, or install the | ||
latest reference policy release from | ||
http://oss.tresys.com/projects/refpolicy | ||
|
||
However, if you want to install a dummy policy for | ||
testing, you can do using 'mdp' provided under | ||
scripts/selinux. Note that this requires the selinux | ||
userspace to be installed - in particular you will | ||
need checkpolicy to compile a kernel, and setfiles and | ||
fixfiles to label the filesystem. | ||
|
||
1. Compile the kernel with selinux enabled. | ||
2. Type 'make' to compile mdp. | ||
3. Make sure that you are not running with | ||
SELinux enabled and a real policy. If | ||
you are, reboot with selinux disabled | ||
before continuing. | ||
4. Run install_policy.sh: | ||
cd scripts/selinux | ||
sh install_policy.sh | ||
|
||
Step 4 will create a new dummy policy valid for your | ||
kernel, with a single selinux user, role, and type. | ||
It will compile the policy, will set your SELINUXTYPE to | ||
dummy in /etc/selinux/config, install the compiled policy | ||
as 'dummy', and relabel your filesystem. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
subdir-y := mdp | ||
subdir- += mdp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Please see Documentation/SELinux.txt for information on | ||
installing a dummy SELinux policy. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/bin/sh | ||
if [ `id -u` -ne 0 ]; then | ||
echo "$0: must be root to install the selinux policy" | ||
exit 1 | ||
fi | ||
SF=`which setfiles` | ||
if [ $? -eq 1 ]; then | ||
if [ -f /sbin/setfiles ]; then | ||
SF="/usr/setfiles" | ||
else | ||
echo "no selinux tools installed: setfiles" | ||
exit 1 | ||
fi | ||
fi | ||
|
||
cd mdp | ||
|
||
CP=`which checkpolicy` | ||
VERS=`$CP -V | awk '{print $1}'` | ||
|
||
./mdp policy.conf file_contexts | ||
$CP -o policy.$VERS policy.conf | ||
|
||
mkdir -p /etc/selinux/dummy/policy | ||
mkdir -p /etc/selinux/dummy/contexts/files | ||
|
||
cp file_contexts /etc/selinux/dummy/contexts/files | ||
cp dbus_contexts /etc/selinux/dummy/contexts | ||
cp policy.$VERS /etc/selinux/dummy/policy | ||
FC_FILE=/etc/selinux/dummy/contexts/files/file_contexts | ||
|
||
if [ ! -d /etc/selinux ]; then | ||
mkdir -p /etc/selinux | ||
fi | ||
if [ ! -f /etc/selinux/config ]; then | ||
cat > /etc/selinux/config << EOF | ||
SELINUX=enforcing | ||
SELINUXTYPE=dummy | ||
EOF | ||
else | ||
TYPE=`cat /etc/selinux/config | grep "^SELINUXTYPE" | tail -1 | awk -F= '{ print $2 '}` | ||
if [ "eq$TYPE" != "eqdummy" ]; then | ||
selinuxenabled | ||
if [ $? -eq 0 ]; then | ||
echo "SELinux already enabled with a non-dummy policy." | ||
echo "Exiting. Please install policy by hand if that" | ||
echo "is what you REALLY want." | ||
exit 1 | ||
fi | ||
mv /etc/selinux/config /etc/selinux/config.mdpbak | ||
grep -v "^SELINUXTYPE" /etc/selinux/config.mdpbak >> /etc/selinux/config | ||
echo "SELINUXTYPE=dummy" >> /etc/selinux/config | ||
fi | ||
fi | ||
|
||
cd /etc/selinux/dummy/contexts/files | ||
$SF file_contexts / | ||
|
||
mounts=`cat /proc/$$/mounts | egrep "ext2|ext3|xfs|jfs|ext4|ext4dev|gfs2" | awk '{ print $2 '}` | ||
$SF file_contexts $mounts | ||
|
||
|
||
dodev=`cat /proc/$$/mounts | grep "/dev "` | ||
if [ "eq$dodev" != "eq" ]; then | ||
mount --move /dev /mnt | ||
$SF file_contexts /dev | ||
mount --move /mnt /dev | ||
fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Generated file | ||
mdp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
hostprogs-y := mdp | ||
HOST_EXTRACFLAGS += -Isecurity/selinux/include | ||
|
||
always := $(hostprogs-y) | ||
clean-files := $(hostprogs-y) policy.* file_contexts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" | ||
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> | ||
<busconfig> | ||
<selinux> | ||
</selinux> | ||
</busconfig> |
Oops, something went wrong.