Skip to content

sys-auth/sssd: make sure caps are preserved#45969

Closed
257 wants to merge 1 commit into
gentoo:masterfrom
257:preserve-caps-for-nonroot-sssd
Closed

sys-auth/sssd: make sure caps are preserved#45969
257 wants to merge 1 commit into
gentoo:masterfrom
257:preserve-caps-for-nonroot-sssd

Conversation

@257

@257 257 commented Mar 18, 2026

Copy link
Copy Markdown
Contributor

Signed-off-by: Paymon MARANDI [email protected]


Please check all the boxes that apply:

  • I can submit this contribution in agreement with the Copyright Policy.
  • I have certified the above via adding a Signed-off-by line to every commit in the pull request.
  • This contribution has not been created with the assistance of Natural Language Processing artificial intelligence tools, in accordance with the AI policy.
  • I have run pkgcheck scan --commits --net to check for issues with my commits.

Please note that all boxes must be checked for the pull request to be merged.

@gentoo-bot

Copy link
Copy Markdown

Pull Request assignment

Submitter: @257
Areas affected: ebuilds
Packages affected: sys-auth/sssd

sys-auth/sssd: @gentoo/base-system, @salahcoronya, @gentoo/proxy-maint

Linked bugs

No bugs to link found. If your pull request references any of the Gentoo bug reports, please add appropriate GLEP 66 tags to the commit message and request reassignment.

If you do not receive any reply to this pull request, please open or link a bug to attract the attention of maintainers.


In order to force reassignment and/or bug reference scan, please append [please reassign] to the pull request title.

Docs: Code of ConductCopyright policy (expl.) ● DevmanualGitHub PRsProxy-maint guide

@gentoo-bot gentoo-bot added assigned PR successfully assigned to the package maintainer(s). no bug found No Bug/Closes found in the commits. labels Mar 18, 2026
@floppym

floppym commented Mar 18, 2026

Copy link
Copy Markdown
Contributor

Please submit this without a revbump so we can actually review the changes. We can perform the revbump when we merge.

@257
257 force-pushed the preserve-caps-for-nonroot-sssd branch from 87360d9 to 937baa6 Compare March 18, 2026 20:34
@257

257 commented Mar 18, 2026

Copy link
Copy Markdown
Contributor Author

done!

i'm realising maybe chgrps and chmods are not needed. i'm tesing the runtime as we speak...

@257
257 force-pushed the preserve-caps-for-nonroot-sssd branch from 937baa6 to ceedfc8 Compare March 18, 2026 20:37
@floppym

floppym commented Mar 18, 2026

Copy link
Copy Markdown
Contributor

i'm realising maybe chgrps and chmods are not needed. i'm tesing the runtime as we speak...

Yeah, I was writing a review comment about that. I think the upstream Makefile will take care of that.

@257
257 force-pushed the preserve-caps-for-nonroot-sssd branch from ceedfc8 to ff471aa Compare March 18, 2026 20:45
@257

257 commented Mar 18, 2026

Copy link
Copy Markdown
Contributor Author

i'm realising maybe chgrps and chmods are not needed. i'm tesing the runtime as we speak...

Yeah, I was writing a review comment about that. I think the upstream Makefile will take care of that.

dropped them for now regardless ofthe tests i'm doing here, we can always add them later.

Comment thread sys-auth/sssd/sssd-2.12.0-r1.ebuild Outdated
Comment thread sys-auth/sssd/sssd-2.12.0-r1.ebuild Outdated
Comment thread sys-auth/sssd/sssd-2.12.0-r1.ebuild
@salahcoronya

Copy link
Copy Markdown
Contributor

On my test boxes, an extra preservation step isn't needed - portage copies the xattrs from the staging are with the file. Is your /var/tmp/portage on a filesystem that doesn't support xattrs, possibly a network one (like NFS/SMB)?

@257
257 force-pushed the preserve-caps-for-nonroot-sssd branch 2 times, most recently from 21a37fa to f74a738 Compare March 18, 2026 20:49
@floppym

floppym commented Mar 18, 2026

Copy link
Copy Markdown
Contributor

On my test boxes, an extra preservation step isn't needed - portage copies the xattrs from the staging are with the file. Is your /var/tmp/portage on a filesystem that doesn't support xattrs, possibly a network one (like NFS/SMB)?

Portage does support copying xattrs if ${PORTAGE_TMPDIR} supports them. However, this is not strictly required for all Gentoo systems, and was mainly added to support PaX markings.

Applying the caps via fcaps.eclass in pkg_postinst is the right move here and will ensure consistent results.

@257

257 commented Mar 18, 2026

Copy link
Copy Markdown
Contributor Author

On my test boxes, an extra preservation step isn't needed - portage copies the xattrs from the staging are with the file. Is your /var/tmp/portage on a filesystem that doesn't support xattrs, possibly a network one (like NFS/SMB)?

hmm, good point, here is my setup:

🦸 root@osif:sys-auth/sssd findmnt /var/tmp/portage
TARGET           SOURCE FSTYPE OPTIONS
/var/tmp/portage tmpfs  tmpfs  rw,nosuid,nodev,noatime,size=174010304k,uid=11482,gid=11482,inode64,huge=within_size

and we build these images using mkosi, unprivileged.

@257

257 commented Mar 18, 2026

Copy link
Copy Markdown
Contributor Author

and kernel seems to be fine:

🦸 root@osif:sys-auth/sssd zgrep CONFIG_TMPFS_XATTR /proc/config.gz
CONFIG_TMPFS_XATTR=y

@floppym

floppym commented Mar 18, 2026

Copy link
Copy Markdown
Contributor

Perhaps your mkosi build process does not install sys-libs/libcap before sys-auth/sssd gets built? That would cause the setcap binary to be missing and the upstream Makefile would not apply the caps.

@floppym

floppym commented Mar 18, 2026

Copy link
Copy Markdown
Contributor

Perhaps your mkosi build process does not install sys-libs/libcap before sys-auth/sssd gets built? That would cause the setcap binary to be missing and the upstream Makefile would not apply the caps.

Nevermind, I see it is listed in both BDEPEND and DEPEND.

@257

257 commented Mar 18, 2026

Copy link
Copy Markdown
Contributor Author

Perhaps your mkosi build process does not install sys-libs/libcap before sys-auth/sssd gets built? That would cause the setcap binary to be missing and the upstream Makefile would not apply the caps.

good call but i don't think so, here are the logs

@257

257 commented Mar 18, 2026

Copy link
Copy Markdown
Contributor Author

Perhaps your mkosi build process does not install sys-libs/libcap before sys-auth/sssd gets built? That would cause the setcap binary to be missing and the upstream Makefile would not apply the caps.

good call but i don't think so, here are the logs

you're right actually, that libcap is going into --root=; i.e. /buildroot.

i see sys-libs/libcap declared in DEPEND, does it need to go into BDEPEND?

@257

257 commented Mar 18, 2026

Copy link
Copy Markdown
Contributor Author

i see sys-libs/libcap declared in DEPEND, does it need to go into BDEPEND?

never mind, it is declared in BDEPENDS! so i don't know :)

@257

257 commented Mar 18, 2026

Copy link
Copy Markdown
Contributor Author

hmm, sys-libs/libcap is merged into the /, that is the root tree (an updated stage3) where we invoke emerge with --root=/buildroot.
in fact we can artificially make mkosi drop us into a shell there and we have:

‣ "emerge --noreplace --verbose --quiet-fail=n --root=/buildroot @encs1" returned non-zero exit code 1.
‣ Sandbox command: mkosi-sandbox --bind /proc /proc --unsetenv TMPDIR --setenv SYSTEMD_OFFLINE 1 --bind
...
osif / # which setcap
/usr/bin/setcap

@salahcoronya

Copy link
Copy Markdown
Contributor

LGTM

@257

257 commented Mar 24, 2026

Copy link
Copy Markdown
Contributor Author

for the record, caps and group ownerships are lost because of id/gid mapping in non-root builds, as mentioned here.

systemd-nsresourced.service(8) seems to be upstream's solution; we're testing atm.

however, that requires at least systemd-260 with USE=bpf and BTF (CONFIG_DEBUG_INFO_BTF=y).

i expect systemd-260 to take a year to stabalise so indeed LGTM.

@257
257 force-pushed the preserve-caps-for-nonroot-sssd branch from f74a738 to 5fb99d4 Compare March 24, 2026 16:59
Copilot AI review requested due to automatic review settings March 24, 2026 16:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the sys-auth/sssd ebuild to preserve upstream-intended POSIX file capabilities on helper binaries by using the fcaps eclass and applying capabilities in pkg_postinst.

Changes:

  • Add fcaps to inherited eclasses for sssd-2.12.0-r1.
  • Define FILECAPS entries to apply upstream-like capabilities to ldap_child, krb5_child, and sssd_pam.
  • Invoke fcaps_pkg_postinst during pkg_postinst so capabilities are re-applied after installation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@gentoo-repo-qa-bot

Copy link
Copy Markdown

@257

257 commented Mar 24, 2026

Copy link
Copy Markdown
Contributor Author

hmm, i don't see what checks failed; i think i don't have the permissions to view those(?)

@floppym

floppym commented Mar 24, 2026

Copy link
Copy Markdown
Contributor

hmm, i don't see what checks failed; i think i don't have the permissions to view those(?)

Ignore that, the bot is blaming you for unrelated changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

assigned PR successfully assigned to the package maintainer(s). no bug found No Bug/Closes found in the commits.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants