[OpenWrt-Devel,0/7] SELinux support: core OpenWrt changes
mbox series

Message ID 20191122095541.688125-1-thomas.petazzoni@bootlin.com
Headers show
Series
  • SELinux support: core OpenWrt changes
Related show

Message

Thomas Petazzoni Nov. 22, 2019, 9:55 a.m. UTC
Hello,

This patch series is one part of the changes needed to bring minimal
SELinux support to OpenWrt. SELinux is a mandatory access control
Linux security module, which I assume most if not all OpenWrt users
are already familiar with. The work presented in these patch series
presents a minimal integration, in the sense that it allows to:

 (1) Build all the important SELinux components, both on the build
     system (for example to compile a SELinux policy) and on the
     target system (libselinux, policy management tools, etc.)

 (2) Set the SELinux security contexts on the files in the filesystem
     image generated by OpenWrt.

 (3) Compile the SELinux policy on the build machine, and integrate
     the compiled SELinux policy in the target filesystem.

 (4) Load at boot time the SELinux policy and enable it.

The provided SELinux policy is the default SELinux policy from the
upstream project: it has not been tuned specifically for OpenWrt.

There are two patch series for this work:

 - One for OpenWrt itself (this patch series)

 - One for the OpenWrt packages feed

OpenWrt changes
===============

This patch series brings the following changes:

 - Allow to build Busybox with SELinux support, mainly to get -Z
   option support in several commands. This requires linking against
   libselinux, which is provided in the packages feeds as part of the
   second patch series.

 - Addition of minimal SELinux support in procd, to load the SELinux
   policy at boot time. The patch has been submitted separately to
   procd, and is being discussed.

 - Addition of the fakeroot tool, which we need when generating the
   filesystem image to run the SELinux command "setfiles" that sets
   the appropriate security context for the files in the
   filesystem. It obviously requires root access, which is why it is
   executed under fakeroot.

 - Addition of support for generating a SquashFS image with the
   SELinux security contexts defined. It could be extended to other
   filesystem formats of course.

 - Add some logic to be able to enable SquashFS extended attribute
   support in the kernel configuration, as well as SELinux support.

 - Enable extended attribute support in mksquashfs.

OpenWrt packages feed changes
=============================

This patch series brings new packages for the different user-space
components of SELinux and their dependencies:

 - libsepol
 - libselinux, including its Python bindings
 - audit
 - libcap-ng
 - libsemanage
 - policycoreutils
 - checkpolicy
 - refpolicy
 - selinux-python

These are pretty regular packages.

I'm looking forward to the feedback of the OpenWrt community on this
proposal.

Best regards,

Thomas Petazzoni

Thomas Petazzoni (7):
  package/utils/busybox: add optional selinux support
  package/system/procd: add SELinux support
  tools/fakeroot: new tool
  include/image.mk: implement SELinux squashfs image generation
  config/Config-kernel.in: add option to enable squashfs xattr support
  config/Config-kernel.in: add various options needed for SELinux
  tools/squashfs4: enable xattr support

 config/Config-kernel.in                       |  15 +++
 include/image.mk                              |  15 ++-
 package/system/procd/Makefile                 |   5 +-
 ...inimal-SELinux-policy-loading-suppor.patch | 110 ++++++++++++++++++
 package/utils/busybox/Makefile                |   7 +-
 tools/Makefile                                |   2 +-
 tools/fakeroot/Makefile                       |  20 ++++
 tools/squashfskit4/Makefile                   |   2 +-
 8 files changed, 169 insertions(+), 7 deletions(-)
 create mode 100644 package/system/procd/patches/0001-initd-init-add-minimal-SELinux-policy-loading-suppor.patch
 create mode 100644 tools/fakeroot/Makefile