Bug 98479

Summary: realmd doesn't configure sssd.conf with nss, pam services
Product: realmd Reporter: Stef Walter <stefw>
Component: realmdAssignee: Stef Walter <stefw>
Status: RESOLVED FIXED QA Contact: yelley
Severity: normal    
Priority: medium CC: fabiano, stefw
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Add nss and pam sssd.conf services after join
Revert 402cbab
service: Add "pam" and "nss" services uing realm_ini_config_set_list_diff()
service: Add "pam" and "nss" services in realm_sssd_config_add_domain()
FIXUP: Actually save the changes to the services line
service: Add "pam" and "nss" services in realm_sssd_config_add_domain()

Description Stef Walter 2016-10-28 18:27:46 UTC
realmd doesn't properly add the nss and pam services to sssd.conf services line if such a line already exists. It only adds them if that line is missing.
Comment 1 Stef Walter 2016-10-28 18:33:26 UTC
Created attachment 127592 [details] [review]
Add nss and pam sssd.conf services after join
Comment 2 Stef Walter 2016-11-29 13:00:33 UTC
Merged into git master.
Comment 3 Fabiano Fidêncio 2017-04-24 21:09:45 UTC
(In reply to Stef Walter from comment #2)
> Merged into git master.

Stef, seems that this commit broke SSSD on F26. Calling realm join "ad.example" generates a sssd.conf without the "services = " line.

The ISO I've used to test is: https://kojipkgs.fedoraproject.org/compose/branched/Fedora-26-20170420.n.0/compose/Server/x86_64/iso/Fedora-Server-dvd-x86_64-26-20170420.n.0.iso
Comment 4 Fabiano Fidêncio 2017-04-25 05:31:05 UTC
Created attachment 131010 [details] [review]
Revert 402cbab
Comment 5 Fabiano Fidêncio 2017-04-25 05:31:34 UTC
Created attachment 131011 [details] [review]
service: Add "pam" and "nss" services uing realm_ini_config_set_list_diff()
Comment 6 Fabiano Fidêncio 2017-04-25 05:33:39 UTC
(In reply to Fabiano Fidêncio from comment #3)
> (In reply to Stef Walter from comment #2)
> > Merged into git master.
> 
> Stef, seems that this commit broke SSSD on F26. Calling realm join
> "ad.example" generates a sssd.conf without the "services = " line.
> 
> The ISO I've used to test is:
> https://kojipkgs.fedoraproject.org/compose/branched/Fedora-26-20170420.n.0/
> compose/Server/x86_64/iso/Fedora-Server-dvd-x86_64-26-20170420.n.0.iso

Stef, I'm proposing reverting the pushed patch and providing a quite simple patch that also would handle well adding the "nss" and "pam" services to sssd.conf in case such line already exists and also doesn't change the old behavior.

It was tested on a f26 local build.
Comment 7 Stef Walter 2017-04-25 06:31:01 UTC
Thanks for the patches. But these two commits when taken together, break the original case that was fixed here. Why are you reverting the changes to the IPA provider?

$ sudo cat /etc/sssd/sssd.conf

[sssd]
domains = 
config_file_version = 2
services = sudo

$ sudo realm join -v cockpit.lan
... IPA domain join ...

$ getent passwd admin@cockpit.lan
< no output>

$ sudo cat /etc/sssd/sssd.conf
[domain/cockpit.lan]
...

[sssd]
domains = cockpit.lan
config_file_version = 2
services = sudo, ssh
Comment 8 Fabiano Fidêncio 2017-04-25 06:36:32 UTC
(In reply to Stef Walter from comment #7)
> Thanks for the patches. But these two commits when taken together, break the
> original case that was fixed here. Why are you reverting the changes to the
> IPA provider?

The main reason was because there's no detailed explanation about it (neither in the bug or in the commit message).

> 
> $ sudo cat /etc/sssd/sssd.conf
> 
> [sssd]
> domains = 
> config_file_version = 2
> services = sudo
> 
> $ sudo realm join -v cockpit.lan
> ... IPA domain join ...
> 
> $ getent passwd admin@cockpit.lan
> < no output>
> 
> $ sudo cat /etc/sssd/sssd.conf
> [domain/cockpit.lan]
> ...
> 
> [sssd]
> domains = cockpit.lan
> config_file_version = 2
> services = sudo, ssh

I will test whether the last patch is enough for our cases (and then the tests part has to be reverted) and re-submit it. Okay?
Comment 9 Stef Walter 2017-04-25 06:37:16 UTC
(In reply to Fabiano Fidêncio from comment #8)
> I will test whether the last patch is enough for our cases (and then the
> tests part has to be reverted) and re-submit it. Okay?

Yup, that sounds good.
Comment 10 Fabiano Fidêncio 2017-04-25 07:03:38 UTC
Created attachment 131013 [details] [review]
service: Add "pam" and "nss" services in realm_sssd_config_add_domain()

Hopefully this patch is enough for both of us.

I've checked yours and mine use cases and both seems to work. But, as usual, I'd prefer to have a confirmation from you that your part was not broken by this patch.
Comment 11 Stef Walter 2017-04-25 08:25:11 UTC
Created attachment 131015 [details] [review]
FIXUP: Actually save the changes to the services line

I had to make these further changes to get things to work. Can you double check if they work for you? If they do, please squash these changes into your patch.
Comment 12 Fabiano Fidêncio 2017-04-25 08:53:11 UTC
Created attachment 131017 [details] [review]
service: Add "pam" and "nss" services in realm_sssd_config_add_domain()

Squashed your fix up patch into mine as my use case works properly here.
Comment 13 Stef Walter 2017-04-25 11:15:13 UTC
Thanks. Merged into git master.

Attachment 131017 [details] pushed as 9d5b6f5 - service: Add "pam" and "nss" services in realm_sssd_config_add_domain()

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.