我如何使用apparmor内核补丁修补我的内核3.2?

我有Ubuntu 12.04内核3.2(64位)

我在https://launchpad.net/apparmor/2.8/2…r-2.8.0.tar.gz下载了apparmor-2.8.0.tar.gz

解压后,我进入apparmor-2.8.0 / kernel-patches / 3.2 /,有3个文件:

0001-AppArmor-compatibility-patch-for-v5-network-controll.patch 0002-AppArmor-compatibility-patch-for-v5-interface.patch 0003-AppArmor-Allow-dfa-backward-compatibility-with-broke.patch 

我试过: patch -p1 < 0001-AppArmor-compatibility-patch-for-v5-network-controll.patch

 can't find file to patch at input line 26 Perhaps you used the wrong -p or --strip option? The text leading up to this was: -------------------------- |From 125fccb600288968aa3395883c0a394c47176fcd Mon Sep 17 00:00:00 2001 |From: John Johansen <[email protected]> |Date: Wed, 10 Aug 2011 22:02:39 -0700 |Subject: [PATCH 1/3] AppArmor: compatibility patch for v5 network controll | |Add compatibility for v5 network rules. | |Signed-off-by: John Johansen <[email protected]> |--- | include/linux/lsm_audit.h | 4 + | security/apparmor/Makefile | 19 +++- | security/apparmor/include/net.h | 40 +++++++++ | security/apparmor/include/policy.h | 3 + | security/apparmor/lsm.c | 112 ++++++++++++++++++++++++ | security/apparmor/net.c | 170 ++++++++++++++++++++++++++++++++++++ | security/apparmor/policy.c | 1 + | security/apparmor/policy_unpack.c | 48 +++++++++- | 8 files changed, 394 insertions(+), 3 deletions(-) | create mode 100644 security/apparmor/include/net.h | create mode 100644 security/apparmor/net.c | |diff --git a/include/linux/lsm_audit.hb/include/linux/lsm_audit.h |index 88e78de..c63979a 100644 |--- a/include/linux/lsm_audit.h |+++ b/include/linux/lsm_audit.h -------------------------- File to patch: 

但它然后问我“文件补丁:”。

我如何去做这件事?

编辑 :我这样做的原因是,当我尝试使用aa-enforce ,我得到以下消息:

Setting /bin/ping to enforce mode. Warning: unable to find a suitable fs in /proc/mounts, is it mounted? Use --subdomainfs to override.

当我尝试启动Apparmor,我得到这个:

Cache read/write disabled: /sys/kernel/security/apparmor/features interface file missing. (Kernel needs AppArmor 2.4 compatibility patch.) Warning from /etc/apparmor.d/bin.ping (/etc/apparmor.d/bin.ping line 28): profile /bin/ping network rules not enforced

你首先使用哪个3.2内核源码?

  • 上游内核?
  • 一个已经打补丁的Ubuntu内核?

Ubuntu 12.04(3.2)内核应该已经有apparmor补丁,所以补丁是没有必要的。 但是如果你需要打补丁,你应该放在内核源码目录的根目录下,而不是修补程序目录。

这个错误

警告:在/ proc / mounts中无法find合适的fs,是否挂载? 使用–subdomainfs来覆盖。

告诉我,apparmor内核模块不是内置的,启用的,或者securityfs没有挂载。

目录/sys/module/apparmor存在?

  • 如果存在,apparmor已经内置,但可能不启用sudo cat /sys/module/apparmor/parameters/多less?
  • 如果Y ,那么apparmor在内核加载时启用,但是可能不会挂载所需的文件系统? securityfs是否被挂载? 什么是由mount命令返回的?

    • 你将会find一行: none on /sys/kernel/security type securityfs (rw)
    • 如果安装了securefs并启用了apparmor,那么ls -a /sys/kernel/security/apparmor的输出是什么?

如果/sys/module/apparmor目录不存在,你的内核就不是在启用apparmor的情况下生成的。 您需要安装或使用apparmor内置来构build内核。 如果不需要,不必将其作为默认的LSM启用,在这种情况下,如果提供security=apparmor作为内核启动参数,将启用apparmor。