Bug 1647621

Summary: Xorg listening on port 6000 by default in 7.6
Product: Red Hat Enterprise Linux 7 Reporter: Joe Wright <jwright>
Component: gdmAssignee: Ray Strode [halfline] <rstrode>
Status: CLOSED ERRATA QA Contact: Desktop QE <desktop-qa-list>
Severity: high Docs Contact:
Priority: high    
Version: 7.6CC: aaron.marshall.ctr, amike, andreas.schiermeier, ayadav, cpippin, cww, dhill, infra, jualvare, mabrown, mboisver, mclasen, paddor, rstrode, sea.laszlo, toneata, tpelka, vchoudha, website
Target Milestone: rcKeywords: Regression, Reopened, ZStream
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: 7.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1650564 1658464 (view as bug list) Environment:
Last Closed: 2019-08-06 12:37:49 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1650564, 1658464    
Attachments:
Description Flags
configure: don't assume x server defaults to local only none

Description Joe Wright 2018-11-07 22:46:19 UTC
Description of problem:
- X server is listening on TCP port 6000 by default, and should not be listening at all unless explicitly configured to do so

Version-Release number of selected component (if applicable):
- xorg-x11-server-Xorg-1.20.1-5.1.el7.x86_64

How reproducible:
- 100%

Steps to Reproduce:
1. Build a 7.6 system with the full graphical environment
2. set default boot to graphical.target
3. inspect listening ports

Actual results:
- Xorg listening on tcp 6000 by default

Expected results:
- Xorg should be compiled with nolisten tcp by default

Additional info:
------------------------------------------
Release:          Red Hat Enterprise Linux Server release 7.6 (Maipo)
Kernel:           3.10.0-957.el7.x86_64
------------------------------------------
 
[root@localhost ~]# netstat -tunap | grep X
tcp        0      0 0.0.0.0:6000            0.0.0.0:*               LISTEN      3815/X              
tcp6       0      0 :::6000                 :::*                    LISTEN      3815/X              
[root@localhost ~]# ps aux | grep X
root      3815  0.3  1.3 282188 24628 tty1     Ssl+ 17:37   0:00 /usr/bin/X :0 -background none -noreset -audit 4 -verbose -auth /run/gdm/auth-for-gdm-nHWVoX/database -seat seat0 vt1
root     14191  0.0  0.0 112708   968 pts/0    R+   17:40   0:00 grep --color=auto X
[root@localhost ~]# rpm -qa | grep Xorg
xorg-x11-server-Xorg-1.20.1-5.1.el7.x86_64

Comment 3 Adam Jackson 2018-11-08 15:48:56 UTC
This is not a regression, RHEL7's X server has always listened to TCP by default. I wouldn't necessarily call that "intentional" - more just what upstream happened to have as the default when 7.0 was released - but since it's what we started RHEL7 with it's what we have to keep doing. Upstream changed the default in xserver 1.17, at which point (RHEL 7.2 rebase) we explicitly started configuring the X server the other way.

RHEL8 won't have this issue.

Comment 4 Ray Strode [halfline] 2018-11-08 17:04:24 UTC
X has always listened to TCP by default, but GDM has always overriden it to not do that.

in 7.6 GDM no longer does that overriding because of this code:

if $PKG_CONFIG --atleast-version=1.17 xorg-server; then•
   AC_DEFINE([HAVE_XSERVER_THAT_DEFAULTS_TO_LOCAL_ONLY], [], [XServer disables tcp access by default])•
fi•

server is great than 1.17 now, but it it doesn't default to local only.  so the the define is incorrect.

we should patch it to force local only false, so gdm can disable it explicitly.

Comment 5 David Hill 2018-12-03 17:31:37 UTC
Please see https://bugzilla.redhat.com/show_bug.cgi?id=1649511

Comment 6 David Hill 2018-12-03 17:37:49 UTC
The problem is not gdm listening on port 6000 but swift being configured to use port 6000 instead of another one and the solution is the following [1]:   

So in your /home/stack/undercloud.conf you want to have something like:
hieradata_override = /home/stack/hiera_override.yaml

And then in /home/stack/hiera_override.yaml you can add:
swift::storage::all::object_port: "6200"

(I tested this on OSP10 and it works okay)

https://bugzilla.redhat.com/show_bug.cgi?id=1649511#c5

Comment 7 Ray Strode [halfline] 2018-12-03 18:18:35 UTC
thanks for the insight.

two separate issues that need to be addressed I guess.

Comment 8 Ray Strode [halfline] 2018-12-03 19:05:09 UTC
Created attachment 1511066 [details]
configure: don't assume x server defaults to local only

it doesn't in rhel

Comment 9 Ray Strode [halfline] 2018-12-04 14:57:46 UTC
*** Bug 1656016 has been marked as a duplicate of this bug. ***

Comment 13 Patrik Wenger 2018-12-11 21:37:08 UTC
Any simple fix to make X stop from listening on 6000/tcp? When I set the setting to stop listening on TCP in /etc/gdm/custom.conf, it still listens on 0.0.0.0:6000 and ::1:6000, although a non-local nmap would tell me the port is filtered/closed. Bur `netstat -tlnp` doesn’t lie.

Comment 14 Ray Strode [halfline] 2018-12-11 21:39:53 UTC
The only supported workaround at this time is to use firewall rules.  A fix for this issue is currently being evaluated.

Comment 16 Joe Wright 2018-12-13 23:14:12 UTC
(In reply to Patrik Wenger from comment #13)
> Any simple fix to make X stop from listening on 6000/tcp? When I set the
> setting to stop listening on TCP in /etc/gdm/custom.conf, it still listens
> on 0.0.0.0:6000 and ::1:6000, although a non-local nmap would tell me the
> port is filtered/closed. Bur `netstat -tlnp` doesn’t lie.

Unfortunately the best bet currently is to make firewall rules to just block the port outright. By default, the firewall doesn't open ports on 6xxx, but you can set explicit block rules if you're not comfortable with the default.

Comment 17 Andrew Galford 2019-01-08 07:57:36 UTC
I found a solution its not pretty but it works replace the /usr/bin/X that is a link to /usr/bin/Xorg with a shell script of the following: 
#!/bin/bash
exec /usr/bin/Xorg "$@" -nolisten tcp
exit 0
Also make sure your have your permissions correct ls -aZl /usr/bin/X afterwards

Comment 21 Michael Boisvert 2019-05-07 19:16:52 UTC
Verified on gdm-3.28.2-15.el7.x86_64.

Comment 22 Laszlo Coleman 2019-06-03 15:13:46 UTC
I noticed that the workstations with 6000 and 60001 open had DisallowTCP set to false in my custom gdm file. I got the idea to remove this line from:
https://github.com/rapid7/metasploit-framework/blob/master/documentation/modules/auxiliary/scanner/x11/open_x11.md


vi /etc/gdm/custom.conf

Under the [security] area, remove: DisallowTCP=false

logout/reboot

nmap -p 6000 --script=x11-access <hostname>

***
PORT     STATE    SERVICE
6000/tcp filtered X11
***

A firewall rule might be a better solution, but this seems to appease ACAS.

Comment 24 errata-xmlrpc 2019-08-06 12:37:49 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:2044