-
Notifications
You must be signed in to change notification settings - Fork 256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sssd should run under unprivileged user #3412
Comments
Copy-pasting from coreos/coreos-assembler#2046 (comment) suid binaries are really just a dangerous idea in general. They're a huge attack surface. For this use case instead, the monitor process can expose an internal API (e.g. over a socketpair) that runs something privileged and passes its output to the requesting unprivileged process. |
I guess some description of the role and architecture of the monitor process would be useful. Is it there to gather and provide some data from the individual SSSD processes (in which case, does it need to be run as root at all?) or is it there to for example watch for failed SSSD processes and restart them (in which case, systemd which already runs as root and with full capabilities maybe already provides some mechanism to do that)? |
Mostly the latter. And yes, this is a long standing idea to get rid of monitor and rely on systemd entirely. So from my point of view, extending monitor is not a way to get rid of suid bits form *_child helpers. |
The way I think of this is: Yes you're running more code as non-root, but by adding suid binaries, you have increased the risk to the system as a whole. A separate privileged process that communicates over e.g. private In other words, you can run multiple systemd units - one of which is e.g. a socket-activated |
Might be. Overall `SSSD running as non-root user" isn't "production ready" yet, that's clear. I think we will fix attrs (i.e. get rid of suid) for a case where sssd is built with Proper solution is more involved though. |
I started a discussion on this at https://lists.freedesktop.org/archives/systemd-devel/2021-February/046103.html |
|
JFTR:
-- so executable only by 'root' and service user thus I don't think it "increases the risk to the system as a whole". |
Yes, that's a significant mitigation indeed. But still, I feel pretty confident will show up in scans/audits and will cause you more pain down the line than the "privileged monitor process" approach or another similar one. Maybe e.g. running with BTW if you're doing new work to run unprivileged I highly recommend using |
I'm of quite the opposite opinion. By using Can you elaborate what the benefits for the image-based systems (or services running in containers) would be exactly? |
Do you have an example where this could really increase risk / attack surface? Additional note: a set of file capabilities (that replaced full blown SUID bit) is going to be restricted further, and other measures to constrain helpers will be considered (like selinux policies).
Interesting option. |
What is uncertain?
It's pretty well optimized. The thing is...ah yes, I see it is a floating user/group: For image based updates it is really, really helpful to minimize the number of dynamic/floating users that are part of lower levels in the OS. Please please consider using DynamicUser=yes as it seems nearly ideal for this use case as sssd is just a cache. |
JFTR, it will use
And where this cache should be kept / what should be ownership and ACL? So that it would be persistent between service restarts / machine reboots? |
Use |
Yes please 🙂 https://docs.fedoraproject.org/en-US/packaging-guidelines/UsersAndGroups/#_allocation_strategies |
That's a bit better but that's still equivalent to full root in most cases: https://grsecurity.net/false_boundaries_and_arbitrary_code_execution Are any users expected to be part of the |
But should be better than to run entire daemon unrestricted all the time (as it's the case now).
The latter. |
Sorry to really belabor this but given sssd's critical architectural role a central point around user management...what is done here partially sets a "tone" and example for overall system architecture around what other services should do. If you have concerns about Tangentially related to this I just added a large blurb on this over in https://containers.github.io/bootc/building/users-and-groups.html and it touches on the fact that the "classic RPM %pre floating allocation" pattern will generally cause uid/gid drift for image based systems unless it's manually fixated. |
SSSD is (among other functions) a name service so it may be a source of uids for processes. As such it should be very certain about its own identity and uid clashes should be ruled out. The fact that the daemon with I dread the idea of a system where the uid ranges are not reasonably separated / isolated. Ability to audit operations and their authors is one of the strict SFRs of Common Criteria certification, among others. The I simply fail to see what value For example, Apache's uid 48 has been stable for ages on rpm-based systems. I don't see a reason why the same couldn't be done for SSSD. By the way, it seems FPC has already acked the soft static allocation for SSSD in https://pagure.io/packaging-committee/issue/570 -- we just never followed up with the actual allocation in |
One of two things is true:
I think the rationale for that is exactly that it's distinct from system allocations and human users. What else would it do?
It doesn't scale to have a centralized registry for uids, and there's only so much space under 1000. (It also doesn't scale to have a centralized registry for software, hence containers...)
Yes, that's obviously fine, I won't argue against it. But still, there will be a big need to have something like DynamicUser=yes in the general case because of the centralization problem above. So if you have concerns about potential overlaps or other design issues, I don't see a way around fixing that in general. |
Why do you view it as black or white? The That does not mean everything should be migrated to it en masse. Even https://fedoraproject.org/wiki/Changes/SystemdSecurityHardening does not tout it as a one-size-fits-all security mechanism:
Different types of workloads and services have different security ramifications. Risks that you might tolerate with some user service with no impact/side-effect on the rest of the system is vastly different from risks that you can tolerate from a daemon that is a basis of identity, authentication, and authorization in the system. Note I also have a problem with classifying SSSD as "just a cache".
I don't necessarily blame it. It does not mean I want to see SSSD use it.
I've heard the argument about 1000 for many years. And yet there are still tons of gaps in
There likely isn't, there are inherent risks and uids are hard. (And even if you get uids in sync for example across systems, your subuids might be out of sync -- just recently we had a containerized FreeIPA user/admin hit that.) If we are talking in general, the fact that systemd does not seem to leave any auditing trail about the uid it used for the |
Just going to re-bump this point: #3412 (comment) I still think sssd adding new setcaps binaries is the wrong direction. There's many viable patterns for dropping privileges without adding new setcap/setuid binaries. What I'd really like to be able to enable is people running from pid 1 on down with I have not tried to audit the sssd setuid binaries so I'm not claiming there is actually any new vulnerabilities. But this is also about setting the long term direction for the base OS, and because sssd is part of that the behavior chosen here also acts as a reference point, and I think it's not a good reference. |
For some systems, like RHEL, that's not an addition but a replacement of a full blown suid binaries with fine grained capabilities.
So far every alternative boils down to "have a privileged process [running all the time or socket activated]" and communicate with it from unprivileged code via some kind of IPC.
We do cater as well and we do care as well of systems that do not run systemd. It would be nice to support polkit instead of file capabilities via ./configure switch but that's quite of work for very low benefit. People who would like to run entire user space with And while Lennart writes "which think that things like pluggable client-side modules, LDAP and so on are actually a good thing, even though I would vehemently disagree with that" that doesn't mean nobody needs it.
One needs to package SSSD carefully, making sure random user can't run privileged SSSD binaries. Once this condition is met, one can reasonably claim there are no new vulnerabilities in the sense that having credentials of 'sssd' service user means to be able to write SSSD cache and this means to be able to craft identities, rewrite password hash, create sudo rules, etc. I.e. ability to run SSSD privileged helpers means system is already severely compromised. This is very different to a situation of empowered binaries that can be run by unprivileged users. |
I feel I need to elaborate on this. What I mean is the following:
then the way a program received privileged capabilities in run time - file capabilities or polkit - doesn't matter that much. If, due to a hypothetical bug, 'krb5_child' mistakenly authenticates an user that didn't actually provide valid credential, this will end up in a system compromise doesn't matter how 'krb5_child' is run (even if fully unprivileged, simply because it plugs into PAM stack). What I read about 'sudo vs run0' boils down to:
But that's just not a case with SSSD because unprivileged users can't start its privileged binaries. That's why I think there is a little benefit in switching SSSD from file capabilities to polkit. |
JFTR, the current state (as of sssd-2.10.1) is:
(I understand this doesn't help "from pid 1 on down with NoNewPrivileges=yes" goal, so more JFTR) |
Cloned from Pagure issue: https://pagure.io/SSSD/sssd/issue/2370
Ticket was cloned from Red Hat Bugzilla (product Red Hat Enterprise Linux 7): Bug 1113783
Please note that this Bug is private and may not be accessible as it contains confidential Red Hat customer information.
Comments
Comment from dpal at 2014-07-03 16:02:10
Fields changed
blockedby: =>
blocking: =>
changelog: =>
coverity: =>
design: =>
design_review: => 0
feature_milestone: =>
fedora_test_page: =>
milestone: NEEDS_TRIAGE => SSSD 1.12.1
review: True => 0
selected: =>
testsupdated: => 0
Comment from jhrozek at 2014-07-08 10:11:36
Fields changed
priority: major => blocker
Comment from jhrozek at 2014-07-29 17:23:19
Fields changed
design: => https://fedorahosted.org/sssd/wiki/DesignDocs/NotRootSSSD
Comment from jhrozek at 2014-07-31 13:32:11
Fields changed
owner: somebody => jhrozek
status: new => assigned
Comment from jhrozek at 2014-09-08 20:08:41
Mass-moving all tickets that didn't make 1.12.1 into 1.12.2
milestone: SSSD 1.12.1 => SSSD 1.12.2
Comment from jhrozek at 2014-09-30 19:06:10
We need to do a release as requested by downstream. Moving tickets that are not fixed already or very close to acking to 1.12.3
milestone: SSSD 1.12.2 => SSSD 1.12.3
Comment from jhrozek at 2014-10-20 21:50:00
First round of patches:
mark: => 0
Comment from jhrozek at 2014-10-30 12:12:36
Fields changed
patch: 0 => 1
Comment from jhrozek at 2014-11-05 20:12:26
ldap_child and krb5_child changes:
- f3a2594
- 77b1337
- 06f10b2
- 9369407
- 5eef3da
- 0348c74
- 45414c1
Comment from jhrozek at 2014-11-18 20:44:12
More Kerberos changes:
Comment from jhrozek at 2014-11-18 20:55:22
Build fixes:
- d167039
- 0a039d5
- f9ac9aa
Comment from jhrozek at 2014-11-18 20:58:03
sssd_be privilege drop patch:
Comment from jhrozek at 2014-11-25 20:02:18
Most of the work is done, so I'm closing this ticket. There are some additional enhancements tracked by individual tickets. See e.g. the design page for more details.
resolution: => fixed
status: assigned => closed
Comment from jhrozek at 2017-02-24 14:35:03
Metadata Update from @jhrozek:
The text was updated successfully, but these errors were encountered: