mbox series

[v2,0/4] meta-selinux: fix systemd 262 denials and run the SELinux tests on every variant

Message ID 20261122061122.2042600-1-chenqi_hycx@cetc.com.cn
Headers show
Series meta-selinux: fix systemd 262 denials and run the SELinux tests on every variant | expand

Message

Chen Qi Nov. 22, 2026, 6:11 a.m. UTC
From: Chen Qi <chenqi_hycx@cetc.com.cn>

core-image-minimal on systemd 262 logged denials, and the oeqa cases
skipped instead of reporting them: they picked their behaviour from the
policy name rather than from the session's domain.

1 bumps refpolicy to c89bd1537 for the systemd 262 fixes and for the
shadow lock rework (upstream PR #1280).

2 runs `make bare` before do_compile, so a changed POLICY_BOOLEANS is
not defeated by stale generated files.

3 decides the cases from /proc/self/attr/current, and logs in as a
user_u test account where the session is unconfined.

4 adds a config fragment for ssh_sysadm_login rather than setting it in
the recipe, since turning it on admits sshd_t to every user domain and
should be the user's decision.  Enable it with
`OE_FRAGMENTS += "selinux/ssh-sysadm-login"` to test refpolicy-targeted,
where ssh root otherwise fails with "/bin/sh: Permission denied".

Tested with core-image-minimal on qemux86-64 and qemuarm64,
refpolicy-mcs 15 passed, refpolicy-targeted 14 passed 1 skipped, with
the refpolicy package in the image manifest checked each time.  All
five variants build: targeted, mcs, standard, mls and minimum.

changes in v2:
- upgrade refpolicy straight to c89bd1537: the shadow lock fix is
  upstream now, so no patch is carried for it
- set ssh_sysadm_login from an opt-in config fragment instead of from
  the recipe

Chen Qi (4):
  refpolicy: update to c89bd1537
  refpolicy_common: ensure we start from a clean state in do_compile
  oeqa: decide the SELinux cases on the domain, not the policy name
  conf/fragments: add a fragment to set ssh_sysadm_login

 conf/fragments/ssh-sysadm-login.conf          |  10 +
 lib/oeqa/runtime/cases/selinux.py             | 543 ++++++++++++++----
 ...main-used-for-login-program-to-conne.patch |  20 +-
 .../refpolicy/refpolicy_common.inc            |   1 +
 recipes-security/refpolicy/refpolicy_git.inc  |   2 +-
 5 files changed, 452 insertions(+), 124 deletions(-)
 create mode 100644 conf/fragments/ssh-sysadm-login.conf