Commit Graph

91 Commits

Author SHA1 Message Date
Mingli Yu
a8c55f9456 util-linux: move PACKAGECONFIG to oe-core
Move PACKAGECONFIG setting to oe-core [1] to conform to yocto compliance.

[1] https://git.openembedded.org/openembedded-core/commit/?id=c57cc22fad708ac856ac4ebe0a42042031fbf90b

Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
Signed-off-by: Joe MacDonald <joe@deserted.net>
2022-12-14 20:31:45 -05:00
Yi Zhao
08a2705c00 base-files: set correct label for /var/volatile
By default /var/volatile will be mounted with tmpfs_t instead of var_t
label, which will cause us to have to add some extra rules to eliminate
avc denials of some services.

Set rootcontext for /var/volatile in fstab to make sure it is mounted
with correct label.

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
Signed-off-by: Joe MacDonald <joe@deserted.net>
2022-11-07 14:19:08 -05:00
Yi Zhao
aa46581a45 sysvinit: sync bbappend to 3.0
The sysvinit in oe-core has been upgraded to 3.0. Update the bbappend to
adapt it.

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
Signed-off-by: Joe MacDonald <joe@deserted.net>
2021-11-22 12:23:16 -05:00
Mingli Yu
4d2bb085d2 coreutils/findutils/tar: remove pkgconfig from bbappend
When enable meta-gplv2 layer [1], there comes below error:
  ERROR: coreutils-6.9-r5 do_configure: QA Issue: coreutils: configure was passed unrecognised options: --without-selinux [unknown-configure-option]
  ERROR: coreutils-6.9-r5 do_configure: Fatal QA errors found, failing task.

It's because the old version of coreutils under meta-gplv2 layer
doesn't support the above configure option, so move the related
pkgconfig setting to the coreutils recipe under oe-core [2] which
supports the configure option to fix the gap.

And the findutils and tar also have the problem.

[1] http://git.yoctoproject.org/cgit/cgit.cgi/meta-gplv2/
[2] https://git.openembedded.org/openembedded-core/

Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
Signed-off-by: Joe MacDonald <joe@deserted.net>
2021-09-29 22:29:59 -04:00
Yi Zhao
31325005e4 classes: drop redundant classes
There are some redundant classes: enable-selinux.bbclass,
with-selinux.bbclass, meson-enable-selinux.bbclass,
meson-selinux.bbclass, enable-audit.bbclass, with-audit.bbclass.
These classes only add PACKAGEOCNFIG[selinux]/[audit] to recipes. But
currently most recipes have added PACKAGECONFIG[selinux]/[audit] in
their bb files. We don't need these anymore. Only keep
enable-selinux.class and enable-audit.class to append
PACKAGECONFIG[selinux]/[audit] for recipes.

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
Signed-off-by: Joe MacDonald <joe@deserted.net>
2021-08-29 21:34:22 -04:00
Yi Zhao
cad53c28de libcgroup: drop bbappend
The content of the bbappend is already contained in libcgroup recipe.

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
Signed-off-by: Joe MacDonald <joe@deserted.net>
2021-08-29 21:34:22 -04:00
Yi Zhao
654201e25d meta-selinux: convert to new override syntax
This is the result of automated script conversion:
poky/scripts/contrib/convert-overrides.py meta-selinux

Converting the metadata to use ":" as the override character instead of "_".

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
Signed-off-by: Joe MacDonald <joe@deserted.net>
2021-08-04 16:18:39 -04:00
Yi Zhao
f156bc995b initscripts: restore security contexts after running populate-volatile.sh
Some directories are created by populate-volatile.sh. We need to restore
their security contexts.

Before the patch:
$ ls -dZ /tmp /var/tmp /var/lock /var/run
system_u:object_r:root_t /tmp
system_u:object_r:var_t /var/lock
system_u:object_r:var_t /var/run
system_u:object_r:var_t /var/tmp

After the patch:
$ ls -dZ /tmp /var/tmp /var/lock /var/run
system_u:object_r:tmp_t /tmp
system_u:object_r:var_lock_t /var/lock
system_u:object_r:var_run_t /var/run
system_u:object_r:tmp_t /var/tmp

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
Signed-off-by: Joe MacDonald <joe@deserted.net>
2021-03-03 13:55:58 -05:00
Yi Zhao
43cb7c2d1b eudev: remove udev-cache and sync the initscript to latest oe-core version
The udev-cache has been remove in oe-core commit
048f4149b8438c521e8b65a3c96d850a9b4a3e5b. So we can also remove it.

Also sync the initscript to latest oe-core version.

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
2020-04-07 09:28:04 -04:00
Joe MacDonald
1e2fdbe71e clean up getVar() usage
83eac4de updated the usage of getVar() in classes/selinux.bbclass to
leave out the default expand parameter. This is consistent with the
usage in the core layers.

Bring all other calls to getVar() in the layer into alignment with this
approach.

Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
2020-04-03 08:48:01 -04:00
hongxu
c64bc6070d sysvinit: sync bbappend to 2.96
Since oe-core upgrades sysvinit to 2.96, wildcard its bbappend and
drop the backported patch

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
2019-12-19 11:03:51 -05:00
Yi Zhao
0c9ee0bcb7 util-linux: drop obsolete patch
Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
2019-08-29 13:52:53 -04:00
Yi Zhao
bb0c9c3abc glib-2.0: fix configure error for meson build
In glib 2.60.x, it turns selinux into a meson feature. We should use
'-Dselinux=enabled/disabled' rather than '-Dselinux=true/false' to
enable/disable the feature.

Add meso-enable-selinux.bbclass for this change and inherit it in
glib-2.0 bbappend to fix the configure error.

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
2019-06-15 23:11:05 -04:00
Kai Kang
b69dad7299 busybox: disable PTEST_BINDIR
A new feature has been added in oe-core to use update-alternative
mechanism for ptest. But it conflicts with current patch in
meta-selinux. So do not use this new feature for ptest when build with
selinux.

Signed-off-by: Kai Kang <kai.kang@windriver.com>
Signed-off-by: Joe MacDonald <joe@deserted.net>
2019-04-18 07:30:28 -04:00
Kai Kang
eafe868098 meson-selinux.bbclass: add for meson build system
Add meson-selinux.bbclass for meson build system. It used
'-Dselinux=true/false' to enable/disable 'selinux' rather than
--enable-selinux or --with-selinux.

Inherit meson-selinux for glib-2.0 to fix configure failure.

Signed-off-by: Kai Kang <kai.kang@windriver.com>
Signed-off-by: Joe MacDonald <joe@deserted.net>
2019-03-25 09:43:53 +01:00
Yi Zhao
3fc792f7a5 libcgroup: replace _virtclass-native with _class-native
The _virtclass-native is obsolete. Replace it with _class-native.

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
2018-08-14 08:03:38 -04:00
Ioan-Adrian Ratiu
64122293d2 busybox: fix usrmerge install
If DISTRO_FEATURES contains usrmerge then busybox binaries are
installed under /usr/bin not /bin so use ${base_bindir} to support
both paths and avoid QA errors.

Signed-off-by: Ioan-Adrian Ratiu <adrian.ratiu@ni.com>
Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
2018-08-13 11:20:32 -04:00
Wenzong Fan
5d203f9039 systemd: create /var/lib/systemd/backlight in advance
v2 changes:
* Update patch for Yocto Compat - don't change layer's hash

============================================

The systemd-backlight@.service which called after selinux-init.service
will create /var/lib/systemd/backlight with incorrect security labels,
this causes the systemd-backlight service fails to start and stop.

Creating /var/lib/systemd/backlight in advance to make sure it could
always be relabelled by selinux-init while first booting.

Signed-off-by: Wenzong Fan <wenzong.fan@windriver.com>
Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
2018-05-08 10:30:56 -04:00
Mark Hatle
4fefe83c32 Refactor to conform to YP Compat requirements
Change the references to check for the distribution flag of 'selinux' being
set before taking any action within the bbappends.  This prevents the
signature from being modified.

Also remove PR changes, as they are no longer allowed.

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2017-09-14 08:29:01 -05:00
Mark Hatle
232bfebc92 systemd: Remove inherit enable-selinux, obsolete
The PACKAGECONFIG and related settings are in oe-core.  Doing it here will
trigger a bug related to lack of 'initscripts-sushell' rdepends.

based on the change:

   From: Jackie Huang <jackie.huang@windriver.com>

   The selinux PACKAGECONFIG is properly handled in
   the recipe in oe-core, no need to inherit the
   enable-selinux bbclass.

Signed-off-by: Jackie Huang <jackie.huang@windriver.com>

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2017-09-13 16:35:19 -05:00
Zhixiong Chi
827b305e04 initscripts: use the 'i' option for restorecon command
Use the 'i' option for restorecon command to ignore the files that
don't exist when building project.

Signed-off-by: Zhixiong Chi <zhixiong.chi@windriver.com>
2017-09-08 13:19:24 -05:00
Joe MacDonald
a5f71f180d eudev: remove explicit setenforce call in init
When using udev-cache, the eudev init script had been explicitly calling
'setenforce 1'. That's no longer necessary with updates to other parts of
eudev and the presence of the call prevented booting core-image-selinux*
systems in permissive mode.  Remove the call to allow permissive booting.

[YOCTO #7506]

Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
2016-10-27 10:51:41 -04:00
Shrikant Bobade
ad8800c114 eudev: add wildcard version
eudev version at poky updated to v3.2 from v3.1.5, so moving it to use
wildcard in order to fix the parsing error.

Signed-off-by: Shrikant Bobade <shrikant_bobade@mentor.com>
Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
2016-06-16 10:33:18 -04:00
Philip Tricca
1df7cefdbf udev: Rename udev bbappend to eudev.
Required by switch to eudev in oe-core. Dropping PR since this is
effectively a new recipe.

Signed-off-by: Philip Tricca <flihp@twobit.us>
2016-03-06 19:59:11 +00:00
Wenzong Fan
614b7a78e7 initscripts: fix contexts for /etc/resolv.conf, adjtime
Restore contexts for /etc/{resolv.conf, adjtime}, they are created
dynamically and the incorrect contexts maybe prevent some programs
from valid accessing.

  /etc/resolv.conf: etc_t:SystemHigh -> etc_t:SystemLow
  /etc/adjtime:     etc_t:SystemHigh -> adjtime_t:SystemLow

Signed-off-by: Wenzong Fan <wenzong.fan@windriver.com>
Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
2015-08-07 16:11:54 -04:00
Wenzong Fan
77130536eb udev: restorecon /run to allow mdadm creating /run/mdadm
This change bases on the factors during bootup:

a. the default type for /run is var_run_t;
b. the type for /run will be changed to tmpfs_t after tmpfs mounted;
c. the type for /run will be fixed after populate-volatile.sh run.

udev service is started in b->c period, fix the type for /run from
udev init script to remove:

  avc: denied { write } for pid=294 comm="mdadm" \
  name="/" dev="tmpfs" ino=10581 \
  scontext=system_u:system_r:mdadm_t:s0-s15:c0.c1023 \
  tcontext=system_u:object_r:tmpfs_t:s0 tclass=dir

Signed-off-by: Wenzong Fan <wenzong.fan@windriver.com>
Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
2015-08-07 15:17:52 -04:00
Philip Tricca
0fb5f698ff coreutils: Use wildcard for version and remove PR.
Signed-off-by: Philip Tricca <flihp@twobit.us>
Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
2015-02-10 13:41:57 -05:00
Wenzong Fan
b20a26e14b systemd: fix dependencies for audit, selinux
Signed-off-by: Wenzong Fan <wenzong.fan@windriver.com>
Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
2015-01-12 11:51:56 -05:00
Wenzong Fan
073ce40add initscripts/devpts.sh: fix context for /dev/pts
devpts use file_use_trans to allocate security contexts. As there are no
range_trans rules for initrc_t mounting devpts, the security level of
mountpoint will be derived from the initrc process, to be systemhigh
(s15:c0.c1023), instead of expected systemlow(s0).

This will block login shells to search PTYs, so use restorecon to fix
this.

Signed-off-by: Wenzong Fan <wenzong.fan@windriver.com>
Signed-off-by: Xin Ouyang <xin.ouyang@windriver.com>
2014-06-23 11:48:36 +08:00
Wenzong Fan
f48a8184d0 initscripts: add a local copy of devpts.sh
Start point to make SELinux specific changes in devpts.sh, copied from
oe-core layer.

Signed-off-by: Wenzong Fan <wenzong.fan@windriver.com>
Signed-off-by: Xin Ouyang <xin.ouyang@windriver.com>
2014-06-23 11:48:16 +08:00
Xin Ouyang
4d27a65186 util-linux: Use wildcard for version number in bbappend.
Signed-off-by: Xin Ouyang <xin.ouyang@windriver.com>
2014-05-16 18:02:20 +08:00
Xin Ouyang
b18a8332b6 glib-2.0: Use wildcard for version number in bbappend.
Signed-off-by: Xin Ouyang <xin.ouyang@windriver.com>
2014-05-16 18:01:58 +08:00
Xin Ouyang
cd7a45f733 dbus: Use wildcard for version number in bbappend.
Signed-off-by: Xin Ouyang <xin.ouyang@windriver.com>
2014-05-16 18:01:33 +08:00
Jackie Huang
368f65a475 initscripts/checkroot.sh: restore file contexts for /run
The file contexts for /run is incorrect while running checkroot.sh
in boot time which causes mount fail to create new dir and file
in /run, so restore the security contexts in it.

Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
Signed-off-by: Joe MacDonald <joe@deserted.net>
2014-05-09 08:59:54 -04:00
Wenzong Fan
bd3fb8a5cd udev init: restorecon for /dev/shm, /dev/pts
Signed-off-by: Wenzong Fan <wenzong.fan@windriver.com>
Signed-off-by: Joe MacDonald <joe@deserted.net>
2014-04-24 19:53:52 -04:00
Wenzong Fan
5596ca6e0e initscripts: always force to restore file contexts for /var/lib
Signed-off-by: Wenzong Fan <wenzong.fan@windriver.com>
Signed-off-by: Joe MacDonald <joe@deserted.net>
2014-04-24 19:53:41 -04:00
Philip Tricca
05a0c6c2d1 libcgroup: Use wildcard for version number in libcgroup bbappend.
Signed-off-by: Philip Tricca <flihp@twobit.us>

 create mode 100644 recipes-core/libcgroup/libcgroup_%.bbappend
 delete mode 100644 recipes-core/libcgroup/libcgroup_0.38.bbappend
Signed-off-by: Joe MacDonald <joe@deserted.net>
2014-02-12 19:15:32 -05:00
Philip Tricca
0e1d77dcc3 busybox: Use wildcard for version number in busybox bbappend.
Signed-off-by: Philip Tricca <flihp@twobit.us>

 create mode 100644 recipes-core/busybox/busybox_%.bbappend
 delete mode 100644 recipes-core/busybox/busybox_1.21.1.bbappend
Signed-off-by: Joe MacDonald <joe@deserted.net>
2014-02-12 19:15:31 -05:00
Wenzong Fan
3dc49f04c0 udev/init: sync to latest poky version ae819671
Sync with the latest init file from poky as of 01262014:

    oe-core commit: ae819671489a22bfdda11210ff620f564aa9b24b

Signed-off-by: Wenzong Fan <wenzong.fan@windriver.com>
2014-01-26 17:43:13 +08:00
Jackie Huang
5a36af9f91 udev: remove explicit path to udevadm
Oe-core has chnaged the udevadm path, current path will causes failure:
udevd[102]: starting version 182
/etc/rcS.d/S04udev: line 106: /usr/bin/udevadm: No such file or directory

Fix as oe-core commit: cc0f22cd1e93cc25647add1a3339e150572e4fce

Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
Signed-off-by: Xin Ouyang <xin.ouyang@windriver.com>
2014-01-23 18:00:08 +08:00
Mark Hatle
7cc4ee6c83 Resync to oe-core master Jan 10, 2014
Rename most recipes

Update a few recipes as needed:
* tar: Newer version has xattr and selinux support

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2014-01-10 13:55:59 -06:00
Philip Tricca
83081d1fdc glib-2.0: rename bbappend from 2.38.0 to 2.38.1
Signed-off-by: Philip Tricca <flihp@twobit.us>
Signed-off-by: Joe MacDonald <joe@deserted.net>
2013-12-04 10:16:51 -05:00
Philip Tricca
ec09d839f9 glib-2.0: upgrade from version 2.36.4 to 2.38.0
Signed-off-by: Joe MacDonald <joe@deserted.net>
2013-10-21 15:43:34 -04:00
Xin Ouyang
521ca9c9cf busybox: alternatives link to sh wrappers for commands
While directly using busybox[.[no]suid] as the alternatives'
targets, commands could not get correct security labels.

 ~# ls -l /sbin/getty
 ..... /sbin/getty -> /bin/busybox.nosuid
 ~# ls -Z /bin/busybox.nosuid
 system_u:object_r:bin_t:s0 /bin/busybox.nosuid

Add sh wrappers for commands so selinux could work fine.

 ~# ls -l /sbin/getty
 ..... /sbin/getty -> /usr/lib/busybox/sbin/getty
 ~# ls -Z /usr/lib/busybox/sbin/getty
 system_u:object_r:getty_exec_t:s0 /usr/lib/busybox/sbin/getty
 ~# cat /usr/lib/busybox/sbin/getty
 #!/bin/busybox.nosuid

Signed-off-by: Xin Ouyang <Xin.Ouyang@windriver.com>
Signed-off-by: Joe MacDonald <joe@deserted.net>
2013-10-02 13:24:45 -04:00
Joe MacDonald
c7fc09794c udev/init: work around dev-cache restore problems
Restoring from the dev-cache with selinux enforcing causes various
failures as devices are lacking, at a minimum, reasonable types and
attributes.  If, on the other hand, we at least create the cache with
selinux and xattrs preserved and restored, we get significantly fewer
errors and warnings on boot and we can successfully restore the context
further down in init anyway.  It still leaves some devices mislabeled,
though, and still produces warnings on boot.

Previous versions of the initscript removed all use of the dev-cache,
if need be, we fall back to that.  It is possible to get the middle-ground
behaviour by defining use_udev_cache at the top of the udev initscript.

Signed-off-by: Joe MacDonald <joe@deserted.net>
2013-10-02 13:24:45 -04:00
Mark Hatle
a43e03a87c udev/init: sync to latest poky version
[ CQID: WIND00424385 ]

Sync with the latest init file from poky as of 09172013.  Changes include:

	- adding /sbin/restorecon on start
	- specifying full path for /sbin/udevadm

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Joe MacDonald <joe@deserted.net>
2013-10-02 13:24:45 -04:00
Xin Ouyang
c1dc285800 always force to restore file contexts in initscripts
In policycoreutils-2.13+, restorecon changes its default behaviour,
and does not restore context if the file' type is correct, even its
mcs/mls level is incorrect.
We should force it always to restore file contexts in initscripts to
avoid issues.

Signed-off-by: Xin Ouyang <Xin.Ouyang@windriver.com>
Signed-off-by: Joe MacDonald <joe@deserted.net>
2013-10-02 13:24:44 -04:00
Xin Ouyang
c12d8f5c52 util-linux: uprev to oe-core version 2.23.2
Signed-off-by: Xin Ouyang <Xin.Ouyang@windriver.com>
2013-08-22 13:00:26 +08:00
Xin Ouyang
4e84186b90 glib-2.0: uprev to oe-core version 2.36.4
Signed-off-by: Xin Ouyang <Xin.Ouyang@windriver.com>
2013-08-22 12:59:06 +08:00
Mark Hatle
a530caf828 dbus/glib-2.0/augeas/mesa: Rebase bbappends to oe-core 20130801
Rebase the bbappends to match the current oe-core versions.

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2013-08-02 00:08:14 +00:00