package/apparmor: new package (branch yem/apparmor)
v5 cover package/apparmor: new package (branch yem/apparmor)
Hello All!
This series is reworked of the previous work from Angelo:
http://lists.busybox.net/pipermail/buildroot/2020-March/278308.html http://lists.busybox.net/pipermail/buildroot/2020-March/278307.html
Fundamentally, (almost) all the code is from Angelo, and it has jsut been spread across two packages.
The way the apparmor package is laid out is not very amenable at doing a single package that builds everything: all the tools and utils depend on libapparmor, and that is better installed before the build of the tools is attempted.
So, we split the packaging in two:
- libapparmor, which is siolely responsible for installing libapparmor and its python3 bindings,
- apparmor per-se, which is responsible for installing all the tools and utilities.
To be noted: most of the tools' Makefiles hard-code linking to the static libapparmor (without explanations), so rather than go against the tide, we just enforce building the static library (note also that we do not forbid building the shared one).
The only major part that was dropped from the initial series, is support for writign the cache on read-write filesystems. The codition was based on BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW, but that does not prevent building an actually read-only filesystem at all (e.g. squashfs). So, more thoughts will have to be poured into this caching feature in a subsequent series.
Chage v4 -> v5: (adopted by Yann)
- split in two packages, one for the lib, ione for the utils
- reword all the commit logs
- fix dependencies (threads, mmu...)
- re-organise the conditions to install utils (python3 vs others)
- drop the cache writing for read-write filesystems
Regards,
Yann E. MORIN.
The following changes since commit d0f5a5551ab86f6272f13deaa16dcdf4b07a524f
package/sysstat: bump to version 12.2.1 (2020-03-29 15:50:36 +0200)
are available in the git repository at:
git://git.buildroot.org/~ymorin/git/buildroot.git
for you to fetch changes up to 8b4415dad37fa81cf2d4adb09b27119b233bcd8a
package/apparmor: enable apache integration (2020-03-29 16:01:18 +0200)
----------------------------------------------------------------
Angelo Compagnucci (4):
package/libapparmor: new package
linux: enable AppArmor-related options if needed package/apparmor: new package package/apparmor: add option to install binutils
Yann E. MORIN (5):
package/apparmor: add options to install utils package/apparmor: add option to install generic profiles package/libapparmor: enable python bindings package/apparmor: enable PAM integration package/apparmor: enable apache integration
DEVELOPERS | 1 + linux/linux.mk | 5 ++ package/Config.in | 2 + package/apparmor/Config.in | 71 ++++++++++++++++ package/apparmor/apparmor.hash | 4 + package/apparmor/apparmor.mk | 81 ++++++++++++++++++ ...n_devel-fixing-for-crosscompiling-environ.patch | 96 ++++++++++++++++++++++ ...-fixing-setup.py-call-when-crosscompiling.patch | 30 +++++++ package/libapparmor/Config.in | 16 ++++ package/libapparmor/libapparmor.hash | 4 + package/libapparmor/libapparmor.mk | 41 +++++++++ 11 files changed, 351 insertions(+) create mode 100644 package/apparmor/Config.in create mode 100644 package/apparmor/apparmor.hash create mode 100644 package/apparmor/apparmor.mk create mode 100644 package/libapparmor/0001-m4-ac_python_devel-fixing-for-crosscompiling-environ.patch create mode 100644 package/libapparmor/0002-libapparmor-fixing-setup.py-call-when-crosscompiling.patch create mode 100644 package/libapparmor/Config.in create mode 100644 package/libapparmor/libapparmor.hash create mode 100644 package/libapparmor/libapparmor.mk
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v5 1/9 package/libapparmor: new package
From: Angelo Compagnucci <[email protected]>
The layout of the package is not amenable to building both the library and the utilities at once, so this package will only install the libarary.
The other apparmor-related tools however will almost all want to always link with the static library (it's hard-coded in their Makefiles, like:
AALIB = -Wl,-Bstatic -lapparmor -Wl,-Bdynamic -lpthread), so we also force the build of the static library.
The kernel headers 3.16 at least are required, for CAP_AUDIT_READ.
We need to force the C standard to gnu99, otherwise:
- autoconf uses wchar_t in C99 test, so considers it to be missing on toolchains without wchar, but wchar is not otherwise needed for libapparmor;
- c99 is not enough, otherwise the build fails with errors like:
kernel.c:503:15: error: expected declaration specifiers or ?...? before ?(? token
extern typeof((__change_hat)) __old_change_hat __attribute__((alias ("__change_hat")));
^--- DEVELOPERS | 1 + package/Config.in | 1 + package/libapparmor/Config.in | 16 ++++++++++++++++ package/libapparmor/libapparmor.hash | 4 ++++ package/libapparmor/libapparmor.mk | 27 +++++++++++++++++++++++++++ 5 files changed, 49 insertions(+) create mode 100644 package/libapparmor/Config.in create mode 100644 package/libapparmor/libapparmor.hash create mode 100644 package/libapparmor/libapparmor.mk
DEVELOPERS +1 -0
@@ -196,6 +196,7 @@ N: Angelo Compagnucci <[email protected]> F: package/corkscrew/ F: package/fail2ban/ F: package/i2c-tools/ +F: package/libapparmor/ F: package/mender/ F: package/mender-artifact/ F: package/mono/
package/Config.in +1 -0
@@ -1882,6 +1882,7 @@ endif endmenu menu "Security" + source "package/libapparmor/Config.in" source "package/libselinux/Config.in" source "package/libsemanage/Config.in" source "package/libsepol/Config.in"
package/libapparmor/Config.in new file +16 -0
@@ -0,0 +1,16 @@ +config BR2_PACKAGE_LIBAPPARMOR + bool "libapparmor" + depends on BR2_TOOLCHAIN_HAS_SYNC_4 + depends on BR2_TOOLCHAIN_HAS_THREADS + depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_16 + help + AppArmor is an effective and easy-to-use Linux application + security system. AppArmor proactively protects the operating + system and applications from external or internal threats, + even zero-day attacks, by enforcing good behavior and + preventing even unknown application flaws from being + exploited. + + This package installs only the library. + + http://wiki.apparmor.net
package/libapparmor/libapparmor.hash new file +4 -0
@@ -0,0 +1,4 @@ +# locally computed +sha256 267053234c68cdb122c5294d7c276b6e2f5fa7e75c6c2d23e3ce69f95d9a7639 apparmor-2.13.3.tar.gz +sha256 a7e0cdcbea5c14927cedfc600d46526bdcbb1eb0a4d951e2ea53c2a6de159cb4 LICENSE +sha256 6095e9ffa777dd22839f7801aa845b31c9ed07f3d6bf8a26dc5d2dec8ccc0ef3 libraries/libapparmor/COPYING.LGPL
package/libapparmor/libapparmor.mk new file +27 -0
@@ -0,0 +1,27 @@ +################################################################################ +# +# libapparmor +# +################################################################################ + +LIBAPPARMOR_VERSION_MAJOR = 2.13 +LIBAPPARMOR_VERSION = $(LIBAPPARMOR_VERSION_MAJOR).3 +LIBAPPARMOR_SOURCE = apparmor-$(LIBAPPARMOR_VERSION).tar.gz +LIBAPPARMOR_SITE = https://launchpad.net/apparmor/$(LIBAPPARMOR_VERSION_MAJOR)/$(LIBAPPARMOR_VERSION)/+download +LIBAPPARMOR_LICENSE = LGPL-2.1 +LIBAPPARMOR_LICENSE_FILES = LICENSE libraries/libapparmor/COPYING.LGPL + +LIBAPPARMOR_DEPENDENCIES = host-bison host-flex host-pkgconf +LIBAPPARMOR_SUBDIR = libraries/libapparmor +LIBAPPARMOR_INSTALL_STAGING = YES + +# Most AppArmor tools will want to link to the static lib. +# ac_cv_prog_cc_c99 is required for BR2_USE_WCHAR=n because the C99 test +# provided by autoconf relies on wchar_t. +LIBAPPARMOR_CONF_OPTS = \ + ac_cv_prog_cc_c99=-std=gnu99 \ + --enable-static \ + --enable-man-pages=no \ + --without-python + +$(eval $(autotools-package))
Signature · 1 line
2.20.1
PATCH v5 1/9 package/libapparmor: new package
Quoted 20 lines · Yann E. MORIN
From: Angelo Compagnucci <[email protected]>
The layout of the package is not amenable to building both the library and the utilities at once, so this package will only install the libarary.
The other apparmor-related tools however will almost all want to always link with the static library (it's hard-coded in their Makefiles, like:
AALIB = -Wl,-Bstatic -lapparmor -Wl,-Bdynamic -lpthread), so we also force the build of the static library.The kernel headers 3.16 at least are required, for
CAP_AUDIT_READ.We need to force the C standard to gnu99, otherwise:
- autoconf uses
wchar_tin C99 test, so considers it to be missing on toolchains without wchar, but wchar is not otherwise needed for libapparmor;
Quoted 8 lines
- c99 is not enough, otherwise the build fails with errors like:
kernel.c:503:15: error: expected declaration specifiers or ?...? before ?(? token extern typeof((__change_hat)) __old_change_hat __attribute__((alias ("__change_hat"))); ^Signed-off-by Angelo Compagnucci <[email protected]>[yann.morin.1998 at free.fr: strip down the patch to only build the lib]Signed-off-by Yann E. MORIN <[email protected]>
Quoted 103 lines
--- DEVELOPERS | 1 + package/Config.in | 1 + package/libapparmor/Config.in | 16 ++++++++++++++++ package/libapparmor/libapparmor.hash | 4 ++++ package/libapparmor/libapparmor.mk | 27 +++++++++++++++++++++++++++ 5 files changed, 49 insertions(+) create mode 100644 package/libapparmor/Config.in create mode 100644 package/libapparmor/libapparmor.hash create mode 100644 package/libapparmor/libapparmor.mkDEVELOPERS +1
-0@@ -196,6 +196,7 @@ N: Angelo Compagnucci <[email protected]> F: package/corkscrew/ F: package/fail2ban/ F: package/i2c-tools/ +F: package/libapparmor/ F: package/mender/ F: package/mender-artifact/ F: package/mono/package/Config.in +1
-0@@ -1882,6 +1882,7 @@ endif endmenu menu "Security" + source "package/libapparmor/Config.in" source "package/libselinux/Config.in" source "package/libsemanage/Config.in" source "package/libsepol/Config.in"package/libapparmor/Config.in new file +16
-0@@ -0,0 +1,16 @@ +config BR2_PACKAGE_LIBAPPARMOR + bool "libapparmor" + depends on BR2_TOOLCHAIN_HAS_SYNC_4 + depends on BR2_TOOLCHAIN_HAS_THREADS + depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_16 + help + AppArmor is an effective and easy-to-use Linux application + security system. AppArmor proactively protects the operating + system and applications from external or internal threats, + even zero-day attacks, by enforcing good behavior and + preventing even unknown application flaws from being + exploited. + + This package installs only the library. + + http://wiki.apparmor.netpackage/libapparmor/libapparmor.hash new file +4
-0@@ -0,0 +1,4 @@ +# locally computed +sha256 267053234c68cdb122c5294d7c276b6e2f5fa7e75c6c2d23e3ce69f95d9a7639 apparmor-2.13.3.tar.gz +sha256 a7e0cdcbea5c14927cedfc600d46526bdcbb1eb0a4d951e2ea53c2a6de159cb4 LICENSE +sha256 6095e9ffa777dd22839f7801aa845b31c9ed07f3d6bf8a26dc5d2dec8ccc0ef3 libraries/libapparmor/COPYING.LGPLpackage/libapparmor/libapparmor.mk new file +27
-1@@ -0,0 +1,27 @@ +################################################################################ +# +# libapparmor +# +################################################################################ + +LIBAPPARMOR_VERSION_MAJOR = 2.13 +LIBAPPARMOR_VERSION = $(LIBAPPARMOR_VERSION_MAJOR).3 +LIBAPPARMOR_SOURCE = apparmor-$(LIBAPPARMOR_VERSION).tar.gz +LIBAPPARMOR_SITE = https://launchpad.net/apparmor/$(LIBAPPARMOR_VERSION_MAJOR)/$(LIBAPPARMOR_VERSION)/+download +LIBAPPARMOR_LICENSE = LGPL-2.1 +LIBAPPARMOR_LICENSE_FILES = LICENSE libraries/libapparmor/COPYING.LGPL + +LIBAPPARMOR_DEPENDENCIES = host-bison host-flex host-pkgconf +LIBAPPARMOR_SUBDIR = libraries/libapparmor +LIBAPPARMOR_INSTALL_STAGING = YES + +# Most AppArmor tools will want to link to the static lib. +# ac_cv_prog_cc_c99 is required for BR2_USE_WCHAR=n because the C99 test +# provided by autoconf relies on wchar_t. +LIBAPPARMOR_CONF_OPTS = \ + ac_cv_prog_cc_c99=-std=gnu99 \ + --enable-static \ + --enable-man-pages=no \ + --without-python + +$(eval $(autotools-package)) --2.20.1
PATCH v5 2/9 linux: enable AppArmor-related options if needed
In reply to Yann E. MORINFrom: Angelo Compagnucci <[email protected]>
Using AppArmor requires support in the kernel, so do for AppArmor what we did for SElinux, and enabled the necessary options.
Note that a single LSM can be the default one, so as of today, SELinux wins, by virtue of being the last to be enabled.
[yann.morin.1998 at free.fr:
- don't force DEFAULT_SECURITY_APPARMOR, it does not exist in all kernel versions
- move closer to SELinux
- split into its own patch, write a commit log
]
--- linux/linux.mk | 5 +++++ 1 file changed, 5 insertions(+)
linux/linux.mk +5 -0
@@ -408,6 +408,11 @@ define LINUX_KCONFIG_FIXUP_CMDS $(call KCONFIG_ENABLE_OPT,CONFIG_FB,$(@D)/.config) $(call KCONFIG_ENABLE_OPT,CONFIG_LOGO,$(@D)/.config) $(call KCONFIG_ENABLE_OPT,CONFIG_LOGO_LINUX_CLUT224,$(@D)/.config)) + $(if $(BR2_PACKAGE_LIBAPPARMOR), + $(call KCONFIG_ENABLE_OPT,CONFIG_AUDIT,$(@D)/.config) + $(call KCONFIG_ENABLE_OPT,CONFIG_SECURITY,$(@D)/.config) + $(call KCONFIG_ENABLE_OPT,CONFIG_SECURITY_APPARMOR,$(@D)/.config) + $(call KCONFIG_ENABLE_OPT,CONFIG_DEFAULT_SECURITY_APPARMOR,$(@D)/.config)) $(if $(BR2_PACKAGE_LIBSELINUX), $(call KCONFIG_ENABLE_OPT,CONFIG_AUDIT,$(@D)/.config) $(call KCONFIG_ENABLE_OPT,CONFIG_DEFAULT_SECURITY_SELINUX,$(@D)/.config)
Signature · 1 line
2.20.1
PATCH v5 2/9 linux: enable AppArmor-related options if needed
Quoted 9 lines · Yann E. MORIN
From: Angelo Compagnucci <[email protected]>
Using AppArmor requires support in the kernel, so do for AppArmor what we did for SElinux, and enabled the necessary options.
Note that a single LSM can be the default one, so as of today, SELinux wins, by virtue of being the last to be enabled.
Quoted 8 lines
Signed-off-by Angelo Compagnucci <[email protected]>[yann.morin.1998 at free.fr:
- don't forceDEFAULT_SECURITY_APPARMOR, it does not exist in all kernel versions
- move closer to SELinux
- split into its own patch, write a commit log
]Signed-off-by Yann E. MORIN <[email protected]>
Quoted 23 lines
--- linux/linux.mk | 5 +++++ 1 file changed, 5 insertions(+)linux/linux.mk +5
-1@@ -408,6 +408,11 @@ define LINUX_KCONFIG_FIXUP_CMDS $(call KCONFIG_ENABLE_OPT,CONFIG_FB,$(@D)/.config) $(call KCONFIG_ENABLE_OPT,CONFIG_LOGO,$(@D)/.config) $(call KCONFIG_ENABLE_OPT,CONFIG_LOGO_LINUX_CLUT224,$(@D)/.config)) + $(if $(BR2_PACKAGE_LIBAPPARMOR), + $(call KCONFIG_ENABLE_OPT,CONFIG_AUDIT,$(@D)/.config) + $(call KCONFIG_ENABLE_OPT,CONFIG_SECURITY,$(@D)/.config) + $(call KCONFIG_ENABLE_OPT,CONFIG_SECURITY_APPARMOR,$(@D)/.config) + $(call KCONFIG_ENABLE_OPT,CONFIG_DEFAULT_SECURITY_APPARMOR,$(@D)/.config)) $(if $(BR2_PACKAGE_LIBSELINUX), $(call KCONFIG_ENABLE_OPT,CONFIG_AUDIT,$(@D)/.config) $(call KCONFIG_ENABLE_OPT,CONFIG_DEFAULT_SECURITY_SELINUX,$(@D)/.config) --2.20.1
PATCH v5 3/9 package/apparmor: new package
In reply to Yann E. MORINFrom: Angelo Compagnucci <[email protected]>
The various AppArmor utilities are spread in a few sub-directories of the apparmor source tree. For now, we build only the parser, but we'll soon introduce support for a few other utilities, so we prepare the package to be able to build more than just the parser, hence the slightly convoluted build and install commands, and the use of the APPARMOR_TOOLS and APPARMOR_MAKE_OPTS variables, which will come handy in the following commits.
We must ensure the version matches that of libapparmor, but there is not much we can do to enforce that, so as we do for various other packages, we just add a comment to that effect.
[yann.morin.1998 at free.fr:
- make it a separate package
- split into its own patch, write a commit log
]
--- package/Config.in | 1 + package/apparmor/Config.in | 19 ++++++++++++ package/apparmor/apparmor.hash | 4 +++ package/apparmor/apparmor.mk | 48 ++++++++++++++++++++++++++++++ package/libapparmor/libapparmor.mk | 1 + 5 files changed, 73 insertions(+) create mode 100644 package/apparmor/Config.in create mode 100644 package/apparmor/apparmor.hash create mode 100644 package/apparmor/apparmor.mk
package/Config.in +1 -0
@@ -2244,6 +2244,7 @@ menu "Real-Time" endmenu menu "Security" + source "package/apparmor/Config.in" source "package/checkpolicy/Config.in" source "package/ima-evm-utils/Config.in" source "package/optee-benchmark/Config.in"
package/apparmor/Config.in new file +19 -0
@@ -0,0 +1,19 @@ +config BR2_PACKAGE_APPARMOR + bool "apparmor" + depends on BR2_USE_MMU # fork() + depends on BR2_INSTALL_LIBSTDCPP + depends on BR2_TOOLCHAIN_HAS_SYNC_4 # libapparmor + depends on BR2_TOOLCHAIN_HAS_THREADS # libapparmor + depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_16 # libapparmor + select BR2_PACKAGE_LIBAPPARMOR + help + AppArmor is an effective and easy-to-use Linux application + security system. AppArmor proactively protects the operating + system and applications from external or internal threats, + even zero-day attacks, by enforcing good behavior and + preventing even unknown application flaws from being + exploited. + + This package builds the parser (which can load profiles). + + http://wiki.apparmor.net
package/apparmor/apparmor.hash new file +4 -0
@@ -0,0 +1,4 @@ +# locally computed +sha256 267053234c68cdb122c5294d7c276b6e2f5fa7e75c6c2d23e3ce69f95d9a7639 apparmor-2.13.3.tar.gz +sha256 a7e0cdcbea5c14927cedfc600d46526bdcbb1eb0a4d951e2ea53c2a6de159cb4 LICENSE +sha256 dd54950fa69a3096fe907a466a454d217ccca9bca77398d5232704766d5a0040 parser/COPYING.GPL
package/apparmor/apparmor.mk new file +48 -0
48 lines not on this page · raw message
package/libapparmor/libapparmor.mk +1 -0
@@ -4,6 +4,7 @@ # ################################################################################ +# When updating the version here, please also update the apparmor package LIBAPPARMOR_VERSION_MAJOR = 2.13 LIBAPPARMOR_VERSION = $(LIBAPPARMOR_VERSION_MAJOR).3 LIBAPPARMOR_SOURCE = apparmor-$(LIBAPPARMOR_VERSION).tar.gz
Signature · 1 line
2.20.1
PATCH v5 3/9 package/apparmor: new package
Quoted 15 lines · Yann E. MORIN
From: Angelo Compagnucci <[email protected]>
The various AppArmor utilities are spread in a few sub-directories of the apparmor source tree. For now, we build only the parser, but we'll soon introduce support for a few other utilities, so we prepare the package to be able to build more than just the parser, hence the slightly convoluted build and install commands, and the use of the
APPARMOR_TOOLSandAPPARMOR_MAKE_OPTSvariables, which will come handy in the following commits.We must ensure the version matches that of libapparmor, but there is not much we can do to enforce that, so as we do for various other packages, we just add a comment to that effect.
Quoted 6 lines
Signed-off-by Angelo Compagnucci <[email protected]>[yann.morin.1998 at free.fr:
- make it a separate package
- split into its own patch, write a commit log
]Signed-off-by Yann E. MORIN <[email protected]>
Quoted 127 lines
--- package/Config.in | 1 + package/apparmor/Config.in | 19 ++++++++++++ package/apparmor/apparmor.hash | 4 +++ package/apparmor/apparmor.mk | 48 ++++++++++++++++++++++++++++++ package/libapparmor/libapparmor.mk | 1 + 5 files changed, 73 insertions(+) create mode 100644 package/apparmor/Config.in create mode 100644 package/apparmor/apparmor.hash create mode 100644 package/apparmor/apparmor.mkpackage/Config.in +1
-0@@ -2244,6 +2244,7 @@ menu "Real-Time" endmenu menu "Security" + source "package/apparmor/Config.in" source "package/checkpolicy/Config.in" source "package/ima-evm-utils/Config.in" source "package/optee-benchmark/Config.in"package/apparmor/Config.in new file +19
-0@@ -0,0 +1,19 @@ +config BR2_PACKAGE_APPARMOR + bool "apparmor" + depends on BR2_USE_MMU # fork() + depends on BR2_INSTALL_LIBSTDCPP + depends on BR2_TOOLCHAIN_HAS_SYNC_4 # libapparmor + depends on BR2_TOOLCHAIN_HAS_THREADS # libapparmor + depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_16 # libapparmor + select BR2_PACKAGE_LIBAPPARMOR + help + AppArmor is an effective and easy-to-use Linux application + security system. AppArmor proactively protects the operating + system and applications from external or internal threats, + even zero-day attacks, by enforcing good behavior and + preventing even unknown application flaws from being + exploited. + + This package builds the parser (which can load profiles). + + http://wiki.apparmor.netpackage/apparmor/apparmor.hash new file +4
-0@@ -0,0 +1,4 @@ +# locally computed +sha256 267053234c68cdb122c5294d7c276b6e2f5fa7e75c6c2d23e3ce69f95d9a7639 apparmor-2.13.3.tar.gz +sha256 a7e0cdcbea5c14927cedfc600d46526bdcbb1eb0a4d951e2ea53c2a6de159cb4 LICENSE +sha256 dd54950fa69a3096fe907a466a454d217ccca9bca77398d5232704766d5a0040 parser/COPYING.GPLpackage/apparmor/apparmor.mk new file +48
-0@@ -0,0 +1,48 @@ +################################################################################ +# +# apparmor +# +################################################################################ + +# When updating the version here, please also update the libapparmor package +APPARMOR_VERSION_MAJOR = 2.13 +APPARMOR_VERSION = $(APPARMOR_VERSION_MAJOR).3 +APPARMOR_SITE = https://launchpad.net/apparmor/$(APPARMOR_VERSION_MAJOR)/$(APPARMOR_VERSION)/+download +APPARMOR_DL_SUBDIR = libapparmor +APPARMOR_LICENSE = GPL-2.0 +APPARMOR_LICENSE_FILES = LICENSE parser/COPYING.GPL + +APPARMOR_DEPENDENCIES = libapparmor + +APPARMOR_TOOLS = parser +APPARMOR_MAKE_OPTS = USE_SYSTEM=1 + +define APPARMOR_BUILD_CMDS + $(foreach tool,$(APPARMOR_TOOLS),\ + $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) \ + $(MAKE) -C $(@D)/$(tool) $(APPARMOR_MAKE_OPTS) + ) +endef + +define APPARMOR_INSTALL_TARGET_CMDS + $(foreach tool,$(APPARMOR_TOOLS),\ + $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) \ + $(MAKE) -C $(@D)/$(tool) $(APPARMOR_MAKE_OPTS) \ + DESTDIR=$(TARGET_DIR) install + ) +endef + +# Despite its name, apparmor.systemd is a sysv-init compatible startup script +define APPARMOR_INSTALL_INIT_SYSV + $(INSTALL) -D -m 0755 $(@D)/parser/apparmor.systemd \ + $(TARGET_DIR)/etc/init.d/S00apparmor +endef + +define APPARMOR_INSTALL_INIT_SYSTEMD + $(INSTALL) -D -m 0755 $(@D)/parser/apparmor.systemd \ + $(TARGET_DIR)/lib/apparmor/apparmor.systemd + $(INSTALL) -D -m 0755 $(@D)/parser/apparmor.service \ + $(TARGET_DIR)/usr/lib/systemd/system/apparmor.service +endef + +$(eval $(generic-package))package/libapparmor/libapparmor.mk +1
-1@@ -4,6 +4,7 @@ # ################################################################################ +# When updating the version here, please also update the apparmor package LIBAPPARMOR_VERSION_MAJOR = 2.13 LIBAPPARMOR_VERSION = $(LIBAPPARMOR_VERSION_MAJOR).3 LIBAPPARMOR_SOURCE = apparmor-$(LIBAPPARMOR_VERSION).tar.gz --2.20.1
PATCH v5 4/9 package/apparmor: add option to install binutils
In reply to Yann E. MORINFrom: Angelo Compagnucci <[email protected]>
--- package/apparmor/Config.in | 10 ++++++++++ package/apparmor/apparmor.mk | 4 ++++ 2 files changed, 14 insertions(+)
package/apparmor/Config.in +10 -0
@@ -17,3 +17,13 @@ config BR2_PACKAGE_APPARMOR This package builds the parser (which can load profiles). http://wiki.apparmor.net + +if BR2_PACKAGE_APPARMOR + +config BR2_PACKAGE_APPARMOR_BINUTILS + bool "binutils" + help + A set of utilities (written in C): + aa-enabled aa-exec + +endif
package/apparmor/apparmor.mk +4 -0
@@ -17,6 +17,10 @@ APPARMOR_DEPENDENCIES = libapparmor APPARMOR_TOOLS = parser APPARMOR_MAKE_OPTS = USE_SYSTEM=1 +ifeq ($(BR2_PACKAGE_APPARMOR_BINUTILS),y) +APPARMOR_TOOLS += binutils +endif + define APPARMOR_BUILD_CMDS $(foreach tool,$(APPARMOR_TOOLS),\ $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) \
Signature · 1 line
2.20.1
PATCH v5 4/9 package/apparmor: add option to install binutils
Quoted 6 lines · Yann E. MORIN
From: Angelo Compagnucci <[email protected]>
Signed-off-by Angelo Compagnucci <[email protected]>[yann.morin.1998 at free.fr: split off to its own patch]Signed-off-by Yann E. MORIN <[email protected]>
Quoted 41 lines
--- package/apparmor/Config.in | 10 ++++++++++ package/apparmor/apparmor.mk | 4 ++++ 2 files changed, 14 insertions(+)package/apparmor/Config.in +10
-0@@ -17,3 +17,13 @@ config BR2_PACKAGE_APPARMOR This package builds the parser (which can load profiles). http://wiki.apparmor.net + +if BR2_PACKAGE_APPARMOR + +config BR2_PACKAGE_APPARMOR_BINUTILS + bool "binutils" + help + A set of utilities (written in C): + aa-enabled aa-exec + +endifpackage/apparmor/apparmor.mk +4
-1@@ -17,6 +17,10 @@ APPARMOR_DEPENDENCIES = libapparmor APPARMOR_TOOLS = parser APPARMOR_MAKE_OPTS = USE_SYSTEM=1 +ifeq ($(BR2_PACKAGE_APPARMOR_BINUTILS),y) +APPARMOR_TOOLS += binutils +endif + define APPARMOR_BUILD_CMDS $(foreach tool,$(APPARMOR_TOOLS),\ $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) \ --2.20.1
PATCH v5 5/9 package/apparmor: add options to install utils
In reply to Yann E. MORINMost utilities are written in python3, except a few that are written in a mixture of POSIX shell, bash, perl and awk.
The Makefile does not allow isntalling parts of it, but requiring all of python3, bash, and perl to install the utils is too much of a requirement.
Instead, we split the set in two, on one hand the puthin ones, which we install when python3 is enabled, and on the other hand, the rest of the script which we call 'extras', and which we install when all the extra requirements (bash, perl, and busybox or gawk) are met; if not, then we remove these extras utils as a post-install hook.
Note about the order of the comments: they are in reverse-order of the associated config symbols, so that they are properly displayed.
[yann.morin.1998 at free.fr:
- split into its own patch
- re-arrange the conditions
]
--- package/apparmor/Config.in | 36 ++++++++++++++++++++++++++++++++++++ package/apparmor/apparmor.mk | 14 ++++++++++++++ 2 files changed, 50 insertions(+)
package/apparmor/Config.in +36 -0
@@ -26,4 +26,40 @@ config BR2_PACKAGE_APPARMOR_BINUTILS A set of utilities (written in C): aa-enabled aa-exec +config BR2_PACKAGE_APPARMOR_UTILS + bool "utils" + depends on BR2_PACKAGE_PYTHON3 + select BR2_PACKAGE_PYTHON3_READLINE + help + A set of utilities (written in pyhon): + aa-audit aa-disable aa-logprof + aa-autodep aa-easyprof aa-mergeprof + aa-cleanprof aa-enforce aa-status + aa-complain aa-genprof aa-unconfined + +config BR2_PACKAGE_APPARMOR_UTILS_EXTRA + bool "utils (extras)" + depends on BR2_PACKAGE_APPARMOR_UTILS + depends on BR2_PACKAGE_BUSYBOX || BR2_PACKAGE_GAWK + depends on BR2_PACKAGE_BASH + depends on BR2_PACKAGE_PERL + help + An extra set of utilities (written in a mixture of sh, + bash, perl, and awk): + aa-decode (bash + perl) + aa-notify (perl) + aa-remove-unknown (sh + awk) + +comment "utils (extras) need bash and perl, and busybox or gawk" + depends on BR2_PACKAGE_APPARMOR_UTILS + depends on !BR2_PACKAGE_BASH || !BR2_PACKAGE_PERL \ + || !(BR2_PACKAGE_BUSYBOX || BR2_PACKAGE_GAWK) + +comment "utils need python3" + depends on BR2_USE_MMU + depends on BR2_USE_WCHAR + depends on BR2_TOOLCHAIN_HAS_THREADS + depends on !BR2_STATIC_LIBS + depends on !BR2_PACKAGE_PYTHON3 + endif
package/apparmor/apparmor.mk +14 -0
@@ -21,6 +21,20 @@ ifeq ($(BR2_PACKAGE_APPARMOR_BINUTILS),y) APPARMOR_TOOLS += binutils endif +ifeq ($(BR2_PACKAGE_APPARMOR_UTILS),y) +APPARMOR_DEPENDENCIES += $(BR2_PYTHON3_HOST_DEPENDENCY) python3 +APPARMOR_TOOLS += utils +APPARMOR_MAKE_OPTS += PYTHON=$(HOST_DIR)/bin/python3 + +ifeq ($(BR2_PACKAGE_APPARMOR_UTILS_EXTRA),) +define APPARMOR_UTILS_NO_EXTRA + $(Q)rm -f $(addprefix $(TARGET_DIR)/usr/sbin/,aa-decode aa-notify aa-remove-unknown) +endef +APPARMOR_POST_INSTALL_TARGET_HOOKS += APPARMOR_UTILS_NO_EXTRA +endif # BR2_PACKAGE_APPARMOR_UTILS_EXTRA + +endif # BR2_PACKAGE_APPARMOR_UTILS + define APPARMOR_BUILD_CMDS $(foreach tool,$(APPARMOR_TOOLS),\ $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) \
Signature · 1 line
2.20.1
PATCH v5 5/9 package/apparmor: add options to install utils
Quoted 5 lines · Yann E. MORIN
Most utilities are written in python3, except a few that are written in a mixture of POSIX shell, bash, perl and awk.
The
Makefiledoes not allow isntalling
installing
Quoted 5 lines
parts of it, but requiring all of
python3, bash, and perl to install the utils is too much of a requirement.Instead, we split the set in two, on one hand the puthin
python
Quoted 9 lines
ones, which we
install when python3 is enabled, and on the other hand, the rest of the script which we call 'extras', and which we install when all the extra requirements (bash, perl, and busybox or gawk) are met; if not, then we remove these extras utils as a post-install hook.Note about the order of the comments: they are in reverse-order of the associated config symbols, so that they are properly displayed.
Quoted 6 lines
Signed-off-by Angelo Compagnucci <[email protected]>[yann.morin.1998 at free.fr:
- split into its own patch
- re-arrange the conditions
]Signed-off-by Yann E. MORIN <[email protected]>
Quoted 78 lines
--- package/apparmor/Config.in | 36 ++++++++++++++++++++++++++++++++++++ package/apparmor/apparmor.mk | 14 ++++++++++++++ 2 files changed, 50 insertions(+)package/apparmor/Config.in +36
-0@@ -26,4 +26,40 @@ config BR2_PACKAGE_APPARMOR_BINUTILS A set of utilities (written in C): aa-enabled aa-exec +config BR2_PACKAGE_APPARMOR_UTILS + bool "utils" + depends on BR2_PACKAGE_PYTHON3 + select BR2_PACKAGE_PYTHON3_READLINE + help + A set of utilities (written in pyhon): + aa-audit aa-disable aa-logprof + aa-autodep aa-easyprof aa-mergeprof + aa-cleanprof aa-enforce aa-status + aa-complain aa-genprof aa-unconfined + +config BR2_PACKAGE_APPARMOR_UTILS_EXTRA + bool "utils (extras)" + depends on BR2_PACKAGE_APPARMOR_UTILS + depends on BR2_PACKAGE_BUSYBOX || BR2_PACKAGE_GAWK + depends on BR2_PACKAGE_BASH + depends on BR2_PACKAGE_PERL + help + An extra set of utilities (written in a mixture of sh, + bash, perl, and awk): + aa-decode (bash + perl) + aa-notify (perl) + aa-remove-unknown (sh + awk) + +comment "utils (extras) need bash and perl, and busybox or gawk" + depends on BR2_PACKAGE_APPARMOR_UTILS + depends on !BR2_PACKAGE_BASH || !BR2_PACKAGE_PERL \ + || !(BR2_PACKAGE_BUSYBOX || BR2_PACKAGE_GAWK) + +comment "utils need python3" + depends on BR2_USE_MMU + depends on BR2_USE_WCHAR + depends on BR2_TOOLCHAIN_HAS_THREADS + depends on !BR2_STATIC_LIBS + depends on !BR2_PACKAGE_PYTHON3 + endifpackage/apparmor/apparmor.mk +14
-1@@ -21,6 +21,20 @@ ifeq ($(BR2_PACKAGE_APPARMOR_BINUTILS),y) APPARMOR_TOOLS += binutils endif +ifeq ($(BR2_PACKAGE_APPARMOR_UTILS),y) +APPARMOR_DEPENDENCIES += $(BR2_PYTHON3_HOST_DEPENDENCY) python3 +APPARMOR_TOOLS += utils +APPARMOR_MAKE_OPTS += PYTHON=$(HOST_DIR)/bin/python3 + +ifeq ($(BR2_PACKAGE_APPARMOR_UTILS_EXTRA),) +define APPARMOR_UTILS_NO_EXTRA + $(Q)rm -f $(addprefix $(TARGET_DIR)/usr/sbin/,aa-decode aa-notify aa-remove-unknown) +endef +APPARMOR_POST_INSTALL_TARGET_HOOKS += APPARMOR_UTILS_NO_EXTRA +endif # BR2_PACKAGE_APPARMOR_UTILS_EXTRA + +endif # BR2_PACKAGE_APPARMOR_UTILS + define APPARMOR_BUILD_CMDS $(foreach tool,$(APPARMOR_TOOLS),\ $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) \ --2.20.1
PATCH v5 6/9 package/apparmor: add option to install generic profiles
In reply to Yann E. MORINThe apparmor packages comes with a set of profiles for a class of usual, mostly server-class programs and daemons.
Even though an embedded device will mostly require custom profiles, the generic ones may come handy, as they also provide "abstractions", that can serve as templates for custom profiles.
--- package/apparmor/Config.in | 6 ++++++ package/apparmor/apparmor.mk | 4 ++++ 2 files changed, 10 insertions(+)
package/apparmor/Config.in +6 -0
@@ -62,4 +62,10 @@ comment "utils need python3" depends on !BR2_STATIC_LIBS depends on !BR2_PACKAGE_PYTHON3 +config BR2_PACKAGE_APPARMOR_PROFILES + bool "profiles" + help + Installs server-class profiles for a wide range of + usual programs and daemons. + endif
package/apparmor/apparmor.mk +4 -0
@@ -35,6 +35,10 @@ endif # BR2_PACKAGE_APPARMOR_UTILS_EXTRA endif # BR2_PACKAGE_APPARMOR_UTILS +ifeq ($(BR2_PACKAGE_APPARMOR_PROFILES),y) +APPARMOR_TOOLS += profiles +endif + define APPARMOR_BUILD_CMDS $(foreach tool,$(APPARMOR_TOOLS),\ $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) \
Signature · 1 line
2.20.1
PATCH v5 6/9 package/apparmor: add option to install generic profiles
Quoted 2 lines · Yann E. MORIN
The apparmor packages come
come
Quoted 10 lines
with a set of profiles for a class of usual,
mostly server-class programs and daemons.Even though an embedded device will mostly require custom profiles, the generic ones may come handy, as they also provide "abstractions", that can serve as templates for custom profiles.
Signed-off-by Angelo Compagnucci <[email protected]>[yann.morin.1998 at free.fr: split off into its own patch]Signed-off-by Yann E. MORIN <[email protected]>
Quoted 38 lines
--- package/apparmor/Config.in | 6 ++++++ package/apparmor/apparmor.mk | 4 ++++ 2 files changed, 10 insertions(+)package/apparmor/Config.in +6
-0@@ -62,4 +62,10 @@ comment "utils need python3" depends on !BR2_STATIC_LIBS depends on !BR2_PACKAGE_PYTHON3 +config BR2_PACKAGE_APPARMOR_PROFILES + bool "profiles" + help + Installs server-class profiles for a wide range of + usual programs and daemons. + endifpackage/apparmor/apparmor.mk +4
-1@@ -35,6 +35,10 @@ endif # BR2_PACKAGE_APPARMOR_UTILS_EXTRA endif # BR2_PACKAGE_APPARMOR_UTILS +ifeq ($(BR2_PACKAGE_APPARMOR_PROFILES),y) +APPARMOR_TOOLS += profiles +endif + define APPARMOR_BUILD_CMDS $(foreach tool,$(APPARMOR_TOOLS),\ $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) \ --2.20.1
PATCH v5 7/9 package/libapparmor: enable python bindings
In reply to Yann E. MORIN--- ...el-fixing-for-crosscompiling-environ.patch | 96 +++++++++++++++++++ ...ng-setup.py-call-when-crosscompiling.patch | 30 ++++++ package/libapparmor/libapparmor.mk | 17 +++- 3 files changed, 141 insertions(+), 2 deletions(-) create mode 100644 package/libapparmor/0001-m4-ac_python_devel-fixing-for-crosscompiling-environ.patch create mode 100644 package/libapparmor/0002-libapparmor-fixing-setup.py-call-when-crosscompiling.patch
package/libapparmor/0001-m4-ac_python_devel-fixing-for-crosscompiling-environ.patch new file +96 -0
@@ -0,0 +1,96 @@ +From 235ce271f3fee53b918317ebb73a47b3c6a7ae03 Mon Sep 17 00:00:00 2001 +From: Angelo Compagnucci <[email protected]> +Date: Tue, 24 Mar 2020 22:53:37 +0100 +Subject: [PATCH] m4: ac_python_devel: fixing for crosscompiling environments + +In a crosscompiling environment it's common to have a python executable +running for the host system with a python-config reporting the host +configuration and a second python-config reporting the target configuration. +In such cases, relying on the default oython-config is wrong and breaks +the cross compilation. + +This patch adds a PYTHON_CONFIG variable that can be pointed to the second +python-config and fixes the rest of the m4 accordingly. + +Signed-off-by: Angelo Compagnucci <[email protected]> +--- + libraries/libapparmor/m4/ac_python_devel.m4 | 25 ++++++++++++++++----- + 1 file changed, 19 insertions(+), 6 deletions(-) + +diff --git a/libraries/libapparmor/m4/ac_python_devel.m4 b/libraries/libapparmor/m4/ac_python_devel.m4 +index 2ea7dc77..6454e2d8 100644 +--- a/libraries/libapparmor/m4/ac_python_devel.m4 ++++ b/libraries/libapparmor/m4/ac_python_devel.m4 +@@ -13,6 +13,11 @@ AC_DEFUN([AC_PYTHON_DEVEL],[ + PYTHON_VERSION="" + fi + ++ AC_PATH_PROG([PYTHON_CONFIG],[`basename [$PYTHON]-config`]) ++ if test -z "$PYTHON_CONFIG"; then ++ AC_MSG_ERROR([Cannot find python$PYTHON_VERSION-config in your system path]) ++ fi ++ + # + # Check for a version of Python >= 2.1.0 + # +@@ -79,8 +84,8 @@ $ac_distutils_result]) + # Check for Python include path + # + AC_MSG_CHECKING([for Python include path]) +- if type $PYTHON-config; then +- PYTHON_CPPFLAGS=`$PYTHON-config --includes` ++ if type $PYTHON_CONFIG; then ++ PYTHON_CPPFLAGS=`$PYTHON_CONFIG --includes` + fi + if test -z "$PYTHON_CPPFLAGS"; then + python_path=`$PYTHON -c "import sys; import distutils.sysconfig;\ +@@ -97,8 +102,8 @@ sys.stdout.write('%s\n' % distutils.sysconfig.get_python_inc());"` + # Check for Python library path + # + AC_MSG_CHECKING([for Python library path]) +- if type $PYTHON-config; then +- PYTHON_LDFLAGS=`$PYTHON-config --ldflags` ++ if type $PYTHON_CONFIG; then ++ PYTHON_LDFLAGS=`$PYTHON_CONFIG --ldflags` + fi + if test -z "$PYTHON_LDFLAGS"; then + # (makes two attempts to ensure we've got a version number +@@ -136,10 +141,14 @@ sys.stdout.write('%s\n' % distutils.sysconfig.get_python_lib(0,0));"` + # libraries which must be linked in when embedding + # + AC_MSG_CHECKING(python extra libraries) ++ if type $PYTHON_CONFIG; then ++ PYTHON_EXTRA_LIBS=`$PYTHON_CONFIG --libs --embed` || \ ++ PYTHON_EXTRA_LIBS='' ++ fi + if test -z "$PYTHON_EXTRA_LIBS"; then + PYTHON_EXTRA_LIBS=`$PYTHON -c "import sys; import distutils.sysconfig; \ + conf = distutils.sysconfig.get_config_var; \ +-sys.stdout.write('%s %s\n' % (conf('LOCALMODLIBS'), conf('LIBS')))"` ++sys.stdout.write('%s %s %s\n' % (conf('BLDLIBRARY'), conf('LOCALMODLIBS'), conf('LIBS')))"` + fi + AC_MSG_RESULT([$PYTHON_EXTRA_LIBS]) + AC_SUBST(PYTHON_EXTRA_LIBS) +@@ -148,6 +157,10 @@ sys.stdout.write('%s %s\n' % (conf('LOCALMODLIBS'), conf('LIBS')))"` + # linking flags needed when embedding + # + AC_MSG_CHECKING(python extra linking flags) ++ if type $PYTHON_CONFIG; then ++ PYTHON_EXTRA_LDFLAGS=`$PYTHON_CONFIG --ldflags --embed` || \ ++ PYTHON_EXTRA_LDFLAGS='' ++ fi + if test -z "$PYTHON_EXTRA_LDFLAGS"; then + PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import sys; import distutils.sysconfig; \ + conf = distutils.sysconfig.get_config_var; \ +@@ -164,7 +177,7 @@ sys.stdout.write('%s\n' % conf('LINKFORSHARED'))"` + # save current global flags + ac_save_LIBS="$LIBS" + ac_save_CPPFLAGS="$CPPFLAGS" +- LIBS="$ac_save_LIBS $PYTHON_LDFLAGS" ++ LIBS="$ac_save_LIBS $PYTHON_EXTRA_LIBS $PYTHON_LDFLAGS" + CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS" + AC_TRY_LINK([ + #include <Python.h> +-- +2.17.1 +
package/libapparmor/0002-libapparmor-fixing-setup.py-call-when-crosscompiling.patch new file +30 -0
@@ -0,0 +1,30 @@ +From cf61d1257b9a5f12fdf6f4dd6a2746f77b23a8a0 Mon Sep 17 00:00:00 2001 +From: Angelo Compagnucci <[email protected]> +Date: Tue, 24 Mar 2020 23:02:08 +0100 +Subject: [PATCH] libapparmor: fixing setup.py call when crosscompiling + +When crosscompiling, setupy.py should be called passing the settings +discovered by ac_python_devel.m4 and not using the default system +settings. + +Signed-off-by: Angelo Compagnucci <[email protected]> +--- + libraries/libapparmor/swig/python/Makefile.am | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libraries/libapparmor/swig/python/Makefile.am b/libraries/libapparmor/swig/python/Makefile.am +index 421acba9..6c60181e 100644 +--- a/libraries/libapparmor/swig/python/Makefile.am ++++ b/libraries/libapparmor/swig/python/Makefile.am +@@ -11,7 +11,7 @@ MOSTLYCLEANFILES=libapparmor_wrap.c LibAppArmor.py + + all-local: libapparmor_wrap.c setup.py + if test ! -f libapparmor_wrap.c; then cp $(srcdir)/libapparmor_wrap.c . ; fi +- $(PYTHON) setup.py build ++ CC="$(CC)" CFLAGS="$(PYTHON_CPPFLAGS)" LDSHARED="$(CC) -shared" LDFLAGS="$(PYTHON_LDFLAGS)" $(PYTHON) setup.py build + + install-exec-local: + $(PYTHON) setup.py install --root="/$(DESTDIR)" --prefix="$(prefix)" +-- +2.17.1 +
package/libapparmor/libapparmor.mk +15 -2
@@ -16,13 +16,26 @@ LIBAPPARMOR_DEPENDENCIES = host-bison host-flex host-pkgconf LIBAPPARMOR_SUBDIR = libraries/libapparmor LIBAPPARMOR_INSTALL_STAGING = YES +# Patches 0001 and 0002 touch Makefile.am and an m4 file +LIBAPPARMOR_AUTORECONF = YES + # Most AppArmor tools will want to link to the static lib. # ac_cv_prog_cc_c99 is required for BR2_USE_WCHAR=n because the C99 test # provided by autoconf relies on wchar_t. LIBAPPARMOR_CONF_OPTS = \ ac_cv_prog_cc_c99=-std=gnu99 \ --enable-static \ - --enable-man-pages=no \ - --without-python + --enable-man-pages=no + +ifeq ($(BR2_PACKAGE_PYTHON3),y) +LIBAPPARMOR_DEPENDENCIES += host-python3 host-swig python3 +LIBAPPARMOR_CONF_OPTS += \ + --with-python \ + PYTHON=$(HOST_DIR)/usr/bin/python3 \ + PYTHON_CONFIG=$(STAGING_DIR)/usr/bin/python3-config \ + SWIG=$(SWIG) +else +LIBAPPARMOR_CONF_OPTS += --without-python +endif $(eval $(autotools-package))
Signature · 1 line
2.20.1
PATCH v5 7/9 package/libapparmor: enable python bindings
Quoted 4 lines · Yann E. MORIN
Signed-off-by Angelo Compagnucci <[email protected]>[yann.morin.1998 at free.fr: split off into its own patch]Signed-off-by Yann E. MORIN <[email protected]>
Quoted 182 lines
--- ...el-fixing-for-crosscompiling-environ.patch | 96 +++++++++++++++++++ ...ng-setup.py-call-when-crosscompiling.patch | 30 ++++++ package/libapparmor/libapparmor.mk | 17 +++- 3 files changed, 141 insertions(+), 2 deletions(-) create mode 100644 package/libapparmor/0001-m4-ac_python_devel-fixing-for-crosscompiling-environ.patch create mode 100644 package/libapparmor/0002-libapparmor-fixing-setup.py-call-when-crosscompiling.patchpackage/libapparmor/0001-m4-ac_python_devel-fixing-for-crosscompiling-environ.patch new file +96
-0@@ -0,0 +1,96 @@ +From 235ce271f3fee53b918317ebb73a47b3c6a7ae03 Mon Sep 17 00:00:00 2001 +From: Angelo Compagnucci <[email protected]> +Date: Tue, 24 Mar 2020 22:53:37 +0100 +Subject: [PATCH] m4: ac_python_devel: fixing for crosscompiling environments + +In a crosscompiling environment it's common to have a python executable +running for the host system with a python-config reporting the host +configuration and a second python-config reporting the target configuration. +In such cases, relying on the default oython-config is wrong and breaks +the cross compilation. + +This patch adds a PYTHON_CONFIG variable that can be pointed to the second +python-config and fixes the rest of the m4 accordingly. + +Signed-off-by: Angelo Compagnucci <[email protected]> +--- + libraries/libapparmor/m4/ac_python_devel.m4 | 25 ++++++++++++++++----- + 1 file changed, 19 insertions(+), 6 deletions(-) + +diff --git a/libraries/libapparmor/m4/ac_python_devel.m4 b/libraries/libapparmor/m4/ac_python_devel.m4 +index 2ea7dc77..6454e2d8 100644 +--- a/libraries/libapparmor/m4/ac_python_devel.m4 ++++ b/libraries/libapparmor/m4/ac_python_devel.m4 +@@ -13,6 +13,11 @@ AC_DEFUN([AC_PYTHON_DEVEL],[ + PYTHON_VERSION="" + fi + ++ AC_PATH_PROG([PYTHON_CONFIG],[`basename [$PYTHON]-config`]) ++ if test -z "$PYTHON_CONFIG"; then ++ AC_MSG_ERROR([Cannot find python$PYTHON_VERSION-config in your system path]) ++ fi ++ + # + # Check for a version of Python >= 2.1.0 + # +@@ -79,8 +84,8 @@ $ac_distutils_result]) + # Check for Python include path + # + AC_MSG_CHECKING([for Python include path]) +- if type $PYTHON-config; then +- PYTHON_CPPFLAGS=`$PYTHON-config --includes` ++ if type $PYTHON_CONFIG; then ++ PYTHON_CPPFLAGS=`$PYTHON_CONFIG --includes` + fi + if test -z "$PYTHON_CPPFLAGS"; then + python_path=`$PYTHON -c "import sys; import distutils.sysconfig;\ +@@ -97,8 +102,8 @@ sys.stdout.write('%s\n' % distutils.sysconfig.get_python_inc());"` + # Check for Python library path + # + AC_MSG_CHECKING([for Python library path]) +- if type $PYTHON-config; then +- PYTHON_LDFLAGS=`$PYTHON-config --ldflags` ++ if type $PYTHON_CONFIG; then ++ PYTHON_LDFLAGS=`$PYTHON_CONFIG --ldflags` + fi + if test -z "$PYTHON_LDFLAGS"; then + # (makes two attempts to ensure we've got a version number +@@ -136,10 +141,14 @@ sys.stdout.write('%s\n' % distutils.sysconfig.get_python_lib(0,0));"` + # libraries which must be linked in when embedding + # + AC_MSG_CHECKING(python extra libraries) ++ if type $PYTHON_CONFIG; then ++ PYTHON_EXTRA_LIBS=`$PYTHON_CONFIG --libs --embed` || \ ++ PYTHON_EXTRA_LIBS='' ++ fi + if test -z "$PYTHON_EXTRA_LIBS"; then + PYTHON_EXTRA_LIBS=`$PYTHON -c "import sys; import distutils.sysconfig; \ + conf = distutils.sysconfig.get_config_var; \ +-sys.stdout.write('%s %s\n' % (conf('LOCALMODLIBS'), conf('LIBS')))"` ++sys.stdout.write('%s %s %s\n' % (conf('BLDLIBRARY'), conf('LOCALMODLIBS'), conf('LIBS')))"` + fi + AC_MSG_RESULT([$PYTHON_EXTRA_LIBS]) + AC_SUBST(PYTHON_EXTRA_LIBS) +@@ -148,6 +157,10 @@ sys.stdout.write('%s %s\n' % (conf('LOCALMODLIBS'), conf('LIBS')))"` + # linking flags needed when embedding + # + AC_MSG_CHECKING(python extra linking flags) ++ if type $PYTHON_CONFIG; then ++ PYTHON_EXTRA_LDFLAGS=`$PYTHON_CONFIG --ldflags --embed` || \ ++ PYTHON_EXTRA_LDFLAGS='' ++ fi + if test -z "$PYTHON_EXTRA_LDFLAGS"; then + PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import sys; import distutils.sysconfig; \ + conf = distutils.sysconfig.get_config_var; \ +@@ -164,7 +177,7 @@ sys.stdout.write('%s\n' % conf('LINKFORSHARED'))"` + # save current global flags + ac_save_LIBS="$LIBS" + ac_save_CPPFLAGS="$CPPFLAGS" +- LIBS="$ac_save_LIBS $PYTHON_LDFLAGS" ++ LIBS="$ac_save_LIBS $PYTHON_EXTRA_LIBS $PYTHON_LDFLAGS" + CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS" + AC_TRY_LINK([ + #include <Python.h> +-- +2.17.1 +package/libapparmor/0002-libapparmor-fixing-setup.py-call-when-crosscompiling.patch new file +30
-0@@ -0,0 +1,30 @@ +From cf61d1257b9a5f12fdf6f4dd6a2746f77b23a8a0 Mon Sep 17 00:00:00 2001 +From: Angelo Compagnucci <[email protected]> +Date: Tue, 24 Mar 2020 23:02:08 +0100 +Subject: [PATCH] libapparmor: fixing setup.py call when crosscompiling + +When crosscompiling, setupy.py should be called passing the settings +discovered by ac_python_devel.m4 and not using the default system +settings. + +Signed-off-by: Angelo Compagnucci <[email protected]> +--- + libraries/libapparmor/swig/python/Makefile.am | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libraries/libapparmor/swig/python/Makefile.am b/libraries/libapparmor/swig/python/Makefile.am +index 421acba9..6c60181e 100644 +--- a/libraries/libapparmor/swig/python/Makefile.am ++++ b/libraries/libapparmor/swig/python/Makefile.am +@@ -11,7 +11,7 @@ MOSTLYCLEANFILES=libapparmor_wrap.c LibAppArmor.py + + all-local: libapparmor_wrap.c setup.py + if test ! -f libapparmor_wrap.c; then cp $(srcdir)/libapparmor_wrap.c . ; fi +- $(PYTHON) setup.py build ++ CC="$(CC)" CFLAGS="$(PYTHON_CPPFLAGS)" LDSHARED="$(CC) -shared" LDFLAGS="$(PYTHON_LDFLAGS)" $(PYTHON) setup.py build + + install-exec-local: + $(PYTHON) setup.py install --root="/$(DESTDIR)" --prefix="$(prefix)" +-- +2.17.1 +package/libapparmor/libapparmor.mk +15
-3@@ -16,13 +16,26 @@ LIBAPPARMOR_DEPENDENCIES = host-bison host-flex host-pkgconf LIBAPPARMOR_SUBDIR = libraries/libapparmor LIBAPPARMOR_INSTALL_STAGING = YES +# Patches 0001 and 0002 touch Makefile.am and an m4 file +LIBAPPARMOR_AUTORECONF = YES + # Most AppArmor tools will want to link to the static lib. # ac_cv_prog_cc_c99 is required for BR2_USE_WCHAR=n because the C99 test # provided by autoconf relies on wchar_t. LIBAPPARMOR_CONF_OPTS = \ ac_cv_prog_cc_c99=-std=gnu99 \ --enable-static \ - --enable-man-pages=no \ - --without-python + --enable-man-pages=no + +ifeq ($(BR2_PACKAGE_PYTHON3),y) +LIBAPPARMOR_DEPENDENCIES += host-python3 host-swig python3 +LIBAPPARMOR_CONF_OPTS += \ + --with-python \ + PYTHON=$(HOST_DIR)/usr/bin/python3 \ + PYTHON_CONFIG=$(STAGING_DIR)/usr/bin/python3-config \ + SWIG=$(SWIG) +else +LIBAPPARMOR_CONF_OPTS += --without-python +endif $(eval $(autotools-package)) --2.20.1
PATCH v5 8/9 package/apparmor: enable PAM integration
In reply to Yann E. MORIN--- package/apparmor/apparmor.mk | 5 +++++ 1 file changed, 5 insertions(+)
package/apparmor/apparmor.mk +5 -0
@@ -39,6 +39,11 @@ ifeq ($(BR2_PACKAGE_APPARMOR_PROFILES),y) APPARMOR_TOOLS += profiles endif +ifeq ($(BR2_PACKAGE_LINUX_PAM),y) +APPARMOR_DEPENDENCIES += linux-pam +APPARMOR_TOOLS += changehat/pam_apparmor +endif + define APPARMOR_BUILD_CMDS $(foreach tool,$(APPARMOR_TOOLS),\ $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) \
Signature · 1 line
2.20.1
PATCH v5 8/9 package/apparmor: enable PAM integration
Quoted 4 lines · Yann E. MORIN
Signed-off-by Angelo Compagnucci <[email protected]>[yann.morin.1998 at free.fr: split off to its own patch]Signed-off-by Yann E. MORIN <[email protected]>
Quoted 23 lines
--- package/apparmor/apparmor.mk | 5 +++++ 1 file changed, 5 insertions(+)package/apparmor/apparmor.mk +5
-1@@ -39,6 +39,11 @@ ifeq ($(BR2_PACKAGE_APPARMOR_PROFILES),y) APPARMOR_TOOLS += profiles endif +ifeq ($(BR2_PACKAGE_LINUX_PAM),y) +APPARMOR_DEPENDENCIES += linux-pam +APPARMOR_TOOLS += changehat/pam_apparmor +endif + define APPARMOR_BUILD_CMDS $(foreach tool,$(APPARMOR_TOOLS),\ $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) \ --2.20.1
PATCH v5 9/9 package/apparmor: enable apache integration
In reply to Yann E. MORIN--- package/apparmor/apparmor.mk | 6 ++++++ 1 file changed, 6 insertions(+)
package/apparmor/apparmor.mk +6 -0
@@ -44,6 +44,12 @@ APPARMOR_DEPENDENCIES += linux-pam APPARMOR_TOOLS += changehat/pam_apparmor endif +ifeq ($(BR2_PACKAGE_APACHE),y) +APPARMOR_DEPENDENCIES += apache +APPARMOR_TOOLS += changehat/mod_apparmor +APPARMOR_MAKE_OPTS += APXS=$(STAGING_DIR)/usr/bin/apxs +endif + define APPARMOR_BUILD_CMDS $(foreach tool,$(APPARMOR_TOOLS),\ $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) \
Signature · 1 line
2.20.1
PATCH v5 9/9 package/apparmor: enable apache integration
Quoted 4 lines · Yann E. MORIN
Signed-off-by Angelo Compagnucci <[email protected]>[yann.morin.1998 at free.fr: split off to its own patch]Signed-off-by Yann E. MORIN <[email protected]>
Quoted 24 lines
--- package/apparmor/apparmor.mk | 6 ++++++ 1 file changed, 6 insertions(+)package/apparmor/apparmor.mk +6
-1@@ -44,6 +44,12 @@ APPARMOR_DEPENDENCIES += linux-pam APPARMOR_TOOLS += changehat/pam_apparmor endif +ifeq ($(BR2_PACKAGE_APACHE),y) +APPARMOR_DEPENDENCIES += apache +APPARMOR_TOOLS += changehat/mod_apparmor +APPARMOR_MAKE_OPTS += APXS=$(STAGING_DIR)/usr/bin/apxs +endif + define APPARMOR_BUILD_CMDS $(foreach tool,$(APPARMOR_TOOLS),\ $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) \ --2.20.1
v5 cover package/apparmor: new package (branch yem/apparmor)
In reply to Yann E. MORINAngelo, All,
On 2020-03-29 16:01 +0200, Yann E. MORIN spake thusly:
Quoted 3 lines
This series is reworked of the previous work from Angelo:
http://lists.busybox.net/pipermail/buildroot/2020-March/278308.html http://lists.busybox.net/pipermail/buildroot/2020-March/278307.html
Angelo, did you have the opportunity to have a look at this series?
Regards,
Yann E. MORIN.
Quoted 96 lines
Fundamentally, (almost) all the code is from Angelo, and it has jsut been spread across two packages.
The way the apparmor package is laid out is not very amenable at doing a single package that builds everything: all the tools and utils depend on libapparmor, and that is better installed before the build of the tools is attempted.
So, we split the packaging in two:
- libapparmor, which is siolely responsible for installing libapparmor and its python3 bindings,
- apparmor per-se, which is responsible for installing all the tools and utilities.
To be noted: most of the tools' Makefiles hard-code linking to the static libapparmor (without explanations), so rather than go against the tide, we just enforce building the static library (note also that we do not forbid building the shared one).
The only major part that was dropped from the initial series, is support for writign the cache on read-write filesystems. The codition was based on
BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW, but that does not prevent building an actually read-only filesystem at all (e.g. squashfs). So, more thoughts will have to be poured into this caching feature in a subsequent series.Chage v4 -> v5: (adopted by Yann)
- split in two packages, one for the lib, ione for the utils
- reword all the commit logs
- fix dependencies (threads, mmu...)
- re-organise the conditions to install utils (python3 vs others)
- drop the cache writing for read-write filesystemsRegards,
Yann E. MORIN.The following changes since commit
d0f5a5551ab86f6272f13deaa16dcdf4b07a524fpackage/sysstat: bump to version 12.2.1 (2020-03-29 15:50:36 +0200)
are available in the git repository at:
git://git.buildroot.org/~ymorin/git/buildroot.gitfor you to fetch changes up to
8b4415dad37fa81cf2d4adb09b27119b233bcd8apackage/apparmor: enable apache integration (2020-03-29 16:01:18 +0200)
----------------------------------------------------------------
Angelo Compagnucci (4):
package/libapparmor: new package
linux: enable AppArmor-related options if needed package/apparmor: new package package/apparmor: add option to install binutilsYann E. MORIN (5):
package/apparmor: add options to install utils package/apparmor: add option to install generic profiles package/libapparmor: enable python bindings package/apparmor: enable PAM integration package/apparmor: enable apache integrationDEVELOPERS | 1 + linux/linux.mk | 5 ++ package/Config.in | 2 + package/apparmor/Config.in | 71 ++++++++++++++++ package/apparmor/apparmor.hash | 4 + package/apparmor/apparmor.mk | 81 ++++++++++++++++++ ...n_devel-fixing-for-crosscompiling-environ.patch | 96 ++++++++++++++++++++++ ...-fixing-setup.py-call-when-crosscompiling.patch | 30 +++++++ package/libapparmor/Config.in | 16 ++++ package/libapparmor/libapparmor.hash | 4 + package/libapparmor/libapparmor.mk | 41 +++++++++ 11 files changed, 351 insertions(+) create mode 100644 package/apparmor/Config.in create mode 100644 package/apparmor/apparmor.hash create mode 100644 package/apparmor/apparmor.mk create mode 100644 package/libapparmor/0001-m4-ac_python_devel-fixing-for-crosscompiling-environ.patch create mode 100644 package/libapparmor/0002-libapparmor-fixing-setup.py-call-when-crosscompiling.patch create mode 100644 package/libapparmor/Config.in create mode 100644 package/libapparmor/libapparmor.hash create mode 100644 package/libapparmor/libapparmor.mkSignature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
v5 cover package/apparmor: new package (branch yem/apparmor)
In reply to Yann E. MORINAngelo, All,
On 2020-03-29 16:01 +0200, Yann E. MORIN spake thusly:
Quoted 3 lines
This series is reworked of the previous work from Angelo:
http://lists.busybox.net/pipermail/buildroot/2020-March/278308.html http://lists.busybox.net/pipermail/buildroot/2020-March/278307.html
Series applied to master, after doign a few fixes noticed by Thomas P. on IRC. Thanks!
Regards,
Yann E. MORIN.
Quoted 95 lines
been spread across two packages.
The way the apparmor package is laid out is not very amenable at doing a single package that builds everything: all the tools and utils depend on libapparmor, and that is better installed before the build of the tools is attempted.
So, we split the packaging in two:
- libapparmor, which is siolely responsible for installing libapparmor and its python3 bindings,
- apparmor per-se, which is responsible for installing all the tools and utilities.
To be noted: most of the tools' Makefiles hard-code linking to the static libapparmor (without explanations), so rather than go against the tide, we just enforce building the static library (note also that we do not forbid building the shared one).
The only major part that was dropped from the initial series, is support for writign the cache on read-write filesystems. The codition was based on
BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW, but that does not prevent building an actually read-only filesystem at all (e.g. squashfs). So, more thoughts will have to be poured into this caching feature in a subsequent series.Chage v4 -> v5: (adopted by Yann)
- split in two packages, one for the lib, ione for the utils
- reword all the commit logs
- fix dependencies (threads, mmu...)
- re-organise the conditions to install utils (python3 vs others)
- drop the cache writing for read-write filesystemsRegards,
Yann E. MORIN.The following changes since commit
d0f5a5551ab86f6272f13deaa16dcdf4b07a524fpackage/sysstat: bump to version 12.2.1 (2020-03-29 15:50:36 +0200)
are available in the git repository at:
git://git.buildroot.org/~ymorin/git/buildroot.gitfor you to fetch changes up to
8b4415dad37fa81cf2d4adb09b27119b233bcd8apackage/apparmor: enable apache integration (2020-03-29 16:01:18 +0200)
----------------------------------------------------------------
Angelo Compagnucci (4):
package/libapparmor: new package
linux: enable AppArmor-related options if needed package/apparmor: new package package/apparmor: add option to install binutilsYann E. MORIN (5):
package/apparmor: add options to install utils package/apparmor: add option to install generic profiles package/libapparmor: enable python bindings package/apparmor: enable PAM integration package/apparmor: enable apache integrationDEVELOPERS | 1 + linux/linux.mk | 5 ++ package/Config.in | 2 + package/apparmor/Config.in | 71 ++++++++++++++++ package/apparmor/apparmor.hash | 4 + package/apparmor/apparmor.mk | 81 ++++++++++++++++++ ...n_devel-fixing-for-crosscompiling-environ.patch | 96 ++++++++++++++++++++++ ...-fixing-setup.py-call-when-crosscompiling.patch | 30 +++++++ package/libapparmor/Config.in | 16 ++++ package/libapparmor/libapparmor.hash | 4 + package/libapparmor/libapparmor.mk | 41 +++++++++ 11 files changed, 351 insertions(+) create mode 100644 package/apparmor/Config.in create mode 100644 package/apparmor/apparmor.hash create mode 100644 package/apparmor/apparmor.mk create mode 100644 package/libapparmor/0001-m4-ac_python_devel-fixing-for-crosscompiling-environ.patch create mode 100644 package/libapparmor/0002-libapparmor-fixing-setup.py-call-when-crosscompiling.patch create mode 100644 package/libapparmor/Config.in create mode 100644 package/libapparmor/libapparmor.hash create mode 100644 package/libapparmor/libapparmor.mkSignature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'