Skip to contentSkip to conversation

SELinux Buildroot Additions

PATCH Superseded Clayton Shotwell 3 participants 27 messages Dec 12, 2013 – Dec 17, 2013

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v4 cover SELinux Buildroot Additions

This is round 4 for the SELinux package additions. General changes for this round include:
- Incorporating many changes from Thomas Petazzoni (Thank again!).
- Removal of clean make options.
- Cleanup of the refpolicy build to rename the generated policy and limit the number of package policies that get built. More can be added in later.
- Changed the audit startup script to launch before the logging script.
- Cleaned up the dependencies on several packages.
- Added busybox SELinux configuration options to enable SELinux support and also make all of the busybox applications stand- alone binaries rather than symlinks (work done by Thomas).
- Added a basic x86 configuration that has SELinux enabled.

This round of change enables SELinux to be built by enabling the BR2_PACKAGE_REFPOLICY and enabling the following kernel config options.
CONFIG_AUDIT
CONFIG_SECURITY
CONFIG_SECURITY_NETWORK
CONFIG_SECURITY_SELINUX CONFIG_SECURITY_SELINUX_BOOTPARAM CONFIG_EXT2_FS_XATTR
CONFIG_EXT2_FS_SECURITY

I have tested this version of the patches using a buildroot glibc toolchain. The SELinux policy does not currently support most of Buildroot system but it is definitely a start. There will need to be more customization work done in the future to get packages fully supported.

Clayton Shotwell (17):
pcre: Add host build support
libselinux: new package
ustr: new package
bzip2: Add host build shared library installation
libsemanage: new package
checkpolicy: new package
sepolgen: new package
sqlite: Add host build support
setools: new package
python-pyparsing: Add host build option
audit: new package
policycoreutils: new package
python-pyxml: new package
refpolicy: new package
shadow: new package
refpolicy: Add busybox selections
configs: Add SELinux x86 qemu config

Thomas Petazzoni (3):
busybox: add option to install individual binaries
busybox: add option to enable SELinux support
busybox: ensure it finds pkg-config by setting PATH

 board/qemu/x86/linux-3.12-selinux.config           |   72 +
 configs/qemu_x86_selinux_defconfig                 |   27 +
 package/Config.in                                  |   15 +
 package/Config.in.host                             |    1 +
 package/audit/Config.in                            |   24 +
 package/audit/S01auditd                            |  172 +++
 ...it-0001-cross-compile-header-creation-fix.patch | 1424 ++++++++++++++++++++
 package/audit/audit-0002-remove-zos-plugin.patch   |   35 +
 package/audit/audit.mk                             |   61 +
 ...ags-strip-non-l-arguments-returned-by-pkg.patch |   28 +
 package/busybox/Config.in                          |    6 +
 package/busybox/busybox.mk                         |   33 +
 package/bzip2/bzip2.mk                             |    2 +
 package/checkpolicy/Config.in.host                 |   10 +
 package/checkpolicy/checkpolicy.mk                 |   26 +
 package/libselinux/Config.in                       |   29 +
 package/libselinux/libselinux.mk                   |   88 ++
 package/libsemanage/Config.in                      |   30 +
 .../libsemanage-0001-execption-lib-path-fix.patch  |   14 +
 package/libsemanage/libsemanage.mk                 |   72 +
 package/pcre/pcre.mk                               |    1 +
 package/policycoreutils/Config.in                  |   88 ++
 package/policycoreutils/S15restorecond             |   85 ++
 .../policycoreutils-0001-cross-compile-fixes.patch |  332 +++++
 package/policycoreutils/policycoreutils.mk         |  231 ++++
 package/python-pyparsing/python-pyparsing.mk       |   47 +-
 package/python-pyxml/Config.in                     |   11 +
 package/python-pyxml/python-xml.mk                 |   50 +
 package/refpolicy/Config.in                        |   74 +
 package/refpolicy/S12selinux                       |  137 ++
 package/refpolicy/config                           |    8 +
 package/refpolicy/modules.conf                     |  406 ++++++
 .../refpolicy-0001-gentoo-hardened-fixes.patch     | 1250 +++++++++++++++++
 package/refpolicy/refpolicy-0002-awk-fix.patch     |   37 +
 package/refpolicy/refpolicy.mk                     |   82 ++
 package/sepolgen/Config.in                         |   14 +
 package/sepolgen/sepolgen.mk                       |   31 +
 package/setools/Config.in                          |   33 +
 .../setools/setools-0001-cross-compile-fixes.patch |  121 ++
 .../setools-0002-swig-typedef-python-fixes.patch   | 1014 ++++++++++++++
 package/setools/setools.mk                         |   85 ++
 package/shadow/Config.in                           |   13 +
 package/shadow/shadow.mk                           |   50 +
 package/sqlite/sqlite.mk                           |    1 +
 package/ustr/Config.in                             |   11 +
 .../ustr-0001-cross-compile-modifications.patch    |  144 ++
 package/ustr/ustr.mk                               |   47 +
 47 files changed, 6559 insertions(+), 13 deletions(-)
 create mode 100644 board/qemu/x86/linux-3.12-selinux.config
 create mode 100644 configs/qemu_x86_selinux_defconfig
 create mode 100644 package/audit/Config.in
 create mode 100755 package/audit/S01auditd
 create mode 100644 package/audit/audit-0001-cross-compile-header-creation-fix.patch
 create mode 100644 package/audit/audit-0002-remove-zos-plugin.patch
 create mode 100644 package/audit/audit.mk
 create mode 100644 package/busybox/1.21.1/0004-Makefile.flags-strip-non-l-arguments-returned-by-pkg.patch
 create mode 100644 package/checkpolicy/Config.in.host
 create mode 100644 package/checkpolicy/checkpolicy.mk
 create mode 100644 package/libselinux/Config.in
 create mode 100644 package/libselinux/libselinux.mk
 create mode 100644 package/libsemanage/Config.in
 create mode 100644 package/libsemanage/libsemanage-0001-execption-lib-path-fix.patch
 create mode 100644 package/libsemanage/libsemanage.mk
 create mode 100644 package/policycoreutils/Config.in
 create mode 100755 package/policycoreutils/S15restorecond
 create mode 100644 package/policycoreutils/policycoreutils-0001-cross-compile-fixes.patch
 create mode 100644 package/policycoreutils/policycoreutils.mk
 create mode 100644 package/python-pyxml/Config.in
 create mode 100644 package/python-pyxml/python-xml.mk
 create mode 100644 package/refpolicy/Config.in
 create mode 100644 package/refpolicy/S12selinux
 create mode 100755 package/refpolicy/config
 create mode 100644 package/refpolicy/modules.conf
 create mode 100644 package/refpolicy/refpolicy-0001-gentoo-hardened-fixes.patch
 create mode 100644 package/refpolicy/refpolicy-0002-awk-fix.patch
 create mode 100644 package/refpolicy/refpolicy.mk
 create mode 100644 package/sepolgen/Config.in
 create mode 100644 package/sepolgen/sepolgen.mk
 create mode 100644 package/setools/Config.in
 create mode 100644 package/setools/setools-0001-cross-compile-fixes.patch
 create mode 100644 package/setools/setools-0002-swig-typedef-python-fixes.patch
 create mode 100644 package/setools/setools.mk
 create mode 100644 package/shadow/Config.in
 create mode 100644 package/shadow/shadow.mk
 create mode 100644 package/ustr/Config.in
 create mode 100644 package/ustr/ustr-0001-cross-compile-modifications.patch
 create mode 100644 package/ustr/ustr.mk
#1 lore raw

PATCH v4 1/20 pcre: Add host build support

---
Changes v3 -> v4:
- No changes.
Changes v2 -> v3:
- Changed order of patch to correct dependency issue (suggested by Thomas).
Changes v1 -> v2:
- No changes

---
 package/pcre/pcre.mk |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
package/pcre/pcre.mk +1 -0
index 2637354..000ce54 100644
@@ -23,3 +23,4 @@ PCRE_CONF_OPT += $(if $(BR2_PACKAGE_PCRE_UTF),--enable-utf,--disable-utf)
 PCRE_CONF_OPT += $(if $(BR2_PACKAGE_PCRE_UCP),--enable-unicode-properties,--disable-unicode-properties)
 
 $(eval $(autotools-package))
+$(eval $(host-autotools-package))
Signature · 1 line
1.7.1
#2 lore raw

PATCH v4 2/20 libselinux: new package

In reply to Clayton Shotwell

---
Changes v3 -> v4:
- Re-added the Python bindings configure option (suggested by Thomas).
- Added the creation of the selinux mount point to the install step (suggested by Thomas).
- Cleaned up configure comments (suggested by Thomas).
- Removed the package clean command.
Changes v2 -> v3:
- Added dependencies on BR2_TOOLCHAIN_HAS_THREADS and BR2_LARGEFILE (suggested by Thomas).
- Corrected a minor issue in the mk file found during testing.
Changes v1 -> v2:
- Move Config.in entry into the libraries section since this is a library.
- General cleanup to the mk file to conform to the standard format.
- Removed a dependency on the Linux kernel.
- Changed the original Python select in the Config.in to be a check in the libselinux.mk file.
- Added a select for libsepol and pcre in the menuconfig instead of just having package dependencies.
- Removed building the python bindings in the host configuration.

---
 package/Config.in                |    1 +
 package/libselinux/Config.in     |   29 ++++++++++++
 package/libselinux/libselinux.mk |   88 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 118 insertions(+), 0 deletions(-)
 create mode 100644 package/libselinux/Config.in
 create mode 100644 package/libselinux/libselinux.mk
package/Config.in +1 -0
index eb96aeb..bc4a0d4 100644
@@ -725,6 +725,7 @@ source "package/tzdata/Config.in"
 endmenu
 
 menu "Security"
+source "package/libselinux/Config.in"
 source "package/libsepol/Config.in"
 endmenu
 
package/libselinux/Config.in new file +29 -0
new file mode 100644
index 0000000..14182c3
@@ -0,0 +1,29 @@
+config BR2_PACKAGE_LIBSELINUX
+	bool "libselinux"
+	select BR2_PACKAGE_LIBSEPOL
+	select BR2_PACKAGE_PCRE
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_LARGEFILE
+	help
+	  libselinux is the runtime SELinux library that provides
+	  interfaces (e.g. library functions for the SELinux kernel
+	  APIs like getcon(), other support functions like
+	  getseuserbyname()) to SELinux-aware applications. libselinux
+	  may use the shared libsepol to manipulate the binary policy
+	  if necessary (e.g. to downgrade the policy format to an
+	  older version supported by the kernel) when loading policy.
+
+	  http://selinuxproject.org/page/Main_Page
+
+comment "libselinux needs a toolchain w/ largefile, threads"
+        depends on !BR2_TOOLCHAIN_HAS_THREADS || !BR2_LARGEFILE
+
+if BR2_PACKAGE_LIBSELINUX
+
+config BR2_PACKAGE_LIBSELINUX_PYTHON_BINDINGS
+	select BR2_PACKAGE_PYTHON
+	bool "python bindings"
+	help
+	  enable building python bindings
+
+endif
package/libselinux/libselinux.mk new file +88 -0

88 lines not on this page · raw message

Signature · 1 line
1.7.1
#3 lore raw

PATCH v4 3/20 ustr: new package

In reply to Clayton Shotwell

---
Changes v3 -> v4:
- Removed the clean command.
Changes v2 -> v3:
- Changes patch naming convention (suggested by Thomas).
- Added a dependency on BR2_LARGEFILE (suggested by Thomas).
Changes v1 -> v2:
- General cleanup to the mk file to conform to the standard format.
- Fixed the patch naming to avoid using the version number.
- Cleaned up the patch to include a signed-off-by line.
- Added a check to only build static libraries if selected.

---
 package/Config.in                                  |    1 +
 package/ustr/Config.in                             |   11 ++
 .../ustr-0001-cross-compile-modifications.patch    |  144 ++++++++++++++++++++
 package/ustr/ustr.mk                               |   47 +++++++
 4 files changed, 203 insertions(+), 0 deletions(-)
 create mode 100644 package/ustr/Config.in
 create mode 100644 package/ustr/ustr-0001-cross-compile-modifications.patch
 create mode 100644 package/ustr/ustr.mk
package/Config.in +1 -0
index bc4a0d4..11cfcab 100644
@@ -742,6 +742,7 @@ source "package/pcre/Config.in"
 source "package/popt/Config.in"
 source "package/readline/Config.in"
 source "package/slang/Config.in"
+source "package/ustr/Config.in"
 endmenu
 
 endmenu
package/ustr/Config.in new file +11 -0
new file mode 100644
index 0000000..0aa2251
@@ -0,0 +1,11 @@
+config BR2_PACKAGE_USTR
+	bool "ustr"
+	depends on BR2_LARGEFILE
+	help
+	  A small, safe string library.
+	  
+	  http://www.and.org/ustr/
+
+comment "ustr requires a toolchain with large file support"
+	depends on !BR2_LARGEFILE
+
package/ustr/ustr-0001-cross-compile-modifications.patch new file +144 -0

144 lines not on this page · raw message

package/ustr/ustr.mk new file +47 -0

47 lines not on this page · raw message

Signature · 1 line
1.7.1
#4 lore raw

PATCH v4 4/20 bzip2: Add host build shared library installation

In reply to Clayton Shotwell

---
Changes v3 -> v4:
- No changes.
Changes v2 -> v3:
- Changed order of patch to correct dependency issue (suggested by Thomas).
Changes v1 -> v2:
- No changes

---
 package/bzip2/bzip2.mk |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
package/bzip2/bzip2.mk +2 -0
index fcddb55..a06e980 100644
@@ -61,6 +61,8 @@ endef
 define HOST_BZIP2_INSTALL_CMDS
 	$(HOST_MAKE_ENV) \
 		$(MAKE) PREFIX=$(HOST_DIR)/usr -C $(@D) install
+	$(HOST_MAKE_ENV) $(MAKE) \
+		-f Makefile-libbz2_so PREFIX=$(HOST_DIR)/usr -C $(@D) install
 endef
 
 $(eval $(generic-package))
Signature · 1 line
1.7.1
#5 lore raw

PATCH v4 5/20 libsemanage: new package

In reply to Clayton Shotwell

---
Changes v3 -> v4:
- Added back in the Python bindings creation configure option (suggested by Thomas).
- Added a dependency on host-flex (suggeste by Thomas).
- Cleaned up configure comments (suggested by Thomas).
- Removed the clean command.
Changes v2 -> v3:
- Changes patch naming convention (suggested by Thomas).
- Added dependencies on BR2_TOOLCHAIN_HAS_THREADS and BR2_LARGEFILE (suggested by Thomas).
Changes v1 -> v2:
- Move Config.in entry into the libraries section since this is a library.
- General cleanup to the mk file to conform to the standard format.
- Fixed the patch naming to avoid using the version number.
- Cleaned up the patch to include a signed-off-by line.
- Changed package dependencies into selects in the config.
- Changed the original Python select in the Config.in to be a check in the mk file.
- Removed building the python bindings in the host configuration.

---
 package/Config.in                                  |    1 +
 package/libsemanage/Config.in                      |   30 ++++++++
 .../libsemanage-0001-execption-lib-path-fix.patch  |   14 ++++
 package/libsemanage/libsemanage.mk                 |   72 ++++++++++++++++++++
 4 files changed, 117 insertions(+), 0 deletions(-)
 create mode 100644 package/libsemanage/Config.in
 create mode 100644 package/libsemanage/libsemanage-0001-execption-lib-path-fix.patch
 create mode 100644 package/libsemanage/libsemanage.mk
package/Config.in +1 -0
index 11cfcab..8f2d3c1 100644
@@ -726,6 +726,7 @@ endmenu
 
 menu "Security"
 source "package/libselinux/Config.in"
+source "package/libsemanage/Config.in"
 source "package/libsepol/Config.in"
 endmenu
 
package/libsemanage/Config.in new file +30 -0
new file mode 100644
index 0000000..e4013cd
@@ -0,0 +1,30 @@
+config BR2_PACKAGE_LIBSEMANAGE
+	bool "libsemanage"
+	select BR2_PACKAGE_LIBSELINUX
+	select BR2_PACKAGE_USTR
+	select BR2_PACKAGE_BZIP2
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_LARGEFILE
+	help
+	  libsemanage is the policy management library. It uses
+	  libsepol for binary policy manipulation and libselinux for
+	  interacting with the SELinux system. It also exec's helper
+	  programs for loading policy and for checking whether the
+	  file_contexts configuration is valid (load_policy and
+	  setfiles from policycoreutils) presently, although this may
+	  change at least for the bootstrapping case (for rpm).
+
+	  http://selinuxproject.org/page/Main_Page
+
+comment "libsemanage needs a toolchain w/ largefile, threads"
+	depends on !BR2_TOOLCHAIN_HAS_THREADS || !BR2_LARGEFILE
+
+if BR2_PACKAGE_LIBSEMANAGE
+
+config BR2_PACKAGE_LIBSEMANAGE_PYTHON_BINDINGS
+	select BR2_PACKAGE_PYTHON
+	bool "python bindings"
+	help
+	  enable building python bindings
+
+endif
package/libsemanage/libsemanage-0001-execption-lib-path-fix.patch new file +14 -0
new file mode 100644
index 0000000..cbcbea5
@@ -0,0 +1,14 @@
+Patch to correct a missing header file issue.
+
+Signed-off-by Clayton Shotwell <[email protected]>
+
+--- a/src/exception.sh	2011-12-21 11:46:04.000000000 -0600
++++ b/src/exception.sh	2012-08-27 11:29:58.000000000 -0500
+@@ -9,6 +9,6 @@
+ }
+ "
+ }
+-gcc -x c -c - -aux-info temp.aux < ../include/semanage/semanage.h
++gcc -x c -c - -aux-info temp.aux -I../include < ../include/semanage/semanage.h
+ for i in `awk '/extern int/ { print $6 }' temp.aux`; do except $i ; done
+ rm -f -- temp.aux -.o
package/libsemanage/libsemanage.mk new file +72 -0

72 lines not on this page · raw message

Signature · 1 line
1.7.1
#6 lore raw

PATCH v4 6/20 checkpolicy: new package

In reply to Clayton Shotwell

---
Changes v3 -> v4:
- Removed the clean command.
Changes v2 -> v3:
- Added checkpolicy as a host package (suggested by Arnout).
Changes v1 -> v2:
- General cleanup to the mk file to conform to the standard format.
- Removed the option to do a target build because it should never be needed during normal operation.
- Added checkpolicy as a host package (suggested by Arnout).

---
 package/Config.in.host             |    1 +
 package/checkpolicy/Config.in.host |   10 ++++++++++
 package/checkpolicy/checkpolicy.mk |   26 ++++++++++++++++++++++++++
 3 files changed, 37 insertions(+), 0 deletions(-)
 create mode 100644 package/checkpolicy/Config.in.host
 create mode 100644 package/checkpolicy/checkpolicy.mk
package/Config.in.host +1 -0
index 5fd2570..1b3e11b 100644
@@ -1,5 +1,6 @@
 menu "Host utilities"
 
+source "package/checkpolicy/Config.in.host"
 source "package/dfu-util/Config.in.host"
 source "package/dosfstools/Config.in.host"
 source "package/e2fsprogs/Config.in.host"
package/checkpolicy/Config.in.host new file +10 -0
new file mode 100644
index 0000000..75794be
@@ -0,0 +1,10 @@
+config BR2_PACKAGE_HOST_CHECKPOLICY
+	bool "host checkpolicy"
+	help
+	  checkpolicy is the policy compiler. It uses libsepol to 
+	  generate the binary policy. checkpolicy uses the static 
+	  libsepol since it deals with low level details of the policy 
+	  that have not been encapsulated/abstracted by a proper 
+	  shared library interface. 
+	  
+	  http://selinuxproject.org/page/Main_Page
package/checkpolicy/checkpolicy.mk new file +26 -0
new file mode 100644
index 0000000..0d91794
@@ -0,0 +1,26 @@
+################################################################################
+#
+# checkpolicy
+#
+################################################################################
+
+CHECKPOLICY_VERSION = 2.1.12
+CHECKPOLICY_SITE = http://userspace.selinuxproject.org/releases/20130423/
+CHECKPOLICY_LICENSE = GPLv2
+CHECKPOLICY_LICENSE_FILES = COPYING
+
+HOST_CHECKPOLICY_DEPENDENCIES = host-libselinux host-flex host-bison
+
+HOST_CHECKPOLICY_MAKE_OPTS = $(HOST_CONFIGURE_OPTS) \
+	LEX="$(HOST_DIR)/usr/bin/flex" \
+	YACC="$(HOST_DIR)/usr/bin/bison -y"
+
+define HOST_CHECKPOLICY_BUILD_CMDS
+	$(MAKE) -C $(@D) $(HOST_CHECKPOLICY_MAKE_OPTS) DESTDIR=$(HOST_DIR)
+endef
+
+define HOST_CHECKPOLICY_INSTALL_CMDS
+	$(MAKE) -C $(@D) install $(HOST_CHECKPOLICY_MAKE_OPTS) DESTDIR=$(HOST_DIR)
+endef
+
+$(eval $(host-generic-package))
Signature · 1 line
1.7.1
#7 lore raw

PATCH v4 7/20 sepolgen: new package

In reply to Clayton Shotwell

---
Changes v3 -> v4:
- Cleaned up configure comments (suggested by Thomas).
- Removed the clean command.
Changes v2 -> v3:
- No changes.
Changes v1 -> v2:
- General cleanup to the mk file to conform to the standard format.
- Changed package dependencies into selects in the config.

---
 package/Config.in            |    4 ++++
 package/sepolgen/Config.in   |   14 ++++++++++++++
 package/sepolgen/sepolgen.mk |   31 +++++++++++++++++++++++++++++++
 3 files changed, 49 insertions(+), 0 deletions(-)
 create mode 100644 package/sepolgen/Config.in
 create mode 100644 package/sepolgen/sepolgen.mk
package/Config.in +4 -0
index 8f2d3c1..fb336eb 100644
@@ -937,6 +937,10 @@ source "package/rtai/Config.in"
 source "package/xenomai/Config.in"
 endmenu
 
+menu "Security"
+source "package/sepolgen/Config.in"
+endmenu
+
 menu "Shell and utilities"
 source "package/at/Config.in"
 if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
package/sepolgen/Config.in new file +14 -0
new file mode 100644
index 0000000..d7d0d37
@@ -0,0 +1,14 @@
+config BR2_PACKAGE_SEPOLGEN
+	bool "sepolgen"
+	select BR2_PACKAGE_PYTHON
+	depends on BR2_USE_WCHAR # python
+	depends on BR2_USE_MMU # python
+	help
+	  sepolgen is a python module/library that forms the core
+	  of the modern audit2allow (a rewrite).
+
+	  http://selinuxproject.org/page/Main_Page
+
+comment "sepolgen needs a toolchain w/ wchar"
+	depends on BR2_USE_MMU
+	depends on !BR2_USE_WCHAR
package/sepolgen/sepolgen.mk new file +31 -0
new file mode 100644
index 0000000..099c9d0
@@ -0,0 +1,31 @@
+################################################################################
+#
+# sepolgen
+#
+################################################################################
+
+SEPOLGEN_VERSION = 1.1.9
+SEPOLGEN_SITE = http://userspace.selinuxproject.org/releases/20130423/
+SEPOLGEN_LICENSE = GPLv2
+SEPOLGEN_LICENSE_FILES = COPYING
+
+SEPOLGEN_DEPENDENCIES = python
+
+SEPOLGEN_INSTALL_STAGING = YES
+
+SEPOLGEN_MAKE_CMDS = $(TARGET_CONFIGURE_OPTS) \
+	PYTHONLIBDIR=/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages
+
+define SEPOLGEN_BUILD_CMDS
+	$(MAKE) -C $(@D) $(SEPOLGEN_MAKE_CMDS) DESTDIR=$(STAGING_DIR)
+endef
+
+define SEPOLGEN_INSTALL_STAGING_CMDS
+	$(MAKE) -C $(@D) install $(SEPOLGEN_MAKE_CMDS) DESTDIR=$(STAGING_DIR)
+endef
+
+define SEPOLGEN_INSTALL_TARGET_CMDS
+	$(MAKE) -C $(@D) install $(SEPOLGEN_MAKE_CMDS) DESTDIR=$(TARGET_DIR)
+endef
+
+$(eval $(generic-package))
Signature · 1 line
1.7.1
#8 lore raw

PATCH v4 8/20 sqlite: Add host build support

In reply to Clayton Shotwell

---
Changes v3 -> v4:
- No changes.
Changes v2 -> v3:
- Changed order of patch to correct dependency issue (suggested by Thomas).
Changes v1 -> v2:
- No changes

---
 package/sqlite/sqlite.mk |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
package/sqlite/sqlite.mk +1 -0
index b27eb58..f4905e5 100644
@@ -60,3 +60,4 @@ SQLITE_CONF_OPT += --disable-readline
 endif
 
 $(eval $(autotools-package))
+$(eval $(host-autotools-package))
Signature · 1 line
1.7.1
#9 lore raw

PATCH v4 9/20 setools: new package

In reply to Clayton Shotwell

---
Changes v3 -> v4:
- Added back in the Python bindings configure option instead of relying on the Python package check (suggested by Thomas).
- Revised the configure comments (suggested by Thomas).
Changes v2 -> v3:
- Changes patch naming convention (suggested by Thomas).
- Added dependencies on BR2_TOOLCHAIN_HAS_THREADS and BR2_LARGEFILE (suggested by Thomas).
Changes v1 -> v2:
- General cleanup to the mk file to conform to the standard format.
- Cleaned up the patch to include a signed-off-by line.
- Changed package dependencies into selects in the config.
- Changed the original Python select in the Config.in to be a check in the mk file.

---
 package/Config.in                                  |    1 +
 package/setools/Config.in                          |   33 +
 .../setools/setools-0001-cross-compile-fixes.patch |  121 +++
 .../setools-0002-swig-typedef-python-fixes.patch   | 1014 ++++++++++++++++++++
 package/setools/setools.mk                         |   85 ++
 5 files changed, 1254 insertions(+), 0 deletions(-)
 create mode 100644 package/setools/Config.in
 create mode 100644 package/setools/setools-0001-cross-compile-fixes.patch
 create mode 100644 package/setools/setools-0002-swig-typedef-python-fixes.patch
 create mode 100644 package/setools/setools.mk
package/Config.in +1 -0
index fb336eb..b62f123 100644
@@ -939,6 +939,7 @@ endmenu
 
 menu "Security"
 source "package/sepolgen/Config.in"
+source "package/setools/Config.in"
 endmenu
 
 menu "Shell and utilities"
package/setools/Config.in new file +33 -0
new file mode 100644
index 0000000..3344ed3
@@ -0,0 +1,33 @@
+config BR2_PACKAGE_SETOOLS
+	bool "setools"
+	select BR2_PACKAGE_LIBSELINUX
+	select BR2_PACKAGE_SQLITE
+	select BR2_PACKAGE_LIBXML2
+	select BR2_PACKAGE_BZIP2
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_LARGEFILE
+	help
+	  SETools is an open source project designed to facilitate
+	  SELinux policy analysis. The primary tools are:
+	   * apol - analyze a SELinux policy.
+	   * seaudit - analyze audit messages from SELinux.
+	   * seaudit-report - generate highly-customized audit log
+	     reports.
+	   * sechecker - command line tool for performing modular
+	     checks on an SELinux policy.
+	   * sediff - semantic policy difference tool for SELinux.
+	   * secmds - command-line tools to analyze and search SELinux
+             policy.
+
+comment "setools needs a toolchain w/ largefile, threads"
+	depends on !BR2_TOOLCHAIN_HAS_THREADS || !BR2_LARGEFILE
+
+if BR2_PACKAGE_SETOOLS
+
+config BR2_PACKAGE_SETOOLS_PYTHON_BINDINGS
+	bool "python bindings"
+	select BR2_PACKAGE_PYTHON
+	help
+	  enable building python bindings
+
+endif
package/setools/setools-0001-cross-compile-fixes.patch new file +121 -0

121 lines not on this page · raw message

package/setools/setools-0002-swig-typedef-python-fixes.patch new file +1014 -0

1,014 lines not on this page · raw message

package/setools/setools.mk new file +85 -0

85 lines not on this page · raw message

Signature · 1 line
1.7.1
#10 lore raw

PATCH v4 10/20 python-pyparsing: Add host build option

In reply to Clayton Shotwell

---
This package will most likely change based on Thomas P. proposed python package infrastructure. It will become just:

$(eval $(host-python-package))

Changes v3 -> v4:
- No changes.
Changes v2 -> v3:
- Changed order of patch to correct dependency issue (suggested by Thomas).
Changes v1 -> v2:
- No changes.

---
 package/python-pyparsing/python-pyparsing.mk |   47 ++++++++++++++++++-------
 1 files changed, 34 insertions(+), 13 deletions(-)
package/python-pyparsing/python-pyparsing.mk +34 -13
index 7814ce3..b6ba40d 100644
@@ -14,25 +14,46 @@ PYTHON_PYPARSING_DEPENDENCIES    = python
 
 # Shamelessly vampirised from python-pygame ;-)
 define PYTHON_PYPARSING_BUILD_CMDS
-	(cd $(@D);                                              \
-	 CC="$(TARGET_CC)"                                      \
-	 CFLAGS="$(TARGET_CFLAGS)"                              \
-	 LDSHARED="$(TARGET_CROSS)gcc -shared"                  \
-	 CROSS_COMPILING=yes                                    \
-	 _python_sysroot=$(STAGING_DIR)                         \
-	 _python_srcdir=$(BUILD_DIR)/python$(PYTHON_VERSION)    \
-	 _python_prefix=/usr                                    \
-	 _python_exec_prefix=/usr                               \
-	 $(HOST_DIR)/usr/bin/python setup.py build              \
+	(cd $(@D); \
+		CC="$(TARGET_CC)" \
+		CFLAGS="$(TARGET_CFLAGS)" \
+		LDSHARED="$(TARGET_CROSS)gcc -shared" \
+		CROSS_COMPILING=yes \
+		_python_sysroot=$(STAGING_DIR) \
+		_python_srcdir=$(BUILD_DIR)/python$(PYTHON_VERSION) \
+		_python_prefix=/usr \
+		_python_exec_prefix=/usr \
+		$(HOST_DIR)/usr/bin/python setup.py build \
 	)
 endef
 
 # Shamelessly vampirised from python-pygame ;-)
 define PYTHON_PYPARSING_INSTALL_TARGET_CMDS
-	(cd $(@D);                                              \
-	 $(HOST_DIR)/usr/bin/python setup.py install            \
-	                            --prefix=$(TARGET_DIR)/usr  \
+	(cd $(@D); \
+		$(HOST_DIR)/usr/bin/python setup.py install \
+		--prefix=$(TARGET_DIR)/usr \
+	)
+endef
+
+HOST_PYTHON_PYPARSING_DEPENDENCIES = host-python
+
+define HOST_PYTHON_PYPARSING_BUILD_CMDS
+	(cd $(@D); \
+		_python_sysroot=$(HOST_DIR) \
+		_python_srcdir=$(BUILD_DIR)/host-python$(PYTHON_VERSION) \
+		_python_prefix=/usr \
+		_python_exec_prefix=/usr \
+		$(HOST_DIR)/usr/bin/python setup.py build \
+	)
+endef
+
+define HOST_PYTHON_PYPARSING_INSTALL_CMDS
+	(cd $(@D); \
+		$(HOST_DIR)/usr/bin/python setup.py install \
+		--prefix=$(HOST_DIR)/usr \
 	)
 endef
 
 $(eval $(generic-package))
+$(eval $(host-generic-package))
+
Signature · 1 line
1.7.1
#11 lore raw

PATCH v4 11/20 audit: new package

In reply to Clayton Shotwell

---
Changes v3 -> v4:
- Added back in the Python bindings configure option instead of relying on a check to see if Python is enabled (suggested by Thomas).
- Cleaned up the startup script installation step (suggested by Thomas).
- Change the startup script order to launch the auditd first thing and also change the required shell to sh instead of bash.
- Adding a dependency on comment BR2_TOOLCHAIN_USES_GLIBC
Changes v2 -> v3:
- Changed order of patch to correct dependency issue (suggested by Thomas).
- Changes patch naming convention (suggested by Thomas).
- Added upstream submission link for patch (suggested by Thomas).
Changes v1 -> v2:
- General cleanup to the mk file to conform to the standard format.
- Fixed the patch naming to avoid using the version number.
- Cleaned up the patch to include a signed-off-by line.
- Changed the original Python select in the Config.in to be a check in the mk file.

---
 package/Config.in                                  |    1 +
 package/audit/Config.in                            |   24 +
 package/audit/S01auditd                            |  172 +++
 ...it-0001-cross-compile-header-creation-fix.patch | 1424 ++++++++++++++++++++
 package/audit/audit-0002-remove-zos-plugin.patch   |   35 +
 package/audit/audit.mk                             |   61 +
 6 files changed, 1717 insertions(+), 0 deletions(-)
 create mode 100644 package/audit/Config.in
 create mode 100755 package/audit/S01auditd
 create mode 100644 package/audit/audit-0001-cross-compile-header-creation-fix.patch
 create mode 100644 package/audit/audit-0002-remove-zos-plugin.patch
 create mode 100644 package/audit/audit.mk
package/Config.in +1 -0
index b62f123..48c66a6 100644
@@ -969,6 +969,7 @@ endmenu
 menu "System tools"
 source "package/acl/Config.in"
 source "package/attr/Config.in"
+source "package/audit/Config.in"
 if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
 source "package/bootutils/Config.in"
 source "package/coreutils/Config.in"
package/audit/Config.in new file +24 -0
new file mode 100644
index 0000000..91b985d
@@ -0,0 +1,24 @@
+config BR2_PACKAGE_AUDIT
+	bool "audit"
+	depends on BR2_TOOLCHAIN_USES_GLIBC
+	help
+	  The audit package contains the user space utilities for
+	  storing and searching the audit records generate by
+	  the audit subsystem in the Linux 2.6 kernel
+	  
+	  Note: The z/OS remote plugin is disabled in this package
+	  
+	  http://people.redhat.com/sgrubb/audit/
+
+comment "audit needs an (e)glibc toolchain"
+        depends on !BR2_TOOLCHAIN_USES_GLIBC
+
+if BR2_PACKAGE_AUDIT
+
+config BR2_PACKAGE_AUDIT_PYTHON_BINDINGS
+	select BR2_PACKAGE_PYTHON
+	bool "python bindings"
+	help
+	  enable building python bindings
+
+endif
package/audit/S01auditd new file +172 -0

172 lines not on this page · raw message

package/audit/audit-0001-cross-compile-header-creation-fix.patch new file +1424 -0

1,424 lines not on this page · raw message

package/audit/audit-0002-remove-zos-plugin.patch new file +35 -0
new file mode 100644
index 0000000..576d8fa
@@ -0,0 +1,35 @@
+Removed the step to build the zos-remote.
+
+Signed-off-by Clayton Shotwell <[email protected]>
+---
+--- a/audisp/plugins/Makefile.am	2012-08-28 10:33:03.582396601 -0500
++++ b/audisp/plugins/Makefile.am	2012-08-28 10:33:14.162399662 -0500
+@@ -22,7 +22,7 @@
+ 
+ CONFIG_CLEAN_FILES = *.loT *.rej *.orig
+ 
+-SUBDIRS = builtins zos-remote remote
++SUBDIRS = builtins remote
+ #SUBDIRS = builtins zos-remote
+ if HAVE_PRELUDE
+ SUBDIRS += prelude
+--- a/audisp/plugins/Makefile.in	2012-08-28 10:33:03.592380390 -0500
++++ b/audisp/plugins/Makefile.in	2012-08-28 10:35:38.482397668 -0500
+@@ -84,7 +84,7 @@
+ 	distdir
+ ETAGS = etags
+ CTAGS = ctags
+-DIST_SUBDIRS = builtins zos-remote remote prelude
++DIST_SUBDIRS = builtins remote prelude
+ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ am__relativize = \
+   dir0=`pwd`; \
+@@ -242,7 +242,7 @@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ CONFIG_CLEAN_FILES = *.loT *.rej *.orig
+-SUBDIRS = builtins zos-remote remote $(am__append_1)
++SUBDIRS = builtins remote $(am__append_1)
+ all: all-recursive
+ 
+ .SUFFIXES:
package/audit/audit.mk new file +61 -0

61 lines not on this page · raw message

Signature · 1 line
1.7.1
#12 lore raw

PATCH v4 12/20 policycoreutils: new package

In reply to Clayton Shotwell

---
Changes v3 -> v4:
- Add a select for the libselinux Python bindings when debugging is enabled. This will cause Python to be built for the target (suggested by Thomas).
- Cleaned up the configure comments (suggested by Thomas).
- Added a dependency on BR2_USE_MMU for the debugging option because python requires it (suggested by Thomas).
- Removed the dependencies on audit and linux-pam. Both packages are now optional dependencies based on whether or not the package has been selected.
- Moved the dependency on dbus-glib to only the restorecond option where it is used.
- Added a INSTALL_INIT_SYSV for the restorecond daemon rather than just installing it directly
- Adding a dependency on glibc
- Removed the clean commands.
Changes v2 -> v3:
- Added dependencies on BR2_TOOLCHAIN_HAS_THREADS and BR2_LARGEFILE (suggested by Thomas).
- Changes patch naming convention (suggested by Thomas).
- Added selects for linux-pam and audit.
Changes v1 -> v2:
- General cleanup to the mk file to conform to the standard format.
- Fixed the patch naming to avoid using the version number.
- Cleaned up the patch to include a signed-off-by line.
- Changed package dependencies into selects in the config.

---
 package/Config.in                                  |    1 +
 package/policycoreutils/Config.in                  |   88 +++++
 package/policycoreutils/S15restorecond             |   85 +++++
 .../policycoreutils-0001-cross-compile-fixes.patch |  332 ++++++++++++++++++++
 package/policycoreutils/policycoreutils.mk         |  231 ++++++++++++++
 5 files changed, 737 insertions(+), 0 deletions(-)
 create mode 100644 package/policycoreutils/Config.in
 create mode 100755 package/policycoreutils/S15restorecond
 create mode 100644 package/policycoreutils/policycoreutils-0001-cross-compile-fixes.patch
 create mode 100644 package/policycoreutils/policycoreutils.mk
package/Config.in +1 -0
index 48c66a6..d69d106 100644
@@ -938,6 +938,7 @@ source "package/xenomai/Config.in"
 endmenu
 
 menu "Security"
+source "package/policycoreutils/Config.in"
 source "package/sepolgen/Config.in"
 source "package/setools/Config.in"
 endmenu
package/policycoreutils/Config.in new file +88 -0

88 lines not on this page · raw message

package/policycoreutils/S15restorecond new file +85 -0

85 lines not on this page · raw message

package/policycoreutils/policycoreutils-0001-cross-compile-fixes.patch new file +332 -0

332 lines not on this page · raw message

package/policycoreutils/policycoreutils.mk new file +231 -0

231 lines not on this page · raw message

Signature · 1 line
1.7.1
#13 lore raw

PATCH v4 13/20 python-pyxml: new package

In reply to Clayton Shotwell

---

This package will also have to change with the new Python infrastructure proposed by Thomas P.

Changes v3 -> v4:
- Correcting the download path (suggested by Thomas).
- Removed the clean commands.
Changes v2 -> v3:
- No changes.
Changes v1 -> v2:
- General cleanup to the mk file to conform to the standard format.

---
 package/Config.in                  |    1 +
 package/python-pyxml/Config.in     |   11 ++++++++
 package/python-pyxml/python-xml.mk |   50 ++++++++++++++++++++++++++++++++++++
 3 files changed, 62 insertions(+), 0 deletions(-)
 create mode 100644 package/python-pyxml/Config.in
 create mode 100644 package/python-pyxml/python-xml.mk
package/Config.in +1 -0
index d69d106..8adf9ec 100644
@@ -399,6 +399,7 @@ source "package/python-protobuf/Config.in"
 source "package/python-pygame/Config.in"
 source "package/python-pyparsing/Config.in"
 source "package/python-pyro/Config.in"
+source "package/python-pyxml/Config.in"
 source "package/python-pyzmq/Config.in"
 source "package/python-serial/Config.in"
 source "package/python-setuptools/Config.in"
package/python-pyxml/Config.in new file +11 -0
new file mode 100644
index 0000000..420f3ad
@@ -0,0 +1,11 @@
+config BR2_PACKAGE_PYTHON_PYXML
+	bool "python-pyxml"
+	depends on BR2_PACKAGE_PYTHON
+	help
+	  This is the Python XML package.  The distribution contains a
+	  validating XML parser, an implementation of the SAX and DOM
+	  programming interfaces, an interface to the Expat parser (and the
+	  Expat parser itself), and a C helper module that can speed up
+	  xmllib.py by a factor of 5.  There's even documentation!
+
+	  http://pyxml.sourceforge.net/topics/index.html
package/python-pyxml/python-xml.mk new file +50 -0

50 lines not on this page · raw message

Signature · 1 line
1.7.1
#14 lore raw

PATCH v4 14/20 refpolicy: new package

In reply to Clayton Shotwell

---
Changes v3 -> v4:
- Added a dependency on host-gawk and correct the awk calls

    in the makefile to use $(AWK)

- Changed the default policy name to br_policy to differentiate the policy generated from refpolicy.
- Added a install step to create a /.autorelabel file to cause the file system to be relabeled by S12SELinux init script.
- Adding a default modules.conf file with an option to specify a different one. This will decrease the build time for refpolicy by removing unused policies. (implemented by Thomas).
- Cleaned up the configure comments (implemented by Thomas).
- Added a check to only install the documentation if the Buildroot option is enabled.
- Removed the build because the install step completes the same process. Also removed the clean step because it is being removed globally from buildroot (implemented by Thomas).
- Added more error handling to the startup script to print a warning if SELinux fails to install the policy if it exists. This can be caused by the kernel not being configured with SELinux enabled.
Changes v2 -> v3:
- Changes patch naming convention (suggested by Thomas).
- Added dependencies on BR2_TOOLCHAIN_HAS_THREADS and BR2_LARGEFILE (suggested by Thomas).
- Removed configure option for a specific patch folder (suggested by Thomas).
- Removed distribution configuration option (suggested by Thomas).
- Changed the monolithic configuration option to a modular configuration option (suggested by Thomas).
- Removed the refpolicy name option (suggested by Thomas).
- Corrected gramatical and comment errors (suggested by Thomas).
- Multiple style corrections to the mk file (suggested by Thomas).
- Added a comment to clairfy the usage of the the host build options for a target build.
Changes v1 -> v2:
- General cleanup to the mk file to conform to the standard format.
- Fixed the patch naming to match the standard 4 digit numbering.
- Changed package dependencies into selects in the config.

---
 package/Config.in                                  |    1 +
 package/refpolicy/Config.in                        |   72 ++
 package/refpolicy/S12selinux                       |  137 +++
 package/refpolicy/config                           |    8 +
 package/refpolicy/modules.conf                     |  406 +++++++
 .../refpolicy-0001-gentoo-hardened-fixes.patch     | 1250 ++++++++++++++++++++
 package/refpolicy/refpolicy-0002-awk-fix.patch     |   37 +
 package/refpolicy/refpolicy.mk                     |   82 ++
 8 files changed, 1993 insertions(+), 0 deletions(-)
 create mode 100644 package/refpolicy/Config.in
 create mode 100644 package/refpolicy/S12selinux
 create mode 100755 package/refpolicy/config
 create mode 100644 package/refpolicy/modules.conf
 create mode 100644 package/refpolicy/refpolicy-0001-gentoo-hardened-fixes.patch
 create mode 100644 package/refpolicy/refpolicy-0002-awk-fix.patch
 create mode 100644 package/refpolicy/refpolicy.mk
package/Config.in +1 -0
index 8adf9ec..343927d 100644
@@ -940,6 +940,7 @@ endmenu
 
 menu "Security"
 source "package/policycoreutils/Config.in"
+source "package/refpolicy/Config.in"
 source "package/sepolgen/Config.in"
 source "package/setools/Config.in"
 endmenu
package/refpolicy/Config.in new file +72 -0

72 lines not on this page · raw message

package/refpolicy/S12selinux new file +137 -0

137 lines not on this page · raw message

package/refpolicy/config new file +8 -0
new file mode 100755
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 +406 -0

406 lines not on this page · raw message

package/refpolicy/refpolicy-0001-gentoo-hardened-fixes.patch new file +1250 -0

1,250 lines not on this page · raw message

package/refpolicy/refpolicy-0002-awk-fix.patch new file +37 -0
new file mode 100644
index 0000000..cc742a5
@@ -0,0 +1,37 @@
+Use AWK variable instead of the hardcoded awk
+
+The refpolicy build system uses some awk expressions that need GNU
+awk, and not some other version of awk. Unfortunately, while the
+Makefile nicely defines a AWK variable pointing to gawk by default,
+there are several places where it hardcodes the usage of 'awk' without
+the variable. This patch fixes those instances by using the AWK
+vairable everywhere.
+
+Signed-off-by: Thomas Petazzoni <[email protected]>
+
+Index: refpolicy-2.20130424/Makefile
+===================================================================
+--- refpolicy-2.20130424.orig/Makefile	2013-02-25 16:29:33.000000000 +0100
++++ refpolicy-2.20130424/Makefile	2013-11-24 22:29:19.000000000 +0100
+@@ -292,9 +292,9 @@
+ cmdline_off := $(addsuffix .te,$(APPS_OFF))
+ 
+ # extract settings from modules.conf
+-mod_conf_base := $(addsuffix .te,$(sort $(shell awk '/^[[:blank:]]*[[:alpha:]]/{ if ($$3 == "$(configbase)") print $$1 }' $(mod_conf) 2> /dev/null)))
+-mod_conf_mods := $(addsuffix .te,$(sort $(shell awk '/^[[:blank:]]*[[:alpha:]]/{ if ($$3 == "$(configmod)") print $$1 }' $(mod_conf) 2> /dev/null)))
+-mod_conf_off := $(addsuffix .te,$(sort $(shell awk '/^[[:blank:]]*[[:alpha:]]/{ if ($$3 == "$(configoff)") print $$1 }' $(mod_conf) 2> /dev/null)))
++mod_conf_base := $(addsuffix .te,$(sort $(shell $(AWK) '/^[[:blank:]]*[[:alpha:]]/{ if ($$3 == "$(configbase)") print $$1 }' $(mod_conf) 2> /dev/null)))
++mod_conf_mods := $(addsuffix .te,$(sort $(shell $(AWK) '/^[[:blank:]]*[[:alpha:]]/{ if ($$3 == "$(configmod)") print $$1 }' $(mod_conf) 2> /dev/null)))
++mod_conf_off := $(addsuffix .te,$(sort $(shell $(AWK) '/^[[:blank:]]*[[:alpha:]]/{ if ($$3 == "$(configoff)") print $$1 }' $(mod_conf) 2> /dev/null)))
+ 
+ base_mods := $(cmdline_base)
+ mod_mods := $(cmdline_mods)
+@@ -308,7 +308,7 @@
+ off_mods += $(filter-out $(base_mods) $(mod_mods) $(off_mods),$(notdir $(detected_mods)))
+ 
+ # filesystems to be used in labeling targets
+-filesystems = $(shell mount | grep -v "context=" | egrep -v '\((|.*,)bind(,.*|)\)' | awk '/(ext[234]|btrfs| xfs| jfs).*rw/{print $$3}';)
++filesystems = $(shell mount | grep -v "context=" | egrep -v '\((|.*,)bind(,.*|)\)' | $(AWK) '/(ext[234]|btrfs| xfs| jfs).*rw/{print $$3}';)
+ fs_names := "btrfs ext2 ext3 ext4 xfs jfs"
+ 
+ ########################################
package/refpolicy/refpolicy.mk new file +82 -0

82 lines not on this page · raw message

Signature · 1 line
1.7.1
#15 lore raw

PATCH v4 15/20 shadow: new package

In reply to Clayton Shotwell

---
Changes v3 -> v4:
- Added back in the Python bindings configure option (suggested by Thomas).
- Moved the linux-pam shadow configuration changes inside the linux-pam if block (suggested by Ryan).
Changes v2 -> v3:
- Corrected spelling error.
Changes v1 -> v2:
- General cleanup to the mk file to conform to the standard format.

---
 package/Config.in          |    3 ++
 package/setools/setools.mk |    2 +-
 package/shadow/Config.in   |   13 +++++++++++
 package/shadow/shadow.mk   |   50 ++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 67 insertions(+), 1 deletions(-)
 create mode 100644 package/shadow/Config.in
 create mode 100644 package/shadow/shadow.mk
package/Config.in +3 -0
index 343927d..d4442db 100644
@@ -961,6 +961,9 @@ source "package/lockfile-progs/Config.in"
 source "package/logrotate/Config.in"
 source "package/logsurfer/Config.in"
 source "package/screen/Config.in"
+if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
+source "package/shadow/Config.in"
+endif
 source "package/sudo/Config.in"
 if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
 source "package/time/Config.in"
package/setools/setools.mk +1 -1
index eb3f4cc..c99cdeb 100644
@@ -63,7 +63,7 @@ HOST_SETOOLS_CONF_OPT = \
 	--with-sepol-devel="$(HOST_DIR)/usr" \
 	--with-selinux-devel="$(HOST_DIR)/usr" \
 
-ifeq ($(BR2_PACKAGE_PYTHON),y)
+ifeq ($(BR2_PACKAGE_SETOOLS_PYTHON_BINDINGS),y)
 	HOST_SETOOLS_DEPENDENCIES += host-python host-swig 
 	HOST_SETOOLS_CONF_ENV += \
 		am_cv_pathless_PYTHON=python \
package/shadow/Config.in new file +13 -0
new file mode 100644
index 0000000..5692ac6
@@ -0,0 +1,13 @@
+config BR2_PACKAGE_SHADOW
+	bool "shadow"
+	help
+	  The shadow-utils package includes the necessary programs for
+	  converting UNIX password files to the shadow password format, plus
+	  programs for managing user and group accounts. The pwconv command
+	  converts passwords to the shadow password format. The pwunconv command
+	  unconverts shadow passwords and generates an npasswd file (a standard
+	  UNIX password file). The pwck command checks the integrity of password
+	  and shadow files. The lastlog command prints out the last login times
+	  for all users. The useradd, userdel, and usermod commands are used for
+	  managing user accounts. The groupadd, groupdel, and groupmod commands
+	  are used for managing group accounts.
package/shadow/shadow.mk new file +50 -0

50 lines not on this page · raw message

Signature · 1 line
1.7.1
#16 lore raw

PATCH v4 16/20 busybox: add option to install individual binaries

In reply to Clayton Shotwell

From: Thomas Petazzoni <[email protected]>

---
 package/busybox/Config.in  |    3 +++
 package/busybox/busybox.mk |   24 ++++++++++++++++++++++++
 2 files changed, 27 insertions(+), 0 deletions(-)
package/busybox/Config.in +3 -0
index 2d55aa6..7f00fb8 100644
@@ -55,6 +55,9 @@ config BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
 	  Show packages in menuconfig that are potentially also provided
 	  by busybox.
 
+config BR2_PACKAGE_BUSYBOX_INDIVIDUAL_BINARIES
+	bool "Individual binaries"
+
 config BR2_PACKAGE_BUSYBOX_WATCHDOG
 	bool "Install the watchdog daemon startup script"
 	help
package/busybox/busybox.mk +24 -0
index f6f542e..13de7ed 100644
@@ -50,10 +50,16 @@ ifndef BUSYBOX_CONFIG_FILE
 	BUSYBOX_CONFIG_FILE = $(call qstrip,$(BR2_PACKAGE_BUSYBOX_CONFIG))
 endif
 
+ifeq ($(BR2_PACKAGE_BUSYBOX_INDIVIDUAL_BINARIES),y)
+define BUSYBOX_PERMISSIONS
+/usr/share/udhcpc/default.script f 755  0 0 - - - - -
+endef
+else
 define BUSYBOX_PERMISSIONS
 /bin/busybox			 f 4755	0 0 - - - - -
 /usr/share/udhcpc/default.script f 755  0 0 - - - - -
 endef
+endif
 
 # If mdev will be used for device creation enable it and copy S10mdev to /etc/init.d
 ifeq ($(BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV),y)
@@ -152,6 +158,22 @@ define BUSYBOX_SET_INIT
 endef
 endif
 
+ifeq ($(BR2_PACKAGE_BUSYBOX_INDIVIDUAL_BINARIES),y)
+define BUSYBOX_CONFIGURE_INDIVIDUAL_BINARIES
+	$(call KCONFIG_ENABLE_OPT,CONFIG_BUILD_LIBBUSYBOX,$(BUSYBOX_BUILD_CONFIG))
+	$(call KCONFIG_ENABLE_OPT,CONFIG_FEATURE_INDIVIDUAL,$(BUSYBOX_BUILD_CONFIG))
+endef
+
+define BUSYBOX_INSTALL_INDIVIDUAL_BINARIES
+	for i in `find -L $(TARGET_DIR) -xtype l -samefile $(TARGET_DIR)/bin/busybox` ; do \
+		$(INSTALL) -D -m 0755 $(@D)/0_lib/`basename $$i` $$i ; \
+	done
+	cp $(@D)/0_lib/libbusybox.so.* $(TARGET_DIR)/lib
+	rm -f $(TARGET_DIR)/lib/libbusybox.so.*_unstripped*
+	rm -f $(TARGET_DIR)/bin/busybox
+endef
+endif
+
 define BUSYBOX_INSTALL_LOGGING_SCRIPT
 	if grep -q CONFIG_SYSLOGD=y $(@D)/.config; then \
 		[ -f $(TARGET_DIR)/etc/init.d/S01logging ] || \
@@ -187,6 +209,7 @@ define BUSYBOX_CONFIGURE_CMDS
 	$(BUSYBOX_INTERNAL_SHADOW_PASSWORDS)
 	$(BUSYBOX_SET_INIT)
 	$(BUSYBOX_SET_WATCHDOG)
+	$(BUSYBOX_CONFIGURE_INDIVIDUAL_BINARIES)
 	@yes "" | $(MAKE) ARCH=$(KERNEL_ARCH) CROSS_COMPILE="$(TARGET_CROSS)" \
 		-C $(@D) oldconfig
 endef
@@ -205,6 +228,7 @@ define BUSYBOX_INSTALL_TARGET_CMDS
 	$(BUSYBOX_INSTALL_MDEV_CONF)
 	$(BUSYBOX_INSTALL_LOGGING_SCRIPT)
 	$(BUSYBOX_INSTALL_WATCHDOG_SCRIPT)
+	$(BUSYBOX_INSTALL_INDIVIDUAL_BINARIES)
 endef
 
 $(eval $(generic-package))
Signature · 1 line
1.7.1
#17 lore raw

PATCH v4 16/20 busybox: add option to install individual binaries

Quoted 14 lines · Clayton Shotwell

From: Thomas Petazzoni <[email protected]>

---
  package/busybox/Config.in  |    3 +++
  package/busybox/busybox.mk |   24 ++++++++++++++++++++++++
  2 files changed, 27 insertions(+), 0 deletions(-)
package/busybox/Config.in +0 -0
index 2d55aa6..7f00fb8 100644

package/busybox/Config.in config BR2_PACKAGE_BUSYBOX_SHOW_OTHERS · line 59

Quoted 5 lines
package/busybox/Config.in +2 -0
@@ -55,6 +55,9 @@ config BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
  	  Show packages in menuconfig that are potentially also provided
  	  by busybox.
 
+config BR2_PACKAGE_BUSYBOX_INDIVIDUAL_BINARIES
+	bool "Individual binaries"

This really lacks some help text, even I had no idea what it meant at
first. I guess the text from busybox can just be reused - though for SELinux there's obviously a different reason.

If your CPU architecture doesn't allow for sharing text/rodata sections of running binaries, but allows for runtime dynamic libraries, this option will allow you to reduce memory footprint when you have many different applets running at once.

If your CPU architecture allows for sharing text/rodata, having single binary is more optimal.

Each applet will be a tiny program, dynamically linked against libbusybox.so.N.N.N.

You need to have a working dynamic linker.

That last sentence makes me think that we're missing a depends on
!BR2_PREFER_STATIC here.

Quoted 9 lines
package/busybox/Config.in +1 -0
+
  config BR2_PACKAGE_BUSYBOX_WATCHDOG
  	bool "Install the watchdog daemon startup script"
  	help
package/busybox/busybox.mk +0 -0
index f6f542e..13de7ed 100644

package/busybox/busybox.mk ifndef BUSYBOX_CONFIG_FILE · line 55

Quoted 6 lines
package/busybox/busybox.mk +3 -0
@@ -50,10 +50,16 @@ ifndef BUSYBOX_CONFIG_FILE
  	BUSYBOX_CONFIG_FILE = $(call qstrip,$(BR2_PACKAGE_BUSYBOX_CONFIG))
  endif
 
+ifeq ($(BR2_PACKAGE_BUSYBOX_INDIVIDUAL_BINARIES),y)
+define BUSYBOX_PERMISSIONS
+/usr/share/udhcpc/default.script f 755  0 0 - - - - -

Isn't setuid root needed anymore for /bin/login? Same for passwd, su,
probably others...

Quoted 14 lines
package/busybox/busybox.mk +3 -0
+endef
+else
  define BUSYBOX_PERMISSIONS
  /bin/busybox			 f 4755	0 0 - - - - -
  /usr/share/udhcpc/default.script f 755  0 0 - - - - -
  endef
+endif
 
  # If mdev will be used for device creation enable it and copy S10mdev to /etc/init.d
  ifeq ($(BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV),y)
@@ -152,6 +158,22 @@ define BUSYBOX_SET_INIT
  endef
  endif
 

package/busybox/busybox.mk define BUSYBOX_SET_INIT · line 170

Quoted 10 lines
package/busybox/busybox.mk +10 -0
+ifeq ($(BR2_PACKAGE_BUSYBOX_INDIVIDUAL_BINARIES),y)
+define BUSYBOX_CONFIGURE_INDIVIDUAL_BINARIES
+	$(call KCONFIG_ENABLE_OPT,CONFIG_BUILD_LIBBUSYBOX,$(BUSYBOX_BUILD_CONFIG))
+	$(call KCONFIG_ENABLE_OPT,CONFIG_FEATURE_INDIVIDUAL,$(BUSYBOX_BUILD_CONFIG))
+endef
+
+define BUSYBOX_INSTALL_INDIVIDUAL_BINARIES
+	for i in `find -L $(TARGET_DIR) -xtype l -samefile $(TARGET_DIR)/bin/busybox` ; do \
+		$(INSTALL) -D -m 0755 $(@D)/0_lib/`basename $$i` $$i ; \
+	done

Icky, perhaps it's better to make an upstreamable patch that fixes the
Makefile so it properly installs the binaries if INDIVIDUAL_BINARIES is selected?

Regards,
Arnout

Quoted 26 lines
package/busybox/busybox.mk +8 -0
+	cp $(@D)/0_lib/libbusybox.so.* $(TARGET_DIR)/lib
+	rm -f $(TARGET_DIR)/lib/libbusybox.so.*_unstripped*
+	rm -f $(TARGET_DIR)/bin/busybox
+endef
+endif
+
  define BUSYBOX_INSTALL_LOGGING_SCRIPT
  	if grep -q CONFIG_SYSLOGD=y $(@D)/.config; then \
  		[ -f $(TARGET_DIR)/etc/init.d/S01logging ] || \
@@ -187,6 +209,7 @@ define BUSYBOX_CONFIGURE_CMDS
  	$(BUSYBOX_INTERNAL_SHADOW_PASSWORDS)
  	$(BUSYBOX_SET_INIT)
  	$(BUSYBOX_SET_WATCHDOG)
+	$(BUSYBOX_CONFIGURE_INDIVIDUAL_BINARIES)
  	@yes "" | $(MAKE) ARCH=$(KERNEL_ARCH) CROSS_COMPILE="$(TARGET_CROSS)" \
  		-C $(@D) oldconfig
  endef
@@ -205,6 +228,7 @@ define BUSYBOX_INSTALL_TARGET_CMDS
  	$(BUSYBOX_INSTALL_MDEV_CONF)
  	$(BUSYBOX_INSTALL_LOGGING_SCRIPT)
  	$(BUSYBOX_INSTALL_WATCHDOG_SCRIPT)
+	$(BUSYBOX_INSTALL_INDIVIDUAL_BINARIES)
  endef
 
  $(eval $(generic-package))
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#18 lore raw

PATCH v4 16/20 busybox: add option to install individual binaries

Dear Arnout Vandecappelle,

Quoted 7 lines · Arnout Vandecappelle

package/busybox/Config.in config BR2_PACKAGE_BUSYBOX_SHOW_OTHERS · line 59

Quoted 3 lines
package/busybox/Config.in +2 -0
+config BR2_PACKAGE_BUSYBOX_INDIVIDUAL_BINARIES
+	bool "Individual binaries"

This really lacks some help text, even I had no idea what it meant
at first. I guess the text from busybox can just be reused - though for SELinux there's obviously a different reason.

In fact, the patches from me in this series were not really meant to be sent to the list. They are proof-of-concept patches that I did to help Clayton, but some more work was needed before they could be submit for real.

Quoted 5 lines

If your CPU architecture doesn't allow for sharing
text/rodata sections of running binaries, but allows for runtime dynamic libraries, this option will allow you to reduce memory footprint when you have many different applets running at once.

Quoted 7 lines

If your CPU architecture allows for sharing text/rodata, having single binary is more optimal.

Each applet will be a tiny program, dynamically linked against libbusybox.so.N.N.N.

You need to have a working dynamic linker.

In the context of SELinux, it's because SELinux can only apply different security policies to the various applets if they use different binaries.

Quoted 2 lines

That last sentence makes me think that we're missing a depends on
!BR2_PREFER_STATIC here.

Indeed.

Also, I am not sure we want to show this option in the top-level package menuconfig. So, we can either:

* Have a sub-menu for Busybox customization options
* Make this behavior automatic whenever SELinux support is enabled, and only in this case

Quoted 6 lines

package/busybox/busybox.mk ifndef BUSYBOX_CONFIG_FILE · line 55

Quoted 3 lines
package/busybox/busybox.mk +3 -0
+ifeq ($(BR2_PACKAGE_BUSYBOX_INDIVIDUAL_BINARIES),y)
+define BUSYBOX_PERMISSIONS
+/usr/share/udhcpc/default.script f 755  0 0 - - - - -

Isn't setuid root needed anymore for /bin/login? Same for passwd,
su, probably others...

Most likely yes. I have been able to log into the system with this patch, though.

Quoted 10 lines

package/busybox/busybox.mk define BUSYBOX_SET_INIT · line 170

Quoted 6 lines
(quoted diff) +2 -0
+define BUSYBOX_INSTALL_INDIVIDUAL_BINARIES
+	for i in `find -L $(TARGET_DIR) -xtype l -samefile

$(TARGET_DIR)/bin/busybox` ; do \

(quoted diff) +1 -0
+		$(INSTALL) -D -m 0755 $(@D)/0_lib/`basename $$i`

$$i ; \

package/busybox/busybox.mk +1 -0
+	done

Icky, perhaps it's better to make an upstreamable patch that fixes
the Makefile so it properly installs the binaries if INDIVIDUAL_BINARIES is selected?

Yeah, could be interesting indeed.

Thanks for your comments,

Thomas

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

PATCH v4 16/20 busybox: add option to install individual binaries

Thomas,

Thomas Petazzoni <[email protected]> wrote on 12/15/2013 10:10:59 AM:

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
package/busybox/Config.in +2 -0
+config BR2_PACKAGE_BUSYBOX_INDIVIDUAL_BINARIES
+   bool "Individual binaries"
Quoted 8 lines
Quoted 3 lines

This really lacks some help text, even I had no idea what it meant
at first. I guess the text from busybox can just be reused - though for SELinux there's obviously a different reason.

In fact, the patches from me in this series were not really meant to be sent to the list. They are proof-of-concept patches that I did to help Clayton, but some more work was needed before they could be submit for real.

I apologize for just sending these out without any context or much of a second review.
I will get them cleaned up a little bit and resubmit them.

Quoted 36 lines
Quoted 5 lines

If your CPU architecture doesn't allow for sharing
text/rodata sections of running binaries, but allows for runtime dynamic libraries, this option will allow you to reduce memory footprint when you have many different applets running at once.

Quoted 7 lines

If your CPU architecture allows for sharing text/rodata, having single binary is more optimal.

Each applet will be a tiny program, dynamically linked against libbusybox.so.N.N.N.

You need to have a working dynamic linker.

In the context of SELinux, it's because SELinux can only apply different security policies to the various applets if they use different binaries.

Quoted 2 lines

That last sentence makes me think that we're missing a depends on
!BR2_PREFER_STATIC here.

Indeed.

Also, I am not sure we want to show this option in the top-level package menuconfig. So, we can either:

* Have a sub-menu for Busybox customization options
* Make this behavior automatic whenever SELinux support is enabled, and only in this case

Quoted 6 lines

package/busybox/busybox.mk ifndef BUSYBOX_CONFIG_FILE · line 55

Quoted 3 lines
package/busybox/busybox.mk +3 -0
+ifeq ($(BR2_PACKAGE_BUSYBOX_INDIVIDUAL_BINARIES),y)
+define BUSYBOX_PERMISSIONS
+/usr/share/udhcpc/default.script f 755  0 0 - - - - -

Isn't setuid root needed anymore for /bin/login? Same for passwd,
su, probably others...

Quoted 2 lines

Most likely yes. I have been able to log into the system with this patch, though.

I will come up with a base list of applications that need suid and add it to the patch.

Thanks,
Clayton

Clayton Shotwell
Software Engineer
clshotwe at rockwellcollins.com
www.rockwellcollins.com

#20 lore raw

PATCH v4 16/20 busybox: add option to install individual binaries

In reply to Arnout Vandecappelle

Arnout,

Arnout Vandecappelle <[email protected]> wrote on 12/12/2013 05:02:01 PM:

Quoted 2 lines

That last sentence makes me think that we're missing a depends on
!BR2_PREFER_STATIC here.

Agreed. I'll add that in.

Quoted 10 lines

package/busybox/busybox.mk ifndef BUSYBOX_CONFIG_FILE · line 50

Quoted 10 lines
package/busybox/Config.in +1 -0
+
  config BR2_PACKAGE_BUSYBOX_WATCHDOG
     bool "Install the watchdog daemon startup script"
     help
package/busybox/busybox.mk +0 -0
index f6f542e..13de7ed 100644
@@ -50,10 +50,16 @@ ifndef BUSYBOX_CONFIG_FILE
     BUSYBOX_CONFIG_FILE = $(call 

qstrip,$(BR2_PACKAGE_BUSYBOX_CONFIG))

Quoted 8 lines

package/busybox/busybox.mk ifndef BUSYBOX_CONFIG_FILE · line 55

Quoted 5 lines
package/busybox/busybox.mk +3 -0
  endif
 
+ifeq ($(BR2_PACKAGE_BUSYBOX_INDIVIDUAL_BINARIES),y)
+define BUSYBOX_PERMISSIONS
+/usr/share/udhcpc/default.script f 755  0 0 - - - - -

Isn't setuid root needed anymore for /bin/login? Same for passwd, su,
probably others...

Good point. I'll look into adding support for that.

Quoted 26 lines

package/busybox/busybox.mk ifndef BUSYBOX_CONFIG_FILE

Quoted 9 lines
package/busybox/busybox.mk +3 -0
+endef
+else
  define BUSYBOX_PERMISSIONS
  /bin/busybox          f 4755   0 0 - - - - -
  /usr/share/udhcpc/default.script f 755  0 0 - - - - -
  endef
+endif
 
  # If mdev will be used for device creation enable it and copy 

S10mdev to /etc/init.d

package/busybox/busybox.mk define BUSYBOX_SET_INIT · line 163

Quoted 8 lines
package/busybox/busybox.mk +3 -0
  ifeq ($(BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV),y)
@@ -152,6 +158,22 @@ define BUSYBOX_SET_INIT
  endef
  endif
 
+ifeq ($(BR2_PACKAGE_BUSYBOX_INDIVIDUAL_BINARIES),y)
+define BUSYBOX_CONFIGURE_INDIVIDUAL_BINARIES
+   $(call KCONFIG_ENABLE_OPT,CONFIG_BUILD_LIBBUSYBOX,$

(BUSYBOX_BUILD_CONFIG))

package/busybox/busybox.mk define BUSYBOX_SET_INIT · line 164

Quoted 1 line
package/busybox/busybox.mk +1 -0
+   $(call KCONFIG_ENABLE_OPT,CONFIG_FEATURE_INDIVIDUAL,$

(BUSYBOX_BUILD_CONFIG))

package/busybox/busybox.mk define BUSYBOX_SET_INIT

Quoted 4 lines
package/busybox/busybox.mk +4 -0
+endef
+
+define BUSYBOX_INSTALL_INDIVIDUAL_BINARIES
+   for i in `find -L $(TARGET_DIR) -xtype l -samefile $

(TARGET_DIR)/bin/busybox` ; do \

Quoted 6 lines

package/busybox/busybox.mk define BUSYBOX_SET_INIT · line 170

Quoted 2 lines
package/busybox/busybox.mk +2 -0
+      $(INSTALL) -D -m 0755 $(@D)/0_lib/`basename $$i` $$i ; \
+   done

Icky, perhaps it's better to make an upstreamable patch that fixes the

Makefile so it properly installs the binaries if INDIVIDUAL_BINARIES is

I'll see what I can do.

Thanks,
Clayton

Clayton Shotwell
Software Engineer
clshotwe at rockwellcollins.com
www.rockwellcollins.com

#21 lore raw

PATCH v4 17/20 busybox: add option to enable SELinux support

In reply to Clayton Shotwell

From: Thomas Petazzoni <[email protected]>

---
 ...ags-strip-non-l-arguments-returned-by-pkg.patch |   28 ++++++++++++++++++++
 package/busybox/Config.in                          |    3 ++
 package/busybox/busybox.mk                         |    8 +++++
 3 files changed, 39 insertions(+), 0 deletions(-)
 create mode 100644 package/busybox/1.21.1/0004-Makefile.flags-strip-non-l-arguments-returned-by-pkg.patch
package/busybox/1.21.1/0004-Makefile.flags-strip-non-l-arguments-returned-by-pkg.patch new file +28 -0
new file mode 100644
index 0000000..105626c
@@ -0,0 +1,28 @@
+From 67eb23d2be8aba3c474dac81a15b0fa11e5847b7 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <[email protected]>
+Date: Mon, 25 Nov 2013 22:51:53 +0100
+Subject: [PATCH] Makefile.flags: strip non -l arguments returned by pkg-config
+
+Signed-off-by: Thomas Petazzoni <[email protected]>
+---
+ Makefile.flags | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/Makefile.flags b/Makefile.flags
+index 307afa7..885e323 100644
+--- a/Makefile.flags
++++ b/Makefile.flags
+@@ -141,7 +141,9 @@ ifeq ($(CONFIG_SELINUX),y)
+ SELINUX_PC_MODULES = libselinux libsepol
+ $(eval $(call pkg_check_modules,SELINUX,$(SELINUX_PC_MODULES)))
+ CPPFLAGS += $(SELINUX_CFLAGS)
+-LDLIBS += $(if $(SELINUX_LIBS),$(SELINUX_LIBS:-l%=%),$(SELINUX_PC_MODULES:lib%=%))
++LDLIBS += $(if $(SELINUX_LIBS),\
++       $(patsubst -l%,%,$(filter -l%,$(SELINUX_LIBS))),\
++       $(SELINUX_PC_MODULES:lib%=%))
+ endif
+ 
+ ifeq ($(CONFIG_EFENCE),y)
+-- 
+1.8.1.2
+
package/busybox/Config.in +3 -0
index 7f00fb8..9e64ec0 100644
@@ -58,6 +58,9 @@ config BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
 config BR2_PACKAGE_BUSYBOX_INDIVIDUAL_BINARIES
 	bool "Individual binaries"
 
+config BR2_PACKAGE_BUSYBOX_SELINUX
+	bool "Enable SELinux support"
+
 config BR2_PACKAGE_BUSYBOX_WATCHDOG
 	bool "Install the watchdog daemon startup script"
 	help
package/busybox/busybox.mk +8 -0
index 13de7ed..24f0695 100644
@@ -174,6 +174,13 @@ define BUSYBOX_INSTALL_INDIVIDUAL_BINARIES
 endef
 endif
 
+ifeq ($(BR2_PACKAGE_BUSYBOX_SELINUX),y)
+BUSYBOX_DEPENDENCIES += host-pkgconf libselinux libsepol
+define BUSYBOX_SET_SELINUX
+	$(call KCONFIG_ENABLE_OPT,CONFIG_SELINUX,$(BUSYBOX_BUILD_CONFIG))
+endef
+endif
+
 define BUSYBOX_INSTALL_LOGGING_SCRIPT
 	if grep -q CONFIG_SYSLOGD=y $(@D)/.config; then \
 		[ -f $(TARGET_DIR)/etc/init.d/S01logging ] || \
@@ -210,6 +217,7 @@ define BUSYBOX_CONFIGURE_CMDS
 	$(BUSYBOX_SET_INIT)
 	$(BUSYBOX_SET_WATCHDOG)
 	$(BUSYBOX_CONFIGURE_INDIVIDUAL_BINARIES)
+	$(BUSYBOX_SET_SELINUX)
 	@yes "" | $(MAKE) ARCH=$(KERNEL_ARCH) CROSS_COMPILE="$(TARGET_CROSS)" \
 		-C $(@D) oldconfig
 endef
Signature · 1 line
1.7.1
#22 lore raw

PATCH v4 17/20 busybox: add option to enable SELinux support

Dear Clayton Shotwell,

package/busybox/Config.in config BR2_PACKAGE_BUSYBOX_SHOW_OTHERS · line 62

Quoted 2 lines · Clayton Shotwell
package/busybox/Config.in +2 -0
+config BR2_PACKAGE_BUSYBOX_SELINUX
+	bool "Enable SELinux support"

Maybe we don't need a Busybox sub-option and instead we can enable SELinux support as soon as libselinux and libsepol are available?

Best regards,

Thomas

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

PATCH v4 17/20 busybox: add option to enable SELinux support

Thomas,

Quoted 6 lines

package/busybox/Config.in config BR2_PACKAGE_BUSYBOX_SHOW_OTHERS · line 62

Quoted 2 lines
package/busybox/Config.in +2 -0
+config BR2_PACKAGE_BUSYBOX_SELINUX
+   bool "Enable SELinux support"

Maybe we don't need a Busybox sub-option and instead we can enable SELinux support as soon as libselinux and libsepol are available?

Either way works for me.

Thanks,
Clayton

Clayton Shotwell
Software Engineer
clshotwe at rockwellcollins.com
www.rockwellcollins.com

#24 lore raw

PATCH v4 18/20 busybox: ensure it finds pkg-config by setting PATH

In reply to Clayton Shotwell

From: Thomas Petazzoni <[email protected]>

---
 package/busybox/busybox.mk |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
package/busybox/busybox.mk +1 -0
index 24f0695..1a40b43 100644
@@ -38,6 +38,7 @@ BUSYBOX_MAKE_ENV = \
 	CFLAGS="$(BUSYBOX_CFLAGS)" \
 	CFLAGS_busybox="$(BUSYBOX_CFLAGS_busybox)"
 BUSYBOX_MAKE_OPTS = \
+	PATH="$(TARGET_PATH)" \
 	CC="$(TARGET_CC)" \
 	ARCH=$(KERNEL_ARCH) \
 	PREFIX="$(TARGET_DIR)" \
Signature · 1 line
1.7.1
#25 lore raw

PATCH v4 19/20 refpolicy: Add busybox selections

In reply to Clayton Shotwell

Adding selects to enable SELinux and individual binaries when refpolicy is selected.

---
 package/refpolicy/Config.in |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
package/refpolicy/Config.in +2 -0
index 64e5831..03bfed3 100644
@@ -1,6 +1,8 @@
 config BR2_PACKAGE_REFPOLICY
 	bool "refpolicy"
 	select BR2_PACKAGE_POLICYCOREUTILS
+	select BR2_PACKAGE_BUSYBOX_SELINUX
+	select BR2_PACKAGE_BUSYBOX_INDIVIDUAL_BINARIES
 	depends on BR2_TOOLCHAIN_HAS_THREADS # policycoreutils
 	depends on BR2_LARGEFILE # policycoreutils
 	depends on BR2_ENABLE_LOCALE # policycoreutils
Signature · 1 line
1.7.1
#26 lore raw

PATCH v4 20/20 configs: Add SELinux x86 qemu config

In reply to Clayton Shotwell

Adding a base SELinux QEMU image for x86. This will build a base SELinux system that boots with SELinux in permissive mode.

---
 board/qemu/x86/linux-3.12-selinux.config |   72 ++++++++++++++++++++++++++++++
 configs/qemu_x86_selinux_defconfig       |   27 +++++++++++
 2 files changed, 99 insertions(+), 0 deletions(-)
 create mode 100644 board/qemu/x86/linux-3.12-selinux.config
 create mode 100644 configs/qemu_x86_selinux_defconfig
board/qemu/x86/linux-3.12-selinux.config new file +72 -0
new file mode 100644
index 0000000..20aff7f
@@ -0,0 +1,72 @@
+CONFIG_EXPERIMENTAL=y
+# CONFIG_LOCALVERSION_AUTO is not set
+# CONFIG_SWAP is not set
+CONFIG_AUDIT=y
+# CONFIG_COMPAT_BRK is not set
+CONFIG_MODULES=y
+# CONFIG_BLK_DEV_BSG is not set
+# CONFIG_IOSCHED_DEADLINE is not set
+# CONFIG_IOSCHED_CFQ is not set
+# CONFIG_X86_EXTENDED_PLATFORM is not set
+# CONFIG_SCHED_OMIT_FRAME_POINTER is not set
+# CONFIG_MTRR_SANITIZER is not set
+# CONFIG_SECCOMP is not set
+# CONFIG_RELOCATABLE is not set
+CONFIG_NET=y
+CONFIG_PACKET=y
+CONFIG_UNIX=y
+CONFIG_INET=y
+CONFIG_IP_PNP=y
+# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
+# CONFIG_INET_XFRM_MODE_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_BEET is not set
+# CONFIG_INET_LRO is not set
+# CONFIG_INET_DIAG is not set
+# CONFIG_IPV6 is not set
+# CONFIG_WIRELESS is not set
+CONFIG_DEVTMPFS=y
+CONFIG_DEVTMPFS_MOUNT=y
+# CONFIG_PREVENT_FIRMWARE_BUILD is not set
+# CONFIG_FIRMWARE_IN_KERNEL is not set
+# CONFIG_BLK_DEV is not set
+CONFIG_BLK_DEV_SD=y
+CONFIG_ATA=y
+CONFIG_ATA_PIIX=y
+CONFIG_NETDEVICES=y
+CONFIG_NE2K_PCI=y
+CONFIG_8139CP=y
+# CONFIG_WLAN is not set
+# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
+# CONFIG_INPUT_MOUSE is not set
+# CONFIG_SERIO_SERPORT is not set
+# CONFIG_LEGACY_PTYS is not set
+# CONFIG_DEVKMEM is not set
+CONFIG_SERIAL_8250=y
+CONFIG_SERIAL_8250_CONSOLE=y
+# CONFIG_HW_RANDOM is not set
+# CONFIG_HWMON is not set
+CONFIG_SOUND=y
+CONFIG_SND=y
+CONFIG_SND_HDA_INTEL=y
+# CONFIG_USB_SUPPORT is not set
+# CONFIG_X86_PLATFORM_DEVICES is not set
+# CONFIG_DMIID is not set
+CONFIG_EXT2_FS=y
+CONFIG_EXT2_FS_XATTR=y
+CONFIG_EXT2_FS_SECURITY=y
+# CONFIG_DNOTIFY is not set
+# CONFIG_INOTIFY_USER is not set
+# CONFIG_MISC_FILESYSTEMS is not set
+CONFIG_NFS_FS=y
+CONFIG_ROOT_NFS=y
+# CONFIG_ENABLE_WARN_DEPRECATED is not set
+# CONFIG_ENABLE_MUST_CHECK is not set
+# CONFIG_UNUSED_SYMBOLS is not set
+# CONFIG_FRAME_POINTER is not set
+# CONFIG_X86_VERBOSE_BOOTUP is not set
+CONFIG_SECURITY=y
+CONFIG_SECURITY_NETWORK=y
+CONFIG_SECURITY_SELINUX=y
+CONFIG_SECURITY_SELINUX_BOOTPARAM=y
+CONFIG_CRYPTO_ANSI_CPRNG=y
+# CONFIG_VIRTUALIZATION is not set
configs/qemu_x86_selinux_defconfig new file +27 -0
new file mode 100644
index 0000000..ba26ae4
@@ -0,0 +1,27 @@
+# Architecture
+BR2_i386=y
+BR2_x86_pentiumpro=y
+
+# system
+BR2_TARGET_GENERIC_GETTY=y
+BR2_TARGET_GENERIC_GETTY_PORT="tty1"
+
+# filesystem
+BR2_TARGET_ROOTFS_EXT2=y
+# BR2_TARGET_ROOTFS_TAR is not set
+
+# Lock to 3.12 headers to avoid breaking with newer kernels
+BR2_KERNEL_HEADERS_VERSION=y
+BR2_DEFAULT_KERNEL_VERSION="3.12.2"
+
+# Kernel
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="3.12.2"
+BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
+BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/x86/linux-3.12-selinux.config"
+
+# SELinux
+BR2_PACKAGE_BUSYBOX_INDIVIDUAL_BINARIES=y
+BR2_PACKAGE_BUSYBOX_SELINUX=y
+BR2_PACKAGE_REFPOLICY=y
Signature · 1 line
1.7.1