Bug 2584565

Summary: sshd_session_t denied read on home_root_t, breaking SSH agent forwarding
Product: [Fedora] Fedora Reporter: Vadym Chepkov <vchepkov>
Component: selinux-policyAssignee: Zdenek Pytela <zpytela>
Status: ASSIGNED --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 45CC: 50bda1cd2babf798, dbelyavs, dwalsh, lvrabec, mmalik, omosnacek, pkoncity, ramercer, thomas, ultrafilter, vchepkov, vmojzis, zpytela
Target Milestone: ---Flags: zpytela: needinfo? (dbelyavs)
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Vadym Chepkov 2026-11-25 23:23:01 UTC
Version: selinux-policy-45.24-1.fc45, openssh-server-10.6p1-1.fc45, enforcing
/home is a separate filesystem.

ssh -A to the host fails:
  Remote: Agent forwarding disabled: couldn't create listener socket

Journal:
  AVC avc: denied { read } for comm="sshd-session" name="/" dev="dm-2" ino=2
    scontext=system_u:system_r:sshd_session_t:s0-s0:c0.c1023
    tcontext=system_u:object_r:home_root_t:s0 tclass=dir permissive=0
  sshd-session: error: agent_listener_user: failed to create agent socket parent directory

~/.ssh/agent already exists (ssh_home_t). sshd_session_t appears to need read on
home_root_t dirs to traverse to ~/.ssh/agent.

Related: https://github.com/fedora-selinux/selinux-policy/issues/3384, bz2524485

Reproducible: Always

Steps to Reproduce:
1. Fedora 45, SELinux enforcing, /home on a separate filesystem.
2. Install selinux-policy-45.24-1.fc45 and openssh-server-10.6p1-1.fc45.
3. From a client with a loaded agent: ssh -A <host> 'echo $SSH_AUTH_SOCK'
Actual Results:
SSH_AUTH_SOCK is empty. Client (ssh -v) reports:
  Remote: Agent forwarding disabled: couldn't create listener socket

Server journal:
  AVC avc: denied { read } for comm="sshd-session" name="/" dev="dm-2" ino=2
    scontext=system_u:system_r:sshd_session_t:s0-s0:c0.c1023
    tcontext=system_u:object_r:home_root_t:s0 tclass=dir permissive=0
  sshd-session: error: agent_listener_user: failed to create agent socket parent directory


Expected Results:
Agent forwarding works; SSH_AUTH_SOCK points to a socket under ~/.ssh/agent/.

Additional Information:
~/.ssh/agent already exists, labeled ssh_home_t. sshd_session_t appears to need
read on home_root_t directories to traverse to ~/.ssh/agent.
Hosts on openssh-server 9.9 with the same setup are not affected.

Related: https://github.com/fedora-selinux/selinux-policy/issues/3384 (create on
ssh_home_t sock_file, fixed in 44.8), bz2524485.

Comment 1 Zdenek Pytela 2026-11-26 10:40:12 UTC
(In reply to Vadym Chepkov from comment #0)
> Additional Information:
> ~/.ssh/agent already exists, labeled ssh_home_t. sshd_session_t appears to
> need
> read on home_root_t directories to traverse to ~/.ssh/agent.
> Hosts on openssh-server 9.9 with the same setup are not affected.
Thanks for the report, either an effect of some new openssh version or specific configuration.

Fordirectory  traversing, the search permission which is allowed is sufficient.
I don't quite understand why it needs to read the content of /home.

Comment 2 Vadym Chepkov 2026-11-26 12:16:34 UTC
If this helps, this started to fail after upgrading from openssh-server-0:10.5p1-1.fc45.x86_64 to openssh-server-0:10.6p1-1.fc45.x86_64

Comment 3 Zdenek Pytela 2026-11-26 16:02:57 UTC
Thanks for the confirmation, I now read openssh changelog on regular basis, but I am usually unable to isolate parts which could possibly require selinux-policy change.

https://www.openssh.org/releasenotes.html

Comment 4 Radosław Stachowiak 2026-11-28 20:28:51 UTC
I was hit by this bug upon updating to openssh-server

As far as I see the root cause is openssh 10.6 added mkdir_path() in misc.c. 
agent_listener_user() in misc-agent.c calls it to make ~/.ssh/agent and checks before.
The function opens with openat(fd, dir, O_RDONLY|O_DIRECTORY).
O_RDONLY on a directory needs the SELinux "read" permission, not only
"search". 

10.5p1 do not have this function.

Workarounds (both as root, both have side effects!!): 
1. setsebool polyinstantiation_enabled on 
2. run:
echo "(allow sshd_session_t home_root_t (dir (read)))" > sshd_agent_home.cil
semodule -i sshd_agent_home.cil

Comment 5 ultrafilter 2026-11-30 13:56:24 UTC
Running

sudo setsebool -P polyinstantiation_enabled on

resolves the issue for me.

Comment 6 Vadym Chepkov 2026-11-30 14:52:33 UTC
This boolean enables way more then required though

Comment 7 Zdenek Pytela 2026-11-30 16:18:29 UTC
(In reply to Radosław Stachowiak from comment #4)
> As far as I see the root cause is openssh 10.6 added mkdir_path() in misc.c. 
> agent_listener_user() in misc-agent.c calls it to make ~/.ssh/agent and
> checks before.
> The function opens with openat(fd, dir, O_RDONLY|O_DIRECTORY).
> O_RDONLY on a directory needs the SELinux "read" permission, not only
> "search". 
> 
> 10.5p1 do not have this function.

Dmitri,

is the ability to read the content of /home necessary for sshd-session to function?