diff mbox series

[6/6] refpolicy-targeted: allow ssh_sysadm_login by default

Message ID 20261116025714.2558951-1-chenqi_hycx@cetc.com.cn
State New
Headers show
Series meta-selinux: fix systemd 262 denials and ensure SELinux tests work on every variant | expand

Commit Message

Chen Qi Nov. 16, 2026, 2:57 a.m. UTC
From: Chen Qi <chenqi_hycx@cetc.com.cn>

The targeted repolicy is a looser policy than standard/mcs/mls
variants. What surprises users is that a looser repolicy does not
allow ssh login while the sticter ones do.

This is because Yocto's targeted policy is making users land in
unconfined_u selinux user by default, and unconfined_u is treated
as privileged user, thus being forbidden by default as the default
value of ssh_sysadm_login is false.

Change to enable ssh_sysadm_login for targeted thus minimal by
default.

Signed-off-by: Chen Qi <chenqi_hycx@cetc.com.cn>
---
 recipes-security/refpolicy/refpolicy-targeted_git.bb | 2 ++
 1 file changed, 2 insertions(+)

Comments

Clayton Casciato Nov. 16, 2026, 2:49 p.m. UTC | #1
Hi, Qi

> The targeted repolicy is a looser policy than standard/mcs/mls

Nit: repolicy -> refpolicy

> variants. What surprises users is that a looser repolicy does not 

Nit: repolicy -> refpolicy

Yes, this surprised me: https://github.com/SELinuxProject/refpolicy/pull/914

> allow ssh login while the sticter ones do. 

Nit: sticter -> stricter

>@
> This is because Yocto's targeted policy is making users land in
> unconfined_u selinux user by default, and unconfined_u is treated
> as privileged user, thus being forbidden by default as the default
> value of ssh_sysadm_login is false.

A Yocto mechanism could be added to map users; I do this in a private
layer.

>@
> Change to enable ssh_sysadm_login for targeted thus minimal by
> default.
>@

I don't think ssh_sysadm_login should be enabled by default, given:
* RefPolicy upstream doesn't do so (secure by default)
* Yocto generally doesn't do so [1] 

What are your thoughts on adding a configuration fragment instead,
similar to [1]?

[1] https://docs.yoctoproject.org/security-manual/securing-images.html#considerations-specific-to-the-openembedded-build-system

Thanks!

Clayton Casciato
diff mbox series

Patch

diff --git a/recipes-security/refpolicy/refpolicy-targeted_git.bb b/recipes-security/refpolicy/refpolicy-targeted_git.bb
index b4bec46..32457f1 100644
--- a/recipes-security/refpolicy/refpolicy-targeted_git.bb
+++ b/recipes-security/refpolicy/refpolicy-targeted_git.bb
@@ -15,3 +15,5 @@  SRC_URI += " \
         file://0001-refpolicy-targeted-Revert-users-Move-unconfined_u-definition-to-unconfi.patch \
         file://0002-refpolicy-targeted-make-unconfined_u-the-default-sel.patch \
         "
+
+POLICY_BOOLEANS ?= "ssh_sysadm_login=true"