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 1781728

Summary: sssctl config-check command does not give proper error messages with line numbers
Product: Red Hat Enterprise Linux 8 Reporter: Madhuri <mupadhye>
Component: sssdAssignee: Tomas Halman <thalman>
Status: CLOSED ERRATA QA Contact: sssd-qe <sssd-qe>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.2CC: grajaiya, jhrozek, lslebodn, mzidek, pbrezina, sgoveas, thalman, tscherf
Target Milestone: rcKeywords: Regression
Target Release: 8.0Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: sync-to-jira
Fixed In Version: sssd-2.2.3-4.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-04-28 16:56:29 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 Madhuri 2019-12-10 13:55:45 UTC
Description of problem:
sssctl config-check command does not give proper error messages with line numbers while checking starting and ending square brackets in domain, sssd and service sections.


Version-Release number of selected component (if applicable):
# rpm -qa sssd sssd-tools
sssd-tools-2.2.3-3.el8.x86_64
sssd-2.2.3-3.el8.x86_64


How reproducible:
Always


Steps to Reproduce:
1. Add sssd.conf with missing ending square brackets for sssd section. 
2. # cat /etc/sssd/sssd.conf 
[sssd
config_file_version = 2
services = nss, pam
domains = example1

[domain/example1]
ldap_search_base = dc=example,dc=test
id_provider = ldap
auth_provider = ldap
ldap_user_home_directory = /home/%u
ldap_uri = ldaps://ci-vm-10-0-153-162.hosted.upshift.rdu2.redhat.com
ldap_tls_cacert = /etc/openldap/cacerts/cacert.pem
use_fully_qualified_names = True
debug_level = 9

3. Run # sssctl config-check

Actual results:
Not showing the exact error message with a line number.

# sssctl config-check
(Tue Dec 10 08:49:12:721419 2019) [sssd] [sss_ini_parse] (0x0010): Failed to parse configuration. Error 5.
(Tue Dec 10 08:49:12:721468 2019) [sssd] [sss_ini_parse] (0x0010): Errors detected while parsing: /etc/sssd/sssd.conf
(Tue Dec 10 08:49:12:721481 2019) [sssd] [sss_ini_read_sssd_conf] (0x0010): Failed to parse configuration.
Failed to load configuration configuration from /etc/sssd/sssd.conf.


Expected results:
In expected error messages, we should get line number/s with proper error messages like no closing bracket.

[root@vm-idm-002 ~]# sssctl config-check
(Tue Dec 10 19:21:12:300456 2019) [sssd] [sss_ini_get_config] (0x0010): Failed to parse configuration. Error 5.
(Tue Dec 10 19:21:12:300625 2019) [sssd] [sss_ini_get_config] (0x0010): Errors detected while parsing: /etc/sssd/sssd.conf
(Tue Dec 10 19:21:12:300689 2019) [sssd] [sss_ini_config_print_errors] (0x0010): Error (2) on line 1: No closing bracket.
(Tue Dec 10 19:21:12:300731 2019) [sssd] [sssctl_config_check] (0x0010): Failed to load configuration


Additional info:
Expect error message with the line number for missing starting bracket for any section.

Comment 2 Tomas Halman 2019-12-10 15:29:20 UTC
Upstream ticket:
https://pagure.io/SSSD/sssd/issue/4129

Comment 3 Tomas Halman 2019-12-10 15:40:39 UTC
Upstream PR
https://github.com/SSSD/sssd/pull/961

Comment 4 Michal Zidek 2019-12-11 16:30:27 UTC
master:
b626651

Comment 6 Madhuri 2020-01-03 06:59:11 UTC
Verified with
sssd-2.2.3-8.el8.x86_64

Automated tests are passed

passed	test_config_validation.py::TestConfigValidation::()::test_0018_closingbrackets
---------------------------- Captured stderr setup -----------------------------
2019-12-23 19:57:50,579 - sssd.testlib.common.qe_class.QeHost.hostname3.OpenSSHTransport - INFO - RUN cp -f /etc/sssd/sssd.conf /etc/sssd/sssd.conf.orig
2019-12-23 19:57:50,579 - sssd.testlib.common.qe_class.QeHost.hostname3.cmd242 - DEBUG - RUN cp -f /etc/sssd/sssd.conf /etc/sssd/sssd.conf.orig
2019-12-23 19:57:50,607 - sssd.testlib.common.qe_class.QeHost.hostname3.cmd242 - DEBUG - Exit code: 0
2019-12-23 19:57:50,607 - sssd.testlib.common.qe_class.QeHost.hostname3.OpenSSHTransport - INFO - RUN ['cat', '/etc/redhat-release']
2019-12-23 19:57:50,607 - sssd.testlib.common.qe_class.QeHost.hostname3.cmd243 - DEBUG - RUN ['cat', '/etc/redhat-release']
2019-12-23 19:57:50,634 - sssd.testlib.common.qe_class.QeHost.hostname3.cmd243 - DEBUG - Red Hat Enterprise Linux release 8.2 Beta (Ootpa)
2019-12-23 19:57:50,635 - sssd.testlib.common.qe_class.QeHost.hostname3.cmd243 - DEBUG - Exit code: 0
2019-12-23 19:57:50,635 - sssd.testlib.common.qe_class.QeHost.hostname3.OpenSSHTransport - INFO - RUN ['systemctl', 'stop', 'sssd']
2019-12-23 19:57:50,635 - sssd.testlib.common.qe_class.QeHost.hostname3.cmd244 - DEBUG - RUN ['systemctl', 'stop', 'sssd']
2019-12-23 19:57:50,668 - sssd.testlib.common.qe_class.QeHost.hostname3.cmd244 - DEBUG - Exit code: 0

----------------------------- Captured stderr call -----------------------------
2019-12-23 19:58:00,673 - sssd.testlib.common.qe_class.QeHost.hostname3.OpenSSHTransport - INFO - GET /etc/sssd/sssd.conf
2019-12-23 19:58:00,674 - sssd.testlib.common.qe_class.QeHost.hostname3.cmd245 - DEBUG - RUN ['cat', '/etc/sssd/sssd.conf']
2019-12-23 19:58:00,701 - sssd.testlib.common.qe_class.QeHost.hostname3.cmd245 - DEBUG - Exit code: 0
2019-12-23 19:58:00,702 - sssd.testlib.common.qe_class.QeHost.hostname3.OpenSSHTransport - INFO - PUT /etc/sssd/sssd.conf
2019-12-23 19:58:00,702 - sssd.testlib.common.qe_class.QeHost.hostname3.cmd246 - DEBUG - RUN ['tee', '/etc/sssd/sssd.conf']
2019-12-23 19:58:00,725 - sssd.testlib.common.qe_class.QeHost.hostname3.cmd246 - DEBUG - Exit code: 0
2019-12-23 19:58:00,725 - sssd.testlib.common.qe_class.QeHost.hostname3.OpenSSHTransport - INFO - RUN sssctl config-check
2019-12-23 19:58:00,725 - sssd.testlib.common.qe_class.QeHost.hostname3.cmd247 - DEBUG - RUN sssctl config-check
2019-12-23 19:58:00,759 - sssd.testlib.common.qe_class.QeHost.hostname3.cmd247 - DEBUG - Failed to load configuration configuration from /etc/sssd/sssd.conf.
2019-12-23 19:58:00,759 - sssd.testlib.common.qe_class.QeHost.hostname3.cmd247 - DEBUG - (Mon Dec 23 14:58:00:517492 2019) [sssd] [sss_ini_parse] (0x0010): Failed to parse configuration. Error 5.
2019-12-23 19:58:00,759 - sssd.testlib.common.qe_class.QeHost.hostname3.cmd247 - DEBUG - (Mon Dec 23 14:58:00:517564 2019) [sssd] [sss_ini_parse] (0x0010): Errors detected while parsing: /etc/sssd/sssd.conf
2019-12-23 19:58:00,759 - sssd.testlib.common.qe_class.QeHost.hostname3.cmd247 - DEBUG - (Mon Dec 23 14:58:00:517581 2019) [sssd] [sss_ini_config_print_errors] (0x0010): Error (2) on line 1: No closing bracket.
2019-12-23 19:58:00,759 - sssd.testlib.common.qe_class.QeHost.hostname3.cmd247 - DEBUG - (Mon Dec 23 14:58:00:517588 2019) [sssd] [sss_ini_read_sssd_conf] (0x0010): Failed to parse configuration.
2019-12-23 19:58:00,760 - sssd.testlib.common.qe_class.QeHost.hostname3.cmd247 - DEBUG - Exit code: 1

Passed	test_config_validation.py::TestConfigValidation::()::test_0019_openingbracket	0.09	
---------------------------- Captured stderr setup -----------------------------
2019-12-23 19:58:00,791 - sssd.testlib.common.qe_class.QeHost.hostname3.OpenSSHTransport - INFO - RUN cp -f /etc/sssd/sssd.conf /etc/sssd/sssd.conf.orig
2019-12-23 19:58:00,791 - sssd.testlib.common.qe_class.QeHost.hostname3.cmd249 - DEBUG - RUN cp -f /etc/sssd/sssd.conf /etc/sssd/sssd.conf.orig
2019-12-23 19:58:00,816 - sssd.testlib.common.qe_class.QeHost.hostname3.cmd249 - DEBUG - Exit code: 0
2019-12-23 19:58:00,816 - sssd.testlib.common.qe_class.QeHost.hostname3.OpenSSHTransport - INFO - RUN ['cat', '/etc/redhat-release']
2019-12-23 19:58:00,816 - sssd.testlib.common.qe_class.QeHost.hostname3.cmd250 - DEBUG - RUN ['cat', '/etc/redhat-release']
2019-12-23 19:58:00,839 - sssd.testlib.common.qe_class.QeHost.hostname3.cmd250 - DEBUG - Red Hat Enterprise Linux release 8.2 Beta (Ootpa)
2019-12-23 19:58:00,839 - sssd.testlib.common.qe_class.QeHost.hostname3.cmd250 - DEBUG - Exit code: 0
2019-12-23 19:58:00,840 - sssd.testlib.common.qe_class.QeHost.hostname3.OpenSSHTransport - INFO - RUN ['systemctl', 'stop', 'sssd']
2019-12-23 19:58:00,840 - sssd.testlib.common.qe_class.QeHost.hostname3.cmd251 - DEBUG - RUN ['systemctl', 'stop', 'sssd']
2019-12-23 19:58:00,873 - sssd.testlib.common.qe_class.QeHost.hostname3.cmd251 - DEBUG - Exit code: 0

----------------------------- Captured stderr call -----------------------------
2019-12-23 19:58:10,885 - sssd.testlib.common.qe_class.QeHost.hostname3.OpenSSHTransport - INFO - GET /etc/sssd/sssd.conf
2019-12-23 19:58:10,885 - sssd.testlib.common.qe_class.QeHost.hostname3.cmd252 - DEBUG - RUN ['cat', '/etc/sssd/sssd.conf']
2019-12-23 19:58:10,911 - sssd.testlib.common.qe_class.QeHost.hostname3.cmd252 - DEBUG - Exit code: 0
2019-12-23 19:58:10,912 - sssd.testlib.common.qe_class.QeHost.hostname3.OpenSSHTransport - INFO - PUT /etc/sssd/sssd.conf
2019-12-23 19:58:10,912 - sssd.testlib.common.qe_class.QeHost.hostname3.cmd253 - DEBUG - RUN ['tee', '/etc/sssd/sssd.conf']
2019-12-23 19:58:10,935 - sssd.testlib.common.qe_class.QeHost.hostname3.cmd253 - DEBUG - Exit code: 0
2019-12-23 19:58:10,935 - sssd.testlib.common.qe_class.QeHost.hostname3.OpenSSHTransport - INFO - RUN sssctl config-check
2019-12-23 19:58:10,936 - sssd.testlib.common.qe_class.QeHost.hostname3.cmd254 - DEBUG - RUN sssctl config-check
2019-12-23 19:58:10,968 - sssd.testlib.common.qe_class.QeHost.hostname3.cmd254 - DEBUG - Failed to load configuration configuration from /etc/sssd/sssd.conf.
2019-12-23 19:58:10,968 - sssd.testlib.common.qe_class.QeHost.hostname3.cmd254 - DEBUG - (Mon Dec 23 14:58:10:726576 2019) [sssd] [sss_ini_parse] (0x0010): Failed to parse configuration. Error 5.
2019-12-23 19:58:10,968 - sssd.testlib.common.qe_class.QeHost.hostname3.cmd254 - DEBUG - (Mon Dec 23 14:58:10:726613 2019) [sssd] [sss_ini_parse] (0x0010): Errors detected while parsing: /etc/sssd/sssd.conf
2019-12-23 19:58:10,968 - sssd.testlib.common.qe_class.QeHost.hostname3.cmd254 - DEBUG - (Mon Dec 23 14:58:10:726625 2019) [sssd] [sss_ini_config_print_errors] (0x0010): Error (5) on line 6: Equal sign is missing.
2019-12-23 19:58:10,969 - sssd.testlib.common.qe_class.QeHost.hostname3.cmd254 - DEBUG - (Mon Dec 23 14:58:10:726632 2019) [sssd] [sss_ini_read_sssd_conf] (0x0010): Failed to parse configuration.
2019-12-23 19:58:10,969 - sssd.testlib.common.qe_class.QeHost.hostname3.cmd254 - DEBUG - Exit code: 1

Thus from above marking this bug as verified.

Comment 8 errata-xmlrpc 2020-04-28 16:56:29 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.

https://access.redhat.com/errata/RHBA-2020:1863