Bug 464312
Summary: | sshd configured to allow port forwarding, but SELinux policy blocks it | ||
---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Ed Avis <ed> |
Component: | selinux-policy | Assignee: | Daniel Walsh <dwalsh> |
Status: | CLOSED CURRENTRELEASE | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | 9 | CC: | dwalsh, mgrepl, rvokal, zenczykowski |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2009-06-10 08:21:06 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
Ed Avis
2008-09-27 18:44:28 UTC
Ok, Fixedin selinux-policy-3.3.1-97.fc9 Will allow it to bind to all ports > 1024 I think all ports >= 1024 would be better (the well-known ports are from 0 to 1023 inclusive). Well that is what I meant, and I have a math degree :^( The new policy doesn't appear to fix the entirety of the problem. Client machine (also fc9 box): $ ssh -tax -R 24800:localhost:24800 zeus "blah blah" Server machine (kernel from koji): $ uname -a Linux zeus.lan 2.6.26.7-86.fc9.x86_64 #1 SMP Wed Oct 22 22:54:13 EDT 2008 x86_64 x86_64 x86_64 GNU/Linux $ rpm -qa | egrep 'selinux-policy|openssh' | sort openssh-5.1p1-2.fc9.x86_64 openssh-askpass-5.1p1-2.fc9.x86_64 openssh-clients-5.1p1-2.fc9.x86_64 openssh-server-5.1p1-2.fc9.x86_64 selinux-policy-3.3.1-99.fc9.noarch selinux-policy-devel-3.3.1-99.fc9.noarch selinux-policy-targeted-3.3.1-99.fc9.noarch $ sudo tail /var/log/messages ...nothing relevant (from audit or otherwise)... $ sudo tail /var/log/secure ... Oct 29 01:34:09 zeus sshd[2163]: Accepted publickey for maze from 192.168.1.9 port 43488 ssh2 Oct 29 01:34:09 zeus sshd[2163]: pam_unix(sshd:session): session opened for user maze by (uid=0) Oct 29 01:34:09 zeus sshd[2166]: error: bind: Permission denied Oct 29 01:34:09 zeus sshd[2166]: error: channel_setup_fwd_listener: cannot listen to port: 24800 Oct 29 01:59:37 zeus sshd[32736]: pam_unix(sshd:session): session closed for user maze ... (1616 is the main sshd process) # strace -s 512 -p 1616 -ff 2>&1 | egrep -C2 24800 [pid 3075] close(8) = 0 [pid 3075] socket(PF_INET6, SOCK_DGRAM, IPPROTO_IP) = 8 [pid 3075] connect(8, {sa_family=AF_INET6, sin6_port=htons(24800), inet_pton(AF_INET6, "::1", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = 0 [pid 3075] getsockname(8, {sa_family=AF_INET6, sin6_port=htons(36551), inet_pton(AF_INET6, "::1", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, [8589934620]) = 0 [pid 3075] connect(8, {sa_family=AF_UNSPEC, sa_data="\0\0\0\0\0\0\0\0\0\0\0\0\0\0"}, 16) = 0 [pid 3075] connect(8, {sa_family=AF_INET, sin_port=htons(24800), sin_addr=inet_addr("127.0.0.1")}, 16) = 0 [pid 3075] getsockname(8, {sa_family=AF_INET6, sin6_port=htons(41358), inet_pton(AF_INET6, "::ffff:127.0.0.1", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, [8 589934620]) = 0 [pid 3075] close(8) = 0 [pid 3075] socket(PF_INET6, SOCK_STREAM, IPPROTO_TCP) = 8 [pid 3075] setsockopt(8, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 [pid 3075] bind(8, {sa_family=AF_INET6, sin6_port=htons(24800), inet_pton(AF_INET6, "::1", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = -1 EACCES (Permi ssion denied) [pid 3075] close(8) = 0 [pid 3075] socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 8 [pid 3075] setsockopt(8, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 [pid 3075] bind(8, {sa_family=AF_INET, sin_port=htons(24800), sin_addr=inet_addr("127.0.0.1")}, 16) = -1 EACCES (Permission denied) [pid 3075] sendto(4, "<83>Oct 29 02:23:05 sshd[3075]: error: bind: Permission denied", 62, MSG_NOSIGNAL, NULL, 0) = 62 [pid 3075] close(4) = 0 -- [pid 3075] fcntl(4, F_SETFD, FD_CLOEXEC) = 0 [pid 3075] connect(4, {sa_family=AF_FILE, path="/dev/log"}, 110) = 0 [pid 3075] sendto(4, "<83>Oct 29 02:23:05 sshd[3075]: error: channel_setup_fwd_listener: cannot listen to port: 24800", 95, MSG_NOSIGNAL, NULL, 0) = 95 [pid 3075] close(4) = 0 [pid 3075] write(3, "e\f:>\331l\375\253\210\32\357\315\311\330\312l\302z\244\270\r\303\202\213\254l[\323\274Hp\245", 32) = 32 ^C No idea, why it's opening the port for what is apparently first UDP. The port in question is not used by any other process in the system (lsof -i -n doesn't list it) and other ports have the same problem, ssh -R from server to client also doesn't work, so the problem is not specific to that one machine. Hmm, interesting, while zeus doesn't log any audit messages (and audit is running), the client machine (on the reverse ssh -R test) does log the following (running with the same selinux-policy version). kernel: type=1400 audit(1225271310.797:10): avc: denied { name_bind } for pid=5103 comm="sshd" src=24800 scontext=system_u:system_r:sshd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:port_t:s0 tclass=tcp_socket not quite sure what's happening, however: [root@zeus ~]# semanage port -a -t ssh_port_t -p tcp 24800 has 'fixed' the issue, so it was still apparently selinux, not sure why it wasn't getting logged though (and there are _other_ messages from auditd in /var/log/messages). Fixed in selinux-policy-3.3.1-105.fc9 Installed new packages from koji on both machines and ran: [root@zeus ~]# semanage port -d -t ssh_port_t -p tcp 24800 Have not rebooted yet, but port forwarding appears to work correctly now. This message is a reminder that Fedora 9 is nearing its end of life. Approximately 30 (thirty) days from now Fedora will stop maintaining and issuing updates for Fedora 9. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as WONTFIX if it remains open with a Fedora 'version' of '9'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version prior to Fedora 9's end of life. Bug Reporter: Thank you for reporting this issue and we are sorry that we may not be able to fix it before Fedora 9 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora please change the 'version' of this bug to the applicable version. If you are unable to change the version, please add a comment here and someone will do it for you. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete. The process we are following is described here: http://fedoraproject.org/wiki/BugZappers/HouseKeeping |