Bug 1459786

Summary: sssctl config-check does not give error message for all special characters in domain name
Product: Red Hat Enterprise Linux 7 Reporter: Madhuri <mupadhye>
Component: sssdAssignee: SSSD Maintainers <sssd-maint>
Status: CLOSED DUPLICATE QA Contact: sssd-qe <sssd-qe>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.4CC: grajaiya, jhrozek, lslebodn, mkosek, mupadhye, mzidek, pbrezina, tscherf
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-03 19:18:08 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 2017-06-08 07:49:57 UTC
Description of problem:
It is not clear what special characters are allowed in domain name part in default configuration file and snippet files in SSSD.


Version-Release number of selected component (if applicable):
sssd-1.15.2-43.el7.x86_64

How reproducible:
Always..

Steps to Reproduce:
1. Install sssd and sssd-tools package and configure SSSD client.
2. Create sssd configuration file with typo(add special character) in domain name of sssd configuration file.

# cat /etc/sssd/sssd.conf | grep domain
domains = L&DAP
[domain/L&DAP]

3. Run #ssctl config-check
# sssctl config-check
Issues identified by validators: 0

Messages generated during configuration merging: 0

Used configuration snippet files: 0

4. Start the sssd service.

# systemctl start  sssd.service

SSSD fails to start.

Actual results: 
It is not detected by config-check but SSSD fails to start.

Expected results:
config-check should detect this typo (special character) in domain name.

Additional info:
Special charachter like '@' and '\' are explicitly checked by validator function.

# cat /etc/sssd/sssd.conf | grep domain
domains = L@DAP
[domain/L@DAP]

# sssctl config-check
Issues identified by validators: 1
[rule/allowed_sections]: Section [domain/L@DAP] is not allowed. Check for typos.

Messages generated during configuration merging: 0

Used configuration snippet files: 0

Comment 2 Lukas Slebodnik 2017-06-08 08:43:25 UTC
(In reply to Madhuri from comment #0)
> Description of problem:
> It is not clear what special characters are allowed in domain name part in
> default configuration file and snippet files in SSSD.
> 
> 
> Version-Release number of selected component (if applicable):
> sssd-1.15.2-43.el7.x86_64
> 
> How reproducible:
> Always..
> 
> Steps to Reproduce:
> 1. Install sssd and sssd-tools package and configure SSSD client.
> 2. Create sssd configuration file with typo(add special character) in domain
> name of sssd configuration file.
> 
> # cat /etc/sssd/sssd.conf | grep domain
> domains = L&DAP
> [domain/L&DAP]

Why do you think that "&" should not be allowed in domain name?

Comment 3 Jakub Hrozek 2017-06-08 09:08:51 UTC
man sssd.conf says:
"A domain name should only consist of alphanumeric ASCII characters, dashes, dots and underscores."

Is that not sufficient?

Comment 4 Lukas Slebodnik 2017-06-08 10:21:21 UTC
(In reply to Jakub Hrozek from comment #3)
> man sssd.conf says:
> "A domain name should only consist of alphanumeric ASCII characters, dashes,
> dots and underscores."
> 
So title of this BZ is wrong. Because it is clear that what special characters are allowed in domain part in SSSD.

> Is that not sufficient?

The problem is that we do not check it anywhere in the code. And checking it just in opional config-check is not enough.

BTW "domains = white`hat.com" would work if we properly escape address in dbus addresses.

(Thu Jun  8 12:15:07 2017) [sssd[be[white`hat.com]]] [sbus_new_server] (0x0020): dbus_server_listen failed! (name=org.freedesktop.DBus.Error.BadAddress, message=In D-Bus address, character '`' should have been escaped
)
(Thu Jun  8 12:15:07 2017) [sssd[be[white`hat.com]]] [dp_init_dbus_server] (0x0010): Could not set up sbus server.
(Thu Jun  8 12:15:07 2017) [sssd[be[white`hat.com]]] [dp_init] (0x0010): Unable to setup service bus [5]: Input/output error
(Thu Jun  8 12:15:07 2017) [sssd[be[white`hat.com]]] [dp_terminate_active_requests] (0x0400): Terminating active data provider requests
(Thu Jun  8 12:15:07 2017) [sssd[be[white`hat.com]]] [be_process_init] (0x0010): Unable to setup data provider [5]: Input/output error
(Thu Jun  8 12:15:07 2017) [sssd[be[white`hat.com]]] [main] (0x0010): Could not initialize backend [5]


And it is a little bit late to realize error when starting back-end.

Comment 5 Michal Zidek 2017-06-09 11:27:18 UTC
So we need to update the regex in schema to reflect the documentation.

I have a question that is kind of related to this.

Should we prevent SSSD from starting when the validators find an issue on startup? It will not be necessary to write additional checks in the code for issues like this in order to fail with sane error message. We could rely on the validators to catch these issues.

We could have command line argument to disable/enable this behavior (so that we have a workaround for cases where the schema has bugs - and I am sure there will be some).

Opinions?
Should we create some downstream BZs, to track the above?

Michal

Comment 6 Jakub Hrozek 2017-06-10 06:18:48 UTC
(In reply to Michal Zidek from comment #5)
> So we need to update the regex in schema to reflect the documentation.
> 
> I have a question that is kind of related to this.
> 
> Should we prevent SSSD from starting when the validators find an issue on
> startup? It will not be necessary to write additional checks in the code for
> issues like this in order to fail with sane error message. We could rely on
> the validators to catch these issues.
> 

I'm not sure if this is possible, there might be scenarios where there are already config files out in the wild with typos. And as you say, we might have bugs in the schema. There is plenty of users who use the same configuration across RHEL-6/7 and they don't care about warnings.


> We could have command line argument to disable/enable this behavior (so that
> we have a workaround for cases where the schema has bugs - and I am sure
> there will be some).
> 

If we have such a switch, would we ever enable it? 

> Opinions?
> Should we create some downstream BZs, to track the above?
> 
> Michal

Comment 7 Michal Zidek 2017-06-13 10:20:31 UTC
(In reply to Jakub Hrozek from comment #6)
> (In reply to Michal Zidek from comment #5)
> > So we need to update the regex in schema to reflect the documentation.
> > 
> > I have a question that is kind of related to this.
> > 
> > Should we prevent SSSD from starting when the validators find an issue on
> > startup? It will not be necessary to write additional checks in the code for
> > issues like this in order to fail with sane error message. We could rely on
> > the validators to catch these issues.
> > 
> 
> I'm not sure if this is possible, there might be scenarios where there are
> already config files out in the wild with typos. And as you say, we might
> have bugs in the schema. There is plenty of users who use the same
> configuration across RHEL-6/7 and they don't care about warnings.

I think you are right. It could be to invasive.

> 
> 
> > We could have command line argument to disable/enable this behavior (so that
> > we have a workaround for cases where the schema has bugs - and I am sure
> > there will be some).
> > 
> 
> If we have such a switch, would we ever enable it?

I would at least enable it in the CI to catch errors in schema sooner.

> 
> > Opinions?
> > Should we create some downstream BZs, to track the above?
> > 
> > Michal

Comment 8 Jakub Hrozek 2017-06-13 10:39:32 UTC
(In reply to Michal Zidek from comment #7)
> > If we have such a switch, would we ever enable it?
> 
> I would at least enable it in the CI to catch errors in schema sooner.

That would be nice.

Comment 9 Jakub Hrozek 2017-08-03 19:18:08 UTC
I've captured the discussion into the downstream ticket #3334 and I'm going to close this bugzilla as a duplicate of https://bugzilla.redhat.com/show_bug.cgi?id=1432325

Madhuri, thank you very much for filing this bug.

*** This bug has been marked as a duplicate of bug 1432325 ***