#50107 Interactive installer doesn't handle trailing whitespace
Closed: wontfix 5 years ago Opened 5 years ago by vashirov.

Issue Description

If I accidentally type space or tab at the end of one of the fields, installer doesn't detect it and fails with an exception.
Case 1: system's hostname:

root@server-f29 ds]# dscreate -v interactive
DEBUG: The 389 Directory Server Creation Tool
DEBUG: Inspired by works of: ITS, The University of Adelaide
DEBUG: Called with: Namespace(func=<function instance_create_interactive at 0x7f97ed94e510>, verbose=True)
INFO: Running setup with verbose
Install Directory Server (interactive mode)
===========================================

Enter system's hostname [server-f29.example.com]: server-f29.example.com

Use strict hostname verification (set to "no" if using GSSAPI behind a load balancer) [yes]: yes

Enter the instance name [server-f29]:

Enter port number [389]:

Create self-signed certificate database [yes]:

Enter secure port number [636]:

Enter Directory Manager DN [cn=Directory Manager]:

Enter the Directory Manager password:
Confirm the Directory Manager Password:

Enter the database suffix (or enter "none" to skip) [dc=server-f29,dc=example,dc=com ]:

Create sample entries in the suffix [no]: yes

Are you ready to install? [no]: yes
INFO:
Starting installation...
INFO: READY: Preparing installation for server-f29...
DEBUG: PASSED: using config settings 999999999
DEBUG: PASSED: user / group checking
DEBUG: [Errno -2] Name or service not known
Traceback (most recent call last):
  File "/usr/sbin/dscreate", line 76, in <module>
    result = args.func(inst, log, args)
  File "/usr/lib/python3.7/site-packages/lib389/cli_ctl/instance.py", line 62, in instance_create_interactive
    return sd.create_from_cli()
  File "/usr/lib/python3.7/site-packages/lib389/instance/setup.py", line 473, in create_from_cli
    self.create_from_args(general, slapd, backends, self.extra)
  File "/usr/lib/python3.7/site-packages/lib389/instance/setup.py", line 604, in create_from_args
    self._prepare_ds(general, slapd, backends)
  File "/usr/lib/python3.7/site-packages/lib389/instance/setup.py", line 524, in _prepare_ds
    assert_c(socket.gethostbyname(general['full_machine_name']), "Strict hostname check failed. Check your DNS records for %s" % general['full_machine_name'])
socket.gaierror: [Errno -2] Name or service not known
ERROR: Error: [Errno -2] Name or service not known

Case 2: database suffix

[root@server-f29 ds]# dscreate -v interactive 
DEBUG: The 389 Directory Server Creation Tool
DEBUG: Inspired by works of: ITS, The University of Adelaide
DEBUG: Called with: Namespace(func=<function instance_create_interactive at 0x7f6f17414598>, verbose=True)
INFO: Running setup with verbose
Install Directory Server (interactive mode)
===========================================

Enter system's hostname [server-f29.example.com]: 

Use strict hostname verification (set to "no" if using GSSAPI behind a load balancer) [yes]: 

Enter the instance name [server-f29]: 

Enter port number [389]: 

Create self-signed certificate database [yes]: 

Enter secure port number [636]: 

Enter Directory Manager DN [cn=Directory Manager]: 

Enter the Directory Manager password: 
Confirm the Directory Manager Password: 

Enter the database suffix (or enter "none" to skip) [dc=server-f29,dc=example,dc=com]: dc=example,dc=com 

Create sample entries in the suffix [no]: yes

Are you ready to install? [no]: yes
INFO: 
Starting installation...
INFO: READY: Preparing installation for server-f29...
DEBUG: PASSED: using config settings 999999999
DEBUG: PASSED: user / group checking
DEBUG: PASSED: Hostname strict checking
DEBUG: PASSED: prefix checking
INFO: dir (sys) : /etc/sysconfig
INFO: dir (priv): /root/.dirsrv
DEBUG: PASSED: instance checking
DEBUG: INFO: temp root password set to jdQhbI7YeBldZjUFLmWnEn7ImxAM!PlNZk0zP9smLN6rdrwM8U86QzF7q4fI*QfHg
DEBUG: PASSED: root user checking
DEBUG: PASSED: network avaliability checking
INFO: READY: Beginning installation for server-f29...
INFO: ACTION: creating /var/lib/dirsrv/slapd-server-f29/bak
INFO: ACTION: creating /etc/dirsrv/slapd-server-f29
INFO: ACTION: creating /etc/dirsrv/slapd-server-f29
INFO: ACTION: creating /var/lib/dirsrv/slapd-server-f29/db
INFO: ACTION: creating /var/lib/dirsrv/slapd-server-f29/ldif
INFO: ACTION: creating /var/lock/dirsrv/slapd-server-f29
INFO: ACTION: creating /var/log/dirsrv/slapd-server-f29
INFO: ACTION: creating /var/run/dirsrv
Created symlink /etc/systemd/system/multi-user.target.wants/dirsrv@server-f29.service → /usr/lib/systemd/system/dirsrv@.service.
INFO: ACTION: Creating certificate database is /etc/dirsrv/slapd-server-f29
INFO: ACTION: Creating dse.ldif
DEBUG: Allocate <class 'lib389.DirSrv'> with None
DEBUG: Allocate <class 'lib389.DirSrv'> with server-f29.example.com:389
INFO: Allocate <class 'lib389.DirSrv'> with server-f29.example.com:389
INFO: dir (sys) : /etc/sysconfig
INFO: dir (priv): /root/.dirsrv
INFO: List from /root/.dirsrv
INFO: list instance {'SERVER_ID': 'server-f29', 'server-id': 'server-f29', 'SERVER_DIR': '/usr/lib64', 'SERVERBIN_DIR': '/usr/sbin', 'CONFIG_DIR': '/etc/dirsrv/slapd-server-f29', 'INST_DIR': '/usr/lib64/dirsrv/slapd-server-f29', 'RUN_DIR': '/var/run/dirsrv', 'DS_ROOT': '', 'PRODUCT_NAME': 'slapd', 'hostname': b'server-f29.example.com', 'ldap-port': 389, 'ldap-secureport': None, 'root-dn': b'cn=Directory Manager', 'user-id': b'dirsrv', 'suffix': None, 'ldapi_enabled': None, 'ldapi_socket': None, 'ldapi_autobind': None}

DEBUG: nss cmd: /usr/bin/certutil -N -d /etc/dirsrv/slapd-server-f29 -f /etc/dirsrv/slapd-server-f29/pwdfile.txt
DEBUG: nss output: 
DEBUG: nss cmd: /usr/bin/certutil -L -n Self-Signed-CA -d /etc/dirsrv/ssca/
DEBUG: nss cmd: /usr/bin/certutil -R --keyUsage digitalSignature,nonRepudiation,keyEncipherment,dataEncipherment --nsCertType sslClient,sslServer --extKeyUsage clientAuth,serverAuth -s CN=server-f29.example.com,givenName=da5e06bd-4c72-4afa-bbdf-d39786252e6e,O=testing,L=389ds,ST=Queensland,C=AU -8 server-f29.example.com -g 4096 -d /etc/dirsrv/slapd-server-f29 -z /etc/dirsrv/slapd-server-f29/noise.txt -f /etc/dirsrv/slapd-server-f29/pwdfile.txt -a -o /etc/dirsrv/slapd-server-f29/Server-Cert.csr
DEBUG: nss cmd: /usr/bin/certutil -C -d /etc/dirsrv/ssca/ -f /etc/dirsrv/ssca//pwdfile.txt -v 24 -a -i /etc/dirsrv/slapd-server-f29/Server-Cert.csr -o /etc/dirsrv/slapd-server-f29/Server-Cert.crt -c Self-Signed-CA
DEBUG: nss cmd: /usr/bin/c_rehash /etc/dirsrv/slapd-server-f29
DEBUG: nss cmd: /usr/bin/certutil -A -n Self-Signed-CA -t CT,, -a -i /etc/dirsrv/slapd-server-f29/ca.crt -d /etc/dirsrv/slapd-server-f29 -f /etc/dirsrv/slapd-server-f29/pwdfile.txt
DEBUG: nss cmd: /usr/bin/certutil -A -n Server-Cert -t ,, -a -i /etc/dirsrv/slapd-server-f29/Server-Cert.crt -d /etc/dirsrv/slapd-server-f29 -f /etc/dirsrv/slapd-server-f29/pwdfile.txt
DEBUG: nss cmd: /usr/bin/certutil -V -d /etc/dirsrv/slapd-server-f29 -n Server-Cert -u YCV
Job for dirsrv@server-f29.service failed because the control process exited with error code.
See "systemctl status dirsrv@server-f29.service" and "journalctl -xe" for details.
DEBUG: Command '['/usr/bin/systemctl', 'start', 'dirsrv@server-f29']' returned non-zero exit status 1.
Traceback (most recent call last):
  File "/usr/sbin/dscreate", line 76, in <module>
    result = args.func(inst, log, args)
  File "/usr/lib/python3.7/site-packages/lib389/cli_ctl/instance.py", line 62, in instance_create_interactive
    return sd.create_from_cli()
  File "/usr/lib/python3.7/site-packages/lib389/instance/setup.py", line 473, in create_from_cli
    self.create_from_args(general, slapd, backends, self.extra)
  File "/usr/lib/python3.7/site-packages/lib389/instance/setup.py", line 616, in create_from_args
    self._install_ds(general, slapd, backends)
  File "/usr/lib/python3.7/site-packages/lib389/instance/setup.py", line 833, in _install_ds
    ds_instance.start(timeout=60)
  File "/usr/lib/python3.7/site-packages/lib389/__init__.py", line 1211, in start
    "dirsrv@%s" % self.serverid])
  File "/usr/lib64/python3.7/subprocess.py", line 341, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/bin/systemctl', 'start', 'dirsrv@server-f29']' returned non-zero exit status 1.
ERROR: Error: Command '['/usr/bin/systemctl', 'start', 'dirsrv@server-f29']' returned non-zero exit status 1.

In the errors log:

        389-Directory/1.4.0.20.20181221gitecdf6d8df B2018.355.1228
        server-f29.example.com:389 (/etc/dirsrv/slapd-server-f29)

[21/Dec/2018:12:40:38.024058503 +0000] - ERR - NS7bitAttr - NS7bitAttr_Init - Invalid suffix: dc=example,dc=com 
[21/Dec/2018:12:40:38.028546407 +0000] - ERR - NS7bitAttr - NS7bitAttr_Init - Invalid plugin arguments - Invalid suffix list
[21/Dec/2018:12:40:38.032790612 +0000] - ERR - plugin_setup - Init function "NS7bitAttr_Init" for "7-bit check" plugin in library "libattr-unique-plugin" failed
[21/Dec/2018:12:40:38.041523289 +0000] - ERR - load_plugin_entry - Unable to load plugin "cn=7-bit check,cn=plugins,cn=config"

And because it's whitespace, it's really hard to spot why exactly this fails.

Package Version and Platform

389-ds-base-1.4.0.20-20181221gitecdf6d8df.fc29.x86_64

Steps to reproduce

  1. dscreate interactive
  2. Add whitespace to system's hostname or database suffix

Actual results

Installation fails, but it's really hard to spot why from the logs.

Expected results

dscreate should handle trailing whitespace for system's hostname and database suffix similar to how it handles instance name.


Metadata Update from @mreynolds:
- Custom field component adjusted to None
- Custom field origin adjusted to None
- Custom field reviewstatus adjusted to None
- Custom field type adjusted to None
- Custom field version adjusted to None

5 years ago

Metadata Update from @mreynolds:
- Issue assigned to mreynolds

5 years ago

Metadata Update from @mreynolds:
- Assignee reset
- Issue close_status updated to: fixed
- Issue status updated to: Closed (was: Open)

5 years ago

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This issue has been cloned to Github and is available here:
- https://github.com/389ds/389-ds-base/issues/3166

If you want to receive further updates on the issue, please navigate to the github issue
and click on subscribe button.

Thank you for understanding. We apologize for all inconvenience.

Metadata Update from @spichugi:
- Issue close_status updated to: wontfix (was: fixed)

3 years ago

Login to comment on this ticket.

Metadata