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-policyAssignee: Zdenek Pytela <zpytela>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: high    
Version: 44CC: 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
since lastest updates, ssh agent forwarding is broken, blocked by SELinux

ssh client shows:

debug1: Remote: Agent forwarding disabled: couldn't create listener socket




Reproducible: Always

Steps to Reproduce:
1.configure ForwardAgent yes
2.connect to Fedora Rawhide system
3.check forwarded ssh keys with: ssh-add -l
Actual Results:
no keys

Expected Results:
keys visible

Additional Information:
openssh-10.4p1-2.fc45.x86_64
selinux-policy-targeted-45.9-1.fc45.noarch


works if selinux is set to permissive

cat /var/log/audit/audit.log| audit2allow


#============= logwatch_t ==============
allow logwatch_t syslogd_var_run_t:dir read;

#============= sshd_session_t ==============
allow sshd_session_t afs3_callback_port_t:tcp_socket name_bind;
allow sshd_session_t afs_pt_port_t:tcp_socket name_bind;
allow sshd_session_t couchdb_port_t:tcp_socket name_bind;
allow sshd_session_t cyphesis_port_t:tcp_socket name_bind;
allow sshd_session_t gatekeeper_port_t:tcp_socket name_bind;
allow sshd_session_t geneve_port_t:tcp_socket name_bind;
allow sshd_session_t ircd_port_t:tcp_socket name_bind;
allow sshd_session_t mpd_port_t:tcp_socket name_bind;
allow sshd_session_t mythtv_port_t:tcp_socket name_bind;
allow sshd_session_t openflow_port_t:tcp_socket name_bind;
allow sshd_session_t openvswitch_port_t:tcp_socket name_bind;
allow sshd_session_t ovsdb_port_t:tcp_socket name_bind;
allow sshd_session_t redis_port_t:tcp_socket name_bind;
allow sshd_session_t repository_port_t:tcp_socket name_bind;
allow sshd_session_t sge_port_t:tcp_socket name_bind;
allow sshd_session_t ssh_home_t:sock_file create;
allow sshd_session_t swift_port_t:tcp_socket name_bind;
allow sshd_session_t syslog_tls_port_t:tcp_socket name_bind;
allow sshd_session_t tor_port_t:tcp_socket name_bind;

#!!!! This avc can be allowed using the boolean 'nis_enabled'
allow sshd_session_t unreserved_port_t:tcp_socket name_bind;
allow sshd_session_t varnishd_port_t:tcp_socket name_bind;
allow sshd_session_t xodbc_connect_port_t:tcp_socket name_bind;
allow sshd_session_t xserver_port_t:tcp_socket name_bind;

Comment 1 Orion Poplawski 2026-07-19 23:42:10 UTC
same here. re-assigning to selinux-policy to loop them in.

Comment 2 Dmitry Belyavskiy 2026-07-20 07:21:10 UTC
In rawhide we had removed the support of abstract sockets because of CVE-2026-55655 but I'm not sure that's the case

Comment 3 Barry Scott 2026-07-21 08:43:17 UTC
*** Bug 2503144 has been marked as a duplicate of this bug. ***

Comment 4 Henryk Paluch (Work) 2026-07-26 09:49:36 UTC
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

Comment 5 Peter Bieringer 2026-08-02 05:49:47 UTC
(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

Comment 6 Henryk Paluch (Work) 2026-08-05 06:03:50 UTC
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;

Comment 7 Aoife Moloney 2026-08-17 15:22:31 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 45 development cycle.
Changing version to 45.

Comment 8 Travis Suel 2026-08-26 06:44:19 UTC
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

Comment 9 Orion Poplawski 2026-08-26 23:30:34 UTC
What is needed to drive this forward? Does this need to get fixed in openssh or selinux-policy?

Comment 10 Fedora Update System 2026-08-27 21:53:27 UTC
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

Comment 11 Fedora Update System 2026-08-28 02:01:06 UTC
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.

Comment 12 Peter Bieringer 2026-08-28 05:41:10 UTC
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!

Comment 13 Andras Simon 2026-08-28 20:02:37 UTC
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!)

Comment 14 Brian J. Murrell 2026-08-29 13:43:11 UTC
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?

Comment 15 Peter Bieringer 2026-08-29 14:49:48 UTC
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.

Comment 16 ultrafilter 2026-08-30 08:39:03 UTC
(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.

Comment 17 Peter Bieringer 2026-08-31 05:06:02 UTC
I filed a dedicated bug for the port forwarding issue https://bugzilla.redhat.com/show_bug.cgi?id=2526123

Comment 18 Fedora Update System 2026-08-31 17:18:51 UTC
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.

Comment 19 Peter Bieringer 2026-10-24 06:00:51 UTC
issue is returning with selinux-policy-45.22, see https://bugzilla.redhat.com/show_bug.cgi?id=2560255

Comment 20 MarcH 2026-10-25 18:51:18 UTC
> 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.

Comment 21 Zdenek Pytela 2026-11-10 13:34:54 UTC
(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.

Comment 22 Dustin C. Hatch 2026-11-24 02:31:39 UTC
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

Comment 23 ultrafilter 2026-11-24 14:09:45 UTC
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 };

Comment 24 ultrafilter 2026-11-29 14:59:25 UTC
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

Comment 25 Bernie Hoefer 2026-11-30 13:26:48 UTC
(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.

Comment 26 ultrafilter 2026-11-30 13:57:11 UTC
(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!