diff mbox series

[v2,4/4] conf/fragments: add a fragment to set ssh_sysadm_login

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

Commit Message

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

refpolicy-targeted makes root land in unconfined_u, and sshd_t needs
ssh_sysadm_login to transition there, so ssh root on a targeted image
fails with "/bin/sh: Permission denied" while the serial console works:

  avc: denied { transition } for comm="sshd-session"
       tcontext=unconfined_u:unconfined_r:unconfined_t

The boolean admits sshd_t to every user domain, so it stays off by
default: enable this fragment where root ssh is wanted.

Assisted-by: Codewhale:deepseek-v4-flash
Signed-off-by: Chen Qi <chenqi_hycx@cetc.com.cn>
---
 conf/fragments/ssh-sysadm-login.conf | 10 ++++++++++
 1 file changed, 10 insertions(+)
 create mode 100644 conf/fragments/ssh-sysadm-login.conf
diff mbox series

Patch

diff --git a/conf/fragments/ssh-sysadm-login.conf b/conf/fragments/ssh-sysadm-login.conf
new file mode 100644
index 0000000..6a1fdd1
--- /dev/null
+++ b/conf/fragments/ssh-sysadm-login.conf
@@ -0,0 +1,10 @@ 
+BB_CONF_FRAGMENT_SUMMARY = "Set ssh_sysadm_login, letting sshd_t reach the admin domains"
+BB_CONF_FRAGMENT_DESCRIPTION = "Turn on the ssh_sysadm_login policy boolean. \
+refpolicy-targeted puts root in unconfined_u, and sshd_t may only transition \
+there when the boolean is set, so without it `ssh root@<target>' fails with \
+'/bin/sh: Permission denied'. The boolean admits sshd_t to every user domain, \
+sysadm_r included, so it is off by default and this fragment is for images \
+that want root ssh."
+
+# The policy itself keeps the boolean off; this only sets the value.
+POLICY_BOOLEANS:append = " ssh_sysadm_login=true"