Bug 1280456 - setup-ds should detect if port is already defined
setup-ds should detect if port is already defined
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: 389-ds-base (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: wibrown@redhat.com
Viktor Ashirov
Depends On:
  Show dependency treegraph
Reported: 2015-11-11 13:57 EST by Noriko Hosoi
Modified: 2016-11-03 16:37 EDT (History)
4 users (show)

See Also:
Fixed In Version: 389-ds-base-
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2016-11-03 16:37:47 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:2594 normal SHIPPED_LIVE Moderate: 389-ds-base security, bug fix, and enhancement update 2016-11-03 08:11:08 EDT

  None (edit)
Description Noriko Hosoi 2015-11-11 13:57:50 EST
When accidently trying to install ds with a port labeled already labeled as kubernetes_port_t the installation script spends a lot of time in repeating semanage (60 retries) and then the server started and failed to bind to the port.

The retry count has been reduced in a recent fix, but retrying makes no sense if it is known to fail again.
Also the error message should be logged not only in debug mode

Maybe when the port is specified a semanage -l could be run to see if the port can be labeled
Comment 2 Punit Kundal 2016-07-18 11:02:41 EDT
RHEL 7.3 x86_64 Server

DS builds:
[root@org47 ~]# rpm -qa | grep 389-ds-base

Steps Performed:
1. labelled port 3389 with ssh_port_t security context
[root@org47 ~]# semanage port -a -t ssh_port_t -p tcp 3389
2. Used the same port with setup-ds.pl for creating the server instance

[root@org47 ~]# setup-ds.pl
The standard directory server network port number is 389.  However, if
you are not logged as the superuser, or port 389 is in use, the
default value will be a random unused port number greater than 1024.
If you want to use port 389, make sure that you are logged in as the
superuser, that port 389 is not in use.
Directory server network port [389]: 3389
Instance creation failed with the following error:

Port 3389 already belongs to another selinux type.
 The command below will show you the current type that owns the port.
sudo /usr/sbin/ds_selinux_port_query 3389 ldap_port_t
 It is highly likely your server will fail to start ...
Process returned 256
[18/Sep/2016:19:56:21.825619286 +051800] createprlistensockets - PR_Bind() on All Interfaces port 3389 failed: Netscape Portable Runtime error -5966 (Access Denied.)
Could not start the directory server using command '/bin/systemctl start dirsrv@ds.service'.  The last line from the error log was '[18/Sep/2016:19:56:21.825619286 +051800] createprlistensockets - PR_Bind() on All Interfaces port 3389 failed: Netscape Portable Runtime error -5966 (Access Denied.)
'.  Error: Unknown error 256
Error: Could not create directory server instance 'ds'.
Exiting . . .
Log file is '/tmp/setupxsrnFG.log'

3. Checked the port type with ds_selinux_port_query

[root@org47 ~]# /usr/sbin/ds_selinux_port_query 3389 ldap_port_t
Port belongs to ssh_port_t

As can be seen above, the port type is displayed correctly
Comment 4 errata-xmlrpc 2016-11-03 16:37:47 EDT
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.


Note You need to log in before you can comment on or make changes to this bug.