Bug 1280456 - setup-ds should detect if port is already defined
Summary: setup-ds should detect if port is already defined
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: 389-ds-base
Version: 7.0
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: ---
Assignee: wibrown@redhat.com
QA Contact: Viktor Ashirov
Depends On:
TreeView+ depends on / blocked
Reported: 2015-11-11 18:57 UTC by Noriko Hosoi
Modified: 2020-09-13 21:35 UTC (History)
4 users (show)

Fixed In Version: 389-ds-base-
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2016-11-03 20:37:47 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Private Priority Status Summary Last Updated
Github 389ds 389-ds-base issues 1667 0 None None None 2020-09-13 21:35:12 UTC
Red Hat Product Errata RHSA-2016:2594 0 normal SHIPPED_LIVE Moderate: 389-ds-base security, bug fix, and enhancement update 2016-11-03 12:11:08 UTC

Description Noriko Hosoi 2015-11-11 18:57:50 UTC
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 15:02:41 UTC
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'.  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 20:37:47 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.


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