Bug 2502040
| Summary: | ssh agent forwarding blocked by selinux debug1: Remote: Agent forwarding disabled: couldn't create listener socket | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Peter Bieringer <pb> |
| Component: | selinux-policy | Assignee: | Zdenek Pytela <zpytela> |
| Status: | CLOSED ERRATA | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | high | Docs Contact: | |
| Priority: | high | ||
| Version: | 44 | CC: | barry, bhoefer, brian, crypto-team, dbelyavs, dwalsh, gyrfalcon, henryk.paluch, jjelen, lkundrak, lvrabec, Marc.Herbert+rhzilla, mattias.ellert, mmalik, omosnacek, orion, pkoncity, sjoerd, szajmi, thomas, tm, travis.bugzilla, ultrafilter, vmojzis, zpytela |
| Target Milestone: | --- | Flags: | fedora-admin-xmlrpc:
mirror+
|
| Target Release: | --- | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | selinux-policy-44.8-1.fc44 | Doc Type: | --- |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2026-08-31 17:18:51 UTC | 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
Peter Bieringer
2026-07-18 13:59:30 UTC
same here. re-assigning to selinux-policy to loop them in. In rawhide we had removed the support of abstract sockets because of CVE-2026-55655 but I'm not sure that's the case *** Bug 2503144 has been marked as a duplicate of this bug. *** On latest Rawhide - SSHd Server side I see these errors:
$ ssh-add -L
Could not open a connection to your authentication agent.
$ echo $SSH_AUTH_SOCK
( no output )
$ sudo journalctl -b -p 4 --no-pager _COMM=sshd-session
Jul 26 09:19:18 fedrh-min sshd-session[760]: error: unix_listener_tmp: bind "/home/ansible/.ssh/agent/s.nhjuFd45cs.sshd.9LxWLJLARg": Permission denied
$ sudo ausearch -ts boot -m avc
----
time->Sun Jul 26 09:19:18 2026
type=AVC msg=audit(1785050358.281:102): avc: denied { create } for pid=760 comm="sshd-session" name="s.nhjuFd45cs.sshd.9LxWLJLARg" scontext=system_u:system_r:sshd_session_t:s0-s0:c0.c1023 tcontext=system_u:object_r:ssh_home_t:s0 tclass=sock_file permissive=0
$ ls -lZR .ssh
.ssh:
total 8
drwx------. 2 ansible ansible system_u:object_r:ssh_home_t:s0 4096 Jul 26 09:14 agent
-rw-------. 1 ansible ansible unconfined_u:object_r:ssh_home_t:s0 95 Jul 26 09:14 authorized_keys
.ssh/agent:
total 0
$ rpm -qa | grep selinux-policy
selinux-policy-45.9-1.fc45.noarch
selinux-policy-targeted-45.9-1.fc45.noarch
Is it same problem?
Posted on: https://discussion.fedoraproject.org/t/rawhide-selinux-breaks-ssh-agent-forwarding/197693
(In reply to Henryk Paluch (Work) from comment #4) > $ sudo journalctl -b -p 4 --no-pager _COMM=sshd-session > > Jul 26 09:19:18 fedrh-min sshd-session[760]: error: unix_listener_tmp: bind > "/home/ansible/.ssh/agent/s.nhjuFd45cs.sshd.9LxWLJLARg": Permission denied > > Is it same problem? Yes, have same error message here: Aug 02 07:46:31 ***-fraw sshd-session[1256]: error: unix_listener_tmp: bind "/home/***/.ssh/agent/s.Q5AQc61eoE.sshd.lDUM0h5TgQ": Permission denied Confirmed that workaround (suggested in log messages) works ("ssh-add -L" correctly shows forwarded SSH keys):
ausearch -c 'sshd-session' --raw | audit2allow -M my-sshdsession
semodule -X 300 -i my-sshdsession.pp
Generated my-sshdsession.te contains:
================= cut here ===================
module my-sshdsession 1.0;
require {
type ssh_home_t;
type sshd_session_t;
type user_home_dir_t;
class dir create;
class sock_file create;
}
#============= sshd_session_t ==============
allow sshd_session_t ssh_home_t:sock_file create;
#!!!! This avc can be allowed using the boolean 'polyinstantiation_enabled'
allow sshd_session_t user_home_dir_t:dir create;
================= cut here ===================
It I understand it properly, this line is most important:
allow sshd_session_t ssh_home_t:sock_file create;
This bug appears to have been reported against 'rawhide' during the Fedora Linux 45 development cycle. Changing version to 45. This issue seems to have started breaking the OpenSSH server on Fedora 44 with selinux-policy-44.7-1.fc44. Both Agent and X11 forwarding are broken after upgrading. Downgrading to selinux-policy-44.6-1.fc44 fixes the problem.
/var/log/audit/audit.log is filled with:
type=AVC msg=audit(1787726304.089:232): avc: denied { create } for pid=2131 comm="sshd-session" name="s.EoUfz1MHyT.sshd.SUWK53FbDb" scontext=system_u:system_r:sshd_session_t:s0-s0:c0.c1023 tcontext=system_u:object_r:ssh_home_t:s0 tclass=sock_file permissive=0
What is needed to drive this forward? Does this need to get fixed in openssh or selinux-policy? FEDORA-2026-16b888c99f (selinux-policy-44.8-1.fc44) has been submitted as an update to Fedora 44. https://bodhi.fedoraproject.org/updates/FEDORA-2026-16b888c99f FEDORA-2026-16b888c99f has been pushed to the Fedora 44 testing repository. Soon you'll be able to install the update with the following command: `sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2026-16b888c99f` You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2026-16b888c99f See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates. F44: selinux-policy-44.8-1.fc44.noarch -> issue solved Rawhide: selinux-policy-45.15-1.fc46 found on https://koji.fedoraproject.org/koji/packageinfo?packageID=32 -> issue solved Thank you very much! With selinux-policy-44.8-1.f44 SSH local TCP forwarding (ssh -L) remains blocked by SELinux: sshd_session_t is denied name_connect to unreserved_port_t. setsebool nis_enabled on unblocks it. (Disclaimer: an AI was heavily used in identifying the problem, finding the above workaround, and formulating this comment. I'm practically just its agent. But I'll happily provide any further details!) Can I see if I understand what happened here? So the openssh packages in F44 were updated and some change in that update required SELinux policy changes in order to keep functioning as usual? But the openssh packages update was released without the corresponding selinux-policy package updates? How does that happen? How did the openssh package updates make it through QA without noticing this selinux-policy update requirement? Port (i.e. agent!) forwarding is a very basic function. How is there no QA coverage for that on openssh package updates? Just wondering what broke down in the process here and how we can avoid this kind of problem in the future. Or maybe I am completely misunderstanding the nature of the failure here? I reported this already over a month ago for rawhide (see 1st entry here), unfortunately it stayed unfixed in between until change on F44 suddenly brought this to a broader attention resulting in hurry-up actions. (In reply to Fedora Update System from comment #11) > FEDORA-2026-16b888c99f has been pushed to the Fedora 44 testing repository. > Soon you'll be able to install the update with the following command: > `sudo dnf upgrade --enablerepo=updates-testing --refresh > --advisory=FEDORA-2026-16b888c99f` > You can provide feedback for this update here: > https://bodhi.fedoraproject.org/updates/FEDORA-2026-16b888c99f > > See also https://fedoraproject.org/wiki/QA:Updates_Testing for more > information on how to test updates. Even with this update, VS Code remote development is still broken - I get sshd-session[pid]: error: connect to 127.0.0.1 port 38141 failed: Permission denied while trying to connect. I filed a dedicated bug for the port forwarding issue https://bugzilla.redhat.com/show_bug.cgi?id=2526123 FEDORA-2026-16b888c99f (selinux-policy-44.8-1.fc44) has been pushed to the Fedora 44 stable repository. If problem still persists, please make note of it in this bug report. issue is returning with selinux-policy-45.22, see https://bugzilla.redhat.com/show_bug.cgi?id=2560255 > How does that happen? How did the openssh package updates make it through QA without noticing this selinux-policy update requirement? Port (i.e. agent!) forwarding is a very basic function. How is there no QA coverage for that on openssh package updates? > Just wondering what broke down in the process here and how we can avoid this kind of problem in the future. In 2560255 I found that merely moving the RemoteForward unix socket to a subdirectory avoids the issue. So you can easily imagine that the number of variables and the corresponding combinatorial explosion make exhaustive test coverage a bit of a lost cause. And that is assuming that 1) the openssh test suite is good enough in the first place 2.1) there are enough Fedora resources to run it entirely on every new openssh+selinux combination 2.2 AND analyze the test results! For all these reasons, the final rounds of QA are generally performed by... users and regressions like these seem pretty common and normal to me. My 2 cents. (In reply to Peter Bieringer from comment #19) > issue is returning with selinux-policy-45.22, see > https://bugzilla.redhat.com/show_bug.cgi?id=2560255 This bug is because of a different problem, may have been introduced with newest openssh. Still doesn't work if ~/.ssh doesn't already exist:
type=AVC msg=audit(1795475680.909:29508): avc: denied { create } for pid=188885 comm="sshd-session" name=".ssh" scontext=system_u:system_r:sshd_session_t:s0-s0:c0.c1023 tcontext=system_u:object_r:user_home_dir_t:s0 tclass=dir permissive=0
I just broke for me on f45 after OpenSSH update to openssh-server-0:10.6p1-1.fc45.x86_64:
ssh-add -L
Could not open a connection to your authentication agent.
The following is a workaround:
sudo ausearch -c 'sshd-session' --raw | audit2allow -M my-sshdsession
sudo semodule -i my-sshdsession.pp
cat my-sshdsession.te
module my-sshdsession 1.0;
require {
type ephemeral_port_t;
type ssh_home_t;
type home_root_t;
type sshd_session_t;
class sock_file { create unlink };
class tcp_socket name_connect;
class dir read;
}
#============= sshd_session_t ==============
#!!!! This avc is allowed in the current policy
allow sshd_session_t ephemeral_port_t:tcp_socket name_connect;
#!!!! This avc can be allowed using the boolean 'polyinstantiation_enabled'
allow sshd_session_t home_root_t:dir read;
#!!!! This avc is allowed in the current policy
allow sshd_session_t ssh_home_t:sock_file { create unlink };
On Fedora 45 with selinux-policy-45.26-1.fc45 (enforcing, targeted), agent forwarding still fails after removing a local workaround module:
ssh-add -L
Could not open a connection to your authentication agent.
sshd-session logs:
sshd-session[2721]: error: mkdir_path: open("/home"): Permission denied
sshd-session[2721]: error: agent_listener_user: failed to create agent socket parent directory
The earlier sshd_session_t ssh_home_t:sock_file { create unlink } denial is fixed in this build, but creating the socket parent directory now fails one step earlier: sshd_session_t is denied home_root_t:dir access when walking /home to reach ~/.ssh/agent. That permission is only grantable via the polyinstantiation_enabled boolean (audit2allow: "This avc can be allowed using the boolean 'polyinstantiation_enabled'"), not by a plain allow rule.
Workaround that restores agent forwarding with no local module:
sudo setsebool -P polyinstantiation_enabled on
(In reply to ultrafilter from comment #24) === > The earlier sshd_session_t ssh_home_t:sock_file { create unlink } denial is > fixed in this build, but creating the socket parent directory now fails one > step earlier: sshd_session_t is denied home_root_t:dir access when walking > /home to reach ~/.ssh/agent. === Since this Bugzilla ticket was closed on 2026-08-31, I doubt your 2026-11-29 comment was seen by anybody who can help. Doing a search, I found: Bug 2584565 - sshd_session_t denied read on home_root_t, breaking SSH agent forwarding https://bugzilla.redhat.com/show_bug.cgi?id=2584565 ...which may apply to your latest problem. You may want to look that ticket over and, if you find it is the same problem, then add yourself to the CC list and/or make a comment in it. If that Bugzilla ticket does not match your current problem, then I would suggest opening a new Bugzilla ticket. (In reply to Bernie Hoefer from comment #25) > (In reply to ultrafilter from comment #24) > === > > The earlier sshd_session_t ssh_home_t:sock_file { create unlink } denial is > > fixed in this build, but creating the socket parent directory now fails one > > step earlier: sshd_session_t is denied home_root_t:dir access when walking > > /home to reach ~/.ssh/agent. > === > > Since this Bugzilla ticket was closed on 2026-08-31, I doubt your 2026-11-29 > comment was seen by anybody who can help. > > Doing a search, I found: > > Bug 2584565 - sshd_session_t denied read on home_root_t, breaking SSH > agent forwarding > https://bugzilla.redhat.com/show_bug.cgi?id=2584565 > > ...which may apply to your latest problem. You may want to look that ticket > over and, if you find it is the same problem, then add yourself to the CC > list and/or make a comment in it. If that Bugzilla ticket does not match > your current problem, then I would suggest opening a new Bugzilla ticket. Thank you for the tip! |