Red Hat Bugzilla – Bug 1280456
setup-ds should detect if port is already defined
Last modified: 2016-11-03 16:37:47 EDT
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
RHEL 7.3 x86_64 Server
[root@org47 ~]# rpm -qa | grep 389-ds-base
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 : 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 firstname.lastname@example.org'. 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
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.