简体   繁体   English

SELinux安装

[英]SELinux installation

I am trying to download SELinux on an Ubuntu 11.04 using apt-get . 我正在尝试使用apt-get在Ubuntu 11.04上下载SELinux。

When I tried: 当我尝试:

$ sudo apt-get install selinux

I got the following error: 我收到以下错误:

The following packages have unmet dependencies: 以下软件包具有未满足的依赖性:
selinux : PreDepends: grub-pc but it is not installable selinux:PreDepends:grub-pc但不能安装
E: Broken packages E:包装破损

I then downloaded selinux-utils , selinux-basics . 然后,我下载了selinux-utilsselinux-basics

After this, I checked for the selinux file under /etc/sysconfig but I couldn't find it. 此后,我检查了/etc/sysconfig下的selinux文件,但找不到。

Also, when I tried 另外,当我尝试

$ setenforce 1

it returns: 它返回:

setenforce: SELinux is disabled setenforce:SELinux已禁用

What are the dependencies? 有哪些依赖性? What should I download? 我应该下载什么? How can I resolve this? 我该如何解决?

It looks like you don't GRUB (bootloader). 看来您不是GRUB(引导加载程序)。 I guess SELinux requires some changes in kernel so install your system with GRUB. 我猜SELinux要求内核进行一些更改,因此请使用GRUB安装系统。 Than installing SELinux just by 'apt-get install selinux' is correct. 比仅通过“ apt-get install selinux”安装SELinux是正确的。

Running SELinux under a Linux distribution requires three things: An SELinux enabled kernel, SELinux Userspace tools and libraries, and SELinux Policies. 在Linux发行版下运行SELinux需要三件事:支持SELinux的内核,SELinux用户空间工具和库以及SELinux策略。 I'm guessing either your Kernel was compiled without the SELinux option enabled, and/or an issue related to your bootloader (grub-pc). 我猜测您的内核是在未启用SELinux选项的情况下编译的,和/或与您的引导程序(grub-pc)有关的问题。 This is from the Kernel docs. 是来自内核文档。

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 如果要使用SELinux,则可能会使用发行版提供的策略,或者从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. 但是,如果要安装虚拟策略进行测试,则可以使用scripts / selinux下提供的“ mdp”。 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. 请注意,这需要安装selinux用户空间-特别是您将需要checkpolicy来编译内核,并需要setfiles和fixfiles来标记文件系统。

  1. Compile the kernel with selinux enabled. 启用selinux编译内核。
  2. Type 'make' to compile mdp. 键入“ make”以编译mdp。
  3. Make sure that you are not running with SELinux enabled and a real policy. 确保您未在​​启用SELinux和真实策略的情况下运行。 If you are, reboot with selinux disabled before continuing. 如果是,请在禁用selinux的情况下重新启动,然后再继续。
  4. Run install_policy.sh: cd scripts/selinux sh install_policy.sh 运行install_policy.sh:cd脚本/ 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. 第4步将创建一个对您的内核有效的新虚拟策略,并使用单个selinux用户,角色和类型。 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. 它将编译该策略,将您的SELINUXTYPE设置为/ etc / selinux / config中的哑元,将编译后的策略安装为'dummy',然后重新标记您的文件系统。

I suggest to uninstall AppArmor because it may conflict with SELinux: 我建议卸载AppArmor,因为它可能与SELinux冲突:

Remove apparmor 删除apparmor
Remove apparmor-util 删除apparmor-util

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM