Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1748244

Summary: dscreate doesn't sanitize instance name
Product: Red Hat Enterprise Linux 8 Reporter: Viktor Ashirov <vashirov>
Component: 389-ds-baseAssignee: Simon Pichugin <spichugi>
Status: CLOSED ERRATA QA Contact: RHDS QE <ds-qe-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.1CC: mreynolds, nkinder, pasik, spichugi, tbordaz, vashirov
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: 8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 389-ds-1.4-8030020200605214214.618f7055 Doc Type: Bug Fix
Doc Text:
We should mention in our docs that the server identifier can not contain non-ascii characters or space, can not be longer than 80 symbols and it shouldn't be 'admin' as this identifier is reserved.
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-11-04 03:07:13 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:

Description Viktor Ashirov 2019-09-03 08:16:09 UTC
Description of problem:
Related to bz1748227, dscreate doesn't sanitize the instance name, it's possible to create an instance with non-ascii symbols in its name. The instance is successfully created, but fails to start.

Version-Release number of selected component (if applicable):
389-ds-base-1.4.1.3-6.module+el8.1.0+4112+7a518916.x86_64


How reproducible:
always

Steps to Reproduce:
1. dscreate create-template > test.inf
2. replace instance_name with the name containing emoji or any other non-ascii characters, for example Cyrillic. 
3. 

Actual results:
[root@server-rhel8 ds]# dscreate from-file test.inf

Starting installation...
Invalid unit name "dirsrv@лдап1" was escaped as "dirsrv@\xd0\xbb\xd0\xb4\xd0\xb0\xd0\xbf1" (maybe you should use systemd-escape?)
Created symlink /etc/systemd/system/multi-user.target.wants/dirsrv@\xd0\xbb\xd0\xb4\xd0\xb0\xd0\xbf1.service → /usr/lib/systemd/system/dirsrv@.service.
Invalid unit name "dirsrv@лдап1" was escaped as "dirsrv@\xd0\xbb\xd0\xb4\xd0\xb0\xd0\xbf1" (maybe you should use systemd-escape?)
Job for dirsrv@\xd0\xbb\xd0\xb4\xd0\xb0\xd0\xbf1.service failed because the control process exited with error code.
See "systemctl status "dirsrv@\\xd0\\xbb\\xd0\\xb4\\xd0\\xb0\\xd0\\xbf1.service"" and "journalctl -xe" for details.
Error: Command '['systemctl', 'start', 'dirsrv@лдап1']' returned non-zero exit status 1.
[root@server-rhel8 ds]# systemctl status "dirsrv@\\xd0\\xbb\\xd0\\xb4\\xd0\\xb0\\xd0\\xbf1.service"
● dirsrv@\xd0\xbb\xd0\xb4\xd0\xb0\xd0\xbf1.service - 389 Directory Server \xd0\xbb\xd0\xb4\xd0\xb0\xd0\xbf1.
   Loaded: loaded (/usr/lib/systemd/system/dirsrv@.service; enabled; vendor preset: disabled)
  Drop-In: /usr/lib/systemd/system/dirsrv@.service.d
           └─custom.conf
   Active: failed (Result: exit-code) since Tue 2019-09-03 08:10:17 UTC; 26s ago
  Process: 541 ExecStart=/usr/sbin/ns-slapd -D /etc/dirsrv/slapd-\xd0\xbb\xd0\xb4\xd0\xb0\xd0\xbf1 -i /var/run/dirsrv/slapd-\xd0\xbb\xd0\xb4\xd0\xb0\xd0\xbf1.pid (code=exited, status=1/FAILURE)
  Process: 536 ExecStartPre=/usr/libexec/dirsrv/ds_systemd_ask_password_acl /etc/dirsrv/slapd-\xd0\xbb\xd0\xb4\xd0\xb0\xd0\xbf1/dse.ldif (code=exited, status=0/SUCCESS)
 Main PID: 541 (code=exited, status=1/FAILURE)

Sep 03 08:10:17 server-rhel8.example.com systemd[1]: Starting 389 Directory Server \xd0\xbb\xd0\xb4\xd0\xb0\xd0\xbf1....
Sep 03 08:10:17 server-rhel8.example.com ds_systemd_ask_password_acl[536]: grep: /etc/dirsrv/slapd-\xd0\xbb\xd0\xb4\xd0\xb0\xd0\xbf1/dse.ldif: No such file or directory
Sep 03 08:10:17 server-rhel8.example.com ns-slapd[541]: [03/Sep/2019:08:10:17.736445990 +0000] - INFO - dse_check_file - The config /etc/dirsrv/slapd-\xd0\xbb\xd0\xb4\xd0\xb0\xd0\xbf1/dse.ldif can not be accessed. Attempting restore ... (reason: 0)
Sep 03 08:10:17 server-rhel8.example.com ns-slapd[541]: [03/Sep/2019:08:10:17.736492021 +0000] - INFO - dse_check_file - The backup /etc/dirsrv/slapd-\xd0\xbb\xd0\xb4\xd0\xb0\xd0\xbf1/dse.ldif.bak can not be accessed. Check it exists and permissions.
Sep 03 08:10:17 server-rhel8.example.com ns-slapd[541]: [03/Sep/2019:08:10:17.736496829 +0000] - ERR - slapd_bootstrap_config - No valid configurations can be accessed! You must restore /etc/dirsrv/slapd-\xd0\xbb\xd0\xb4\xd0\xb0\xd0\xbf1/dse.ldif from backup!
Sep 03 08:10:17 server-rhel8.example.com ns-slapd[541]: [03/Sep/2019:08:10:17.736500709 +0000] - EMERG - main - The configuration files in directory /etc/dirsrv/slapd-\xd0\xbb\xd0\xb4\xd0\xb0\xd0\xbf1 could not be read or were not found.  Please refer to the error log or o>
Sep 03 08:10:17 server-rhel8.example.com systemd[1]: dirsrv@\xd0\xbb\xd0\xb4\xd0\xb0\xd0\xbf1.service: Main process exited, code=exited, status=1/FAILURE
Sep 03 08:10:17 server-rhel8.example.com systemd[1]: dirsrv@\xd0\xbb\xd0\xb4\xd0\xb0\xd0\xbf1.service: Failed with result 'exit-code'.
Sep 03 08:10:17 server-rhel8.example.com systemd[1]: Failed to start 389 Directory Server \xd0\xbb\xd0\xb4\xd0\xb0\xd0\xbf1..


Expected results:
dscreate should prevent a user from creating instance with non-sanitized name.

Comment 1 Simon Pichugin 2020-05-13 08:54:47 UTC
https://pagure.io/389-ds-base/issue/51086

Comment 5 Viktor Ashirov 2020-07-22 10:15:24 UTC
Build tested: 389-ds-base-1.4.3.8-4.module+el8.3.0+7193+dfd1e8ad.x86_64

I tried with non-ascii characters and the installer displays the error message:
# dscreate from-file test.inf
Starting installation...
Error: Server identifier can not contain non ascii characters

Marking as VERIFIED.

Comment 8 errata-xmlrpc 2020-11-04 03:07:13 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 (389-ds:1.4 bug fix and enhancement update), 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/RHEA-2020:4695