Skip to contentSkip to conversation

package/libcap-ng: add support for host variant

PATCH New Adam Duskett 2 participants 8 messages Jul 16, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/5 package/libcap-ng: add support for host variant

refpolicy requires several packages to be compiled as a host variant. The following list is in order of required packages:

refpolicy
host-policycoreutils
host-libsemanage
host-audit
host-libcap-ng

---
Changes:

v1 - v2:
- Changed patch order

 package/libcap-ng/libcap-ng.mk | 5 +++++
 1 file changed, 5 insertions(+)
package/libcap-ng/libcap-ng.mk +4 -0
index d78f5dc..fae6346 100644
@@ -13,4 +13,8 @@ LIBCAP_NG_INSTALL_STAGING = YES
 LIBCAP_NG_CONF_ENV = ac_cv_prog_swig_found=no
 LIBCAP_NG_CONF_OPTS = --without-python
 
+HOST_LIBCAP_NG_CONF_ENV = ac_cv_prog_swig_found=no
+HOST_LIBCAP_NG_CONF_OPTS = --without-python
+
 $(eval $(autotools-package))
+$(eval $(host-autotools-package))
Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 2/5 package/audit: add support for host variant

refpolicy requires host-audit to compile. This patch adds that support. As previously discussed, libcap-ng is required as far as I can tell, and as such, I have made it mandatory to compile it as a dependency.

---
Changes:

v1 - v2:
- Removed frivilous check for libcap-ng
- made host-libcap-ng mandatory.

 package/audit/audit.mk | 9 +++++++++
 1 file changed, 9 insertions(+)
package/audit/audit.mk +3 -0
index 89fdf14..1300c72 100644
@@ -58,4 +58,7 @@ define AUDIT_INSTALL_CLEANUP
 endef
 AUDIT_POST_INSTALL_TARGET_HOOKS += AUDIT_INSTALL_CLEANUP
 
+HOST_AUDIT_CONF_OPTS = --without-python --without-python3 --disable-zos-remote --with-libcap-ng=yes
+
 $(eval $(autotools-package))
+$(eval $(host-autotools-package))
Signature · 1 line
2.7.4
#4 lore raw

PATCH v2 3/5 package/libsemanage: add host-audit as a dependency.

In reply to Adam Duskett

refpolicy requires host-libsemanage. host-libsemanage will fail to compile without host-audit. This adds host-audit as a requirement for host-libsemanage.

---
Changes:

v1 - v2:
- Added better reasoning as to why this patch exists.

 package/libsemanage/libsemanage.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/libsemanage/libsemanage.mk +1 -1
index a60d018..beb34ba 100644
@@ -27,7 +27,7 @@ define LIBSEMANAGE_INSTALL_TARGET_CMDS
 	$(MAKE) -C $(@D) $(LIBSEMANAGE_MAKE_OPTS) DESTDIR=$(TARGET_DIR) install
 endef
 
-HOST_LIBSEMANAGE_DEPENDENCIES = host-bison host-libsepol host-libselinux \
+HOST_LIBSEMANAGE_DEPENDENCIES = host-bison host-audit host-libsepol host-libselinux \
 				host-ustr host-bzip2 host-swig
 HOST_LIBSEMANAGE_MAKE_OPTS += $(HOST_CONFIGURE_OPTS) \
 	SWIG_LIB="$(HOST_DIR)/usr/share/swig/$(SWIG_VERSION)/"
Signature · 1 line
2.7.4
#6 lore raw

PATCH v2 4/5 policycoreutils: new package

In reply to Adam Duskett

This package contains the core policy utilities that are required for basic operation of an SELinux system.

This package was updated to work with version 2.5 and is being submitted with no other differences compared to the previous version that Matt Weber submitted here: https://patchwork.ozlabs.org/patch/641329/

I emailed Matt Weber personally and recieved his approval to take over this patch.

---
Changes:

v1 - v2: No changes

 ...IR-to-all-paths-that-use-an-absolute-path.patch | 131 +++++++++++++
 .../0002-Add-PREFIX-to-host-paths.patch            | 211 +++++++++++++++++++++
 .../0003-Remove-hardcoded-arch-variable.patch      |  43 +++++
 ...licy-python-install-arguments-to-be-a-var.patch |  42 ++++
 .../0005-Check-to-see-if-DBUS-is-enabled.patch     |  56 ++++++
 package/policycoreutils/Config.in                  |  59 ++++++
 package/policycoreutils/policycoreutils.hash       |   2 +
 package/policycoreutils/policycoreutils.mk         | 111 +++++++++++
 9 files changed, 656 insertions(+)
 create mode 100644 package/policycoreutils/0001-Add-DESTDIR-to-all-paths-that-use-an-absolute-path.patch
 create mode 100644 package/policycoreutils/0002-Add-PREFIX-to-host-paths.patch
 create mode 100644 package/policycoreutils/0003-Remove-hardcoded-arch-variable.patch
 create mode 100644 package/policycoreutils/0004-Change-sepolicy-python-install-arguments-to-be-a-var.patch
 create mode 100644 package/policycoreutils/0005-Check-to-see-if-DBUS-is-enabled.patch
 create mode 100644 package/policycoreutils/Config.in
 create mode 100644 package/policycoreutils/policycoreutils.hash
 create mode 100644 package/policycoreutils/policycoreutils.mk
package/Config.in +1 -0
index 009b828..cc875e8 100644
@@ -1619,6 +1619,7 @@ menu "Real-Time"
 endmenu
 
 menu "Security"
+	source "package/policycoreutils/Config.in"
 	source "package/setools/Config.in"
 endmenu
 
package/policycoreutils/0001-Add-DESTDIR-to-all-paths-that-use-an-absolute-path.patch new file +131 -0

131 lines not on this page · raw message

package/policycoreutils/0002-Add-PREFIX-to-host-paths.patch new file +211 -0

211 lines not on this page · raw message

package/policycoreutils/0003-Remove-hardcoded-arch-variable.patch new file +43 -0

43 lines not on this page · raw message

package/policycoreutils/0004-Change-sepolicy-python-install-arguments-to-be-a-var.patch new file +42 -0

42 lines not on this page · raw message

package/policycoreutils/0005-Check-to-see-if-DBUS-is-enabled.patch new file +56 -0

56 lines not on this page · raw message

package/policycoreutils/Config.in new file +59 -0

59 lines not on this page · raw message

package/policycoreutils/policycoreutils.hash new file +2 -0
new file mode 100644
index 0000000..44cb0c3
@@ -0,0 +1,2 @@
+# https://github.com/SELinuxProject/selinux/wiki/Releases
+sha256 329382cfe9fa977678abf541dcd8fe3847cf0c83b24654c8f7322343907078a1 policycoreutils-2.5.tar.gz
package/policycoreutils/policycoreutils.mk new file +111 -0

111 lines not on this page · raw message

Signature · 1 line
2.7.4
#7 lore raw

PATCH v2 5/5 refpolicy: new package

In reply to Adam Duskett

The patch is for adding selinux reference policy (refpolicy). It is a complete SELinux policy that can be used as the system policy for a variety of systems and used as the basis for creating other policies.

I emailed Matt Weber and recieved approval to take over this patch series.

---

Changes v1 - v2:
- Updated version to 20151208
- Moved Fix-awk-references patch into base dir, as it still applies to the new Version.
- Added custom policy name to menuconfig (default is buildroot).
- Added custom default boolean file.
- Added path for custom boolean file in menuconfig.
- Changed /selinux to newer /sys/fs/selinux in S00Selinux

 .../0001-Fix-awk-references-to-use-variable.patch  |   42 +
 package/refpolicy/Config.in                        |  146 +++
 package/refpolicy/S00selinux                       |  126 ++
 package/refpolicy/booleans.conf                    | 1278 ++++++++++++++++++++
 package/refpolicy/config                           |    8 +
 package/refpolicy/modules.conf                     |  430 +++++++
 package/refpolicy/refpolicy.hash                   |    2 +
 package/refpolicy/refpolicy.mk                     |  118 ++
 9 files changed, 2151 insertions(+)
 create mode 100644 package/refpolicy/0001-Fix-awk-references-to-use-variable.patch
 create mode 100644 package/refpolicy/Config.in
 create mode 100644 package/refpolicy/S00selinux
 create mode 100644 package/refpolicy/booleans.conf
 create mode 100644 package/refpolicy/config
 create mode 100644 package/refpolicy/modules.conf
 create mode 100644 package/refpolicy/refpolicy.hash
 create mode 100644 package/refpolicy/refpolicy.mk
package/Config.in +1 -0
index cc875e8..a9446ae 100644
@@ -1620,6 +1620,7 @@ endmenu
 
 menu "Security"
 	source "package/policycoreutils/Config.in"
+	source "package/refpolicy/Config.in"
 	source "package/setools/Config.in"
 endmenu
 
package/refpolicy/0001-Fix-awk-references-to-use-variable.patch new file +42 -0

42 lines not on this page · raw message

package/refpolicy/Config.in new file +146 -0

146 lines not on this page · raw message

package/refpolicy/S00selinux new file +126 -0

126 lines not on this page · raw message

package/refpolicy/booleans.conf new file +1278 -0

1,278 lines not on this page · raw message

package/refpolicy/config new file +8 -0
new file mode 100644
index 0000000..5eee807
@@ -0,0 +1,8 @@
+# This file controls the state of SELinux on the system.
+# SELINUX= can take one of these three values:
+#     enforcing - SELinux security policy is enforced.
+#     permissive - SELinux prints warnings instead of enforcing.
+#     disabled - No SELinux policy is loaded.
+SELINUX=permissive
+# SELINUXTYPE= name of the selinux policy to use
+SELINUXTYPE=refpolicy
package/refpolicy/modules.conf new file +430 -0

430 lines not on this page · raw message

package/refpolicy/refpolicy.hash new file +2 -0
new file mode 100644
index 0000000..c10de45
@@ -0,0 +1,2 @@
+#From https://github.com/TresysTechnology/refpolicy/wiki/DownloadRelease
+sha256 2dd2f45a7132137afe8302805c3b7839739759b9ab73dd1815c01afe34ac99de  refpolicy-2.20151208.tar.bz2
package/refpolicy/refpolicy.mk new file +118 -0

118 lines not on this page · raw message

Signature · 1 line
2.7.4
#2 lore raw

PATCH v2 2/5 package/audit: add support for host variant

In reply to Adam Duskett

Hello,

Quoted 3 lines · Adam Duskett

refpolicy requires host-audit to compile. This patch adds that support. As previously discussed, libcap-ng is required as far as I can tell, and as such, I have made it mandatory to compile it as a dependency.

Don't use first person sentences in commit log.

Quoted 16 lines

---
Changes:

v1 - v2:
- Removed frivilous check for libcap-ng
- made host-libcap-ng mandatory.

 package/audit/audit.mk | 9 +++++++++
 1 file changed, 9 insertions(+)
package/audit/audit.mk +0 -0
index 89fdf14..1300c72 100644

package/audit/audit.mk define AUDIT_INSTALL_CLEANUP · line 61

Quoted 4 lines
package/audit/audit.mk +1 -0
@@ -58,4 +58,7 @@ define AUDIT_INSTALL_CLEANUP
 endef
 AUDIT_POST_INSTALL_TARGET_HOOKS += AUDIT_INSTALL_CLEANUP
 
+HOST_AUDIT_CONF_OPTS = --without-python --without-python3 --disable-zos-remote --with-libcap-ng=yes

So you use libcap-ng, but you don't depend on it? Doesn't seem right. Also, it would be good to be really sure it is needed. Did you try without it? How do you test this patch series?

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#3 lore raw

PATCH v2 2/5 package/audit: add support for host variant

In reply to Adam Duskett

Hello,

Quoted 7 lines · Adam Duskett

refpolicy requires host-audit to compile. This patch adds that support. As previously discussed, libcap-ng is required as far as I can tell, and as such, I have made it mandatory to compile it as a dependency.

---
Changes:

I've applied after removing the libcap-ng usage for the moment, and reworking the commit log.

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#5 lore raw

PATCH v2 3/5 package/libsemanage: add host-audit as a dependency.

In reply to Adam Duskett

Hello,

Quoted 7 lines · Adam Duskett

refpolicy requires host-libsemanage. host-libsemanage will fail to compile without host-audit. This adds host-audit as a requirement for host-libsemanage.

---
Changes:

I've indeed reproduce the host-libsemanage build issue. This build issue is in fact an excellent illustration what I hate to have host package that are not used by any other package in Buildroot: it has been broken since ages, and nobody noticed.

So, I've applied your patch, which fixed the build problem.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com