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 1608593

Summary: sssd-common incorrectly has %ghost of /etc/sssd/sssd.conf as sssd:sssd instead of root:root
Product: Red Hat Enterprise Linux 7 Reporter: Ryan Barry <rbarry>
Component: sssdAssignee: SSSD Maintainers <sssd-maint>
Status: CLOSED DUPLICATE QA Contact: sssd-qe <sssd-qe>
Severity: high Docs Contact:
Priority: unspecified    
Version: 7.5CC: grajaiya, jhrozek, lslebodn, mkosek, mzidek, pbrezina, rbarry, sbonazzo, schandle, tscherf, ycui, yturgema
Target Milestone: rc   
Target Release: 7.6   
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: 2018-11-06 10:06:41 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:
Bug Depends On:    
Bug Blocks: 1608513    

Description Ryan Barry 2018-07-25 22:08:51 UTC
Description of problem:
sssd-common specifies /etc/sssd/sssd.conf as:
%ghost %attr(0600,sssd,sssd) %config(noreplace) %{_sysconfdir}/sssd/sssd.conf

Upstream, this is changed to:
%ghost %attr(0600,root,root) %config(noreplace) %{_sysconfdir}/sssd/sssd.conf

Which is what sssd expects, or it will not start. This should also be changed downstream.

Version-Release number of selected component (if applicable):
sssd-common-1.16.0-19.el7_5.5.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Install sssd
2. Create /etc/sssd/sssd.conf
3. chmod 0600. chown root:root
4. rpm -V sssd-common

Actual results:
.....UG..  c /etc/sssd/sssd.conf

Expected results:
No output

Additional info:
Since sssd will not start without being owned by root:root, this is critical for secure environments which check "rpm -V"

Comment 1 Pavel Březina 2018-07-26 08:43:56 UTC
SSSD in RHEL is configured with "--with-sssd-user=sssd" and as such it soon drops root privileges and is run under sssd user. The configuration ownership is correctly set to sssd:sssd.

Can you please provide log files if SSSD is unwilling to start?

Comment 2 Jakub Hrozek 2018-07-26 11:02:06 UTC
(In reply to Pavel Březina from comment #1)
> SSSD in RHEL is configured with "--with-sssd-user=sssd" and as such it soon
> drops root privileges and is run under sssd user.

Yes and no. SSSD is configured --with-sssd-user=sssd mostly to allow pipe and file ownership by the sssd user, but the default identity to run as is still root, because not everything works when running as the sssd user.

> The configuration
> ownership is correctly set to sssd:sssd.
> 
> Can you please provide log files if SSSD is unwilling to start?

I think Ryan is saying something else, the important thing here is that rpm -V is complaining, which is not permitted in environments that have to comply with certain standards. I think we even have a duplicate of this bug in https://bugzilla.redhat.com/show_bug.cgi?id=1576524 but unfortunately haven't had the time to think about a fix yet.

Ryan, do you agree that this bug can be considered a duplicate of https://bugzilla.redhat.com/show_bug.cgi?id=1576524 ?

Comment 3 Ryan Barry 2018-07-26 11:08:25 UTC
I definitely agree that this can be a duplicate.

Other than security, this also affects RHV-H updates. Since uids/gids for system accounts are not deterministic, we correct ownership after updating (RHV-H is updated in an A/B fashion as a single system image).

To do this, we essentially check "rpm -V | grep -e 'U|G'", then "rpm --setugids" if this differs.

Since the specfile/rpmdb indicate that this should be sssd:sssd, but it should actually be root:root, we change the ownership to sssd:sssd, and sssd fails to start after a reboot.

There's a live customer case in the dependent bug. The workaround is easy, but it's still surprising, given that this is correct upstream.

~~~
Jun 12 10:13:06 RHVH sssd: Cannot read config file /etc/sssd/sssd.conf. Please check that the file is accessible only by the owner and owned by root.root.
Jun 12 10:13:06 RHVH systemd: sssd.service: main process exited, code=exited, status=4/NOPERMISSION
Jun 12 10:13:06 RHVH systemd: Unit sssd.service entered failed state.
Jun 12 10:13:06 RHVH systemd: sssd.service failed.
~~~

Comment 4 Pavel Březina 2018-10-05 11:11:23 UTC
Ok, I checked the code and indeed we require root:root on sssd.conf.

The specfile should say:
%ghost %attr(0600,root,root) %config(noreplace) %{_sysconfdir}/sssd/sssd.conf

It is already fixed in rhel8.

Comment 5 Jakub Hrozek 2018-10-10 13:06:03 UTC
(In reply to Pavel Březina from comment #4)
> Ok, I checked the code and indeed we require root:root on sssd.conf.
> 
> The specfile should say:
> %ghost %attr(0600,root,root) %config(noreplace) %{_sysconfdir}/sssd/sssd.conf
> 
> It is already fixed in rhel8.

Thank you for checking. Could you build a test package for the customer?

btw there is also https://bugzilla.redhat.com/show_bug.cgi?id=1576524 which looks somewhat similar except there are comments about the memcache files, do you think the bugs are related?