This repository has been archived by the owner on Oct 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 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.