-
Notifications
You must be signed in to change notification settings - Fork 252
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
Supplementary groups #6908
Closed
alexey-tikhonov
wants to merge
36
commits into
SSSD:master
from
alexey-tikhonov:supplementary-groups
Closed
Supplementary groups #6908
alexey-tikhonov
wants to merge
36
commits into
SSSD:master
from
alexey-tikhonov:supplementary-groups
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alexey-tikhonov
force-pushed
the
supplementary-groups
branch
from
August 31, 2023 08:13
7979f10
to
b6c2fea
Compare
alexey-tikhonov
force-pushed
the
supplementary-groups
branch
from
August 31, 2023 15:17
b6c2fea
to
34ade2c
Compare
alexey-tikhonov
force-pushed
the
supplementary-groups
branch
from
August 31, 2023 17:13
34ade2c
to
d378836
Compare
alexey-tikhonov
force-pushed
the
supplementary-groups
branch
from
September 1, 2023 20:21
7e3212c
to
ad34289
Compare
alexey-tikhonov
force-pushed
the
supplementary-groups
branch
from
September 2, 2023 12:41
ad34289
to
231b9d4
Compare
alexey-tikhonov
force-pushed
the
supplementary-groups
branch
from
September 2, 2023 12:49
231b9d4
to
c388286
Compare
alexey-tikhonov
force-pushed
the
supplementary-groups
branch
from
September 3, 2023 13:31
c388286
to
0a1945c
Compare
alexey-tikhonov
force-pushed
the
supplementary-groups
branch
from
September 3, 2023 13:57
0a1945c
to
ff3c89f
Compare
alexey-tikhonov
force-pushed
the
supplementary-groups
branch
from
September 3, 2023 14:20
ff3c89f
to
0b94e9f
Compare
alexey-tikhonov
force-pushed
the
supplementary-groups
branch
from
September 3, 2023 14:41
0b94e9f
to
a69f122
Compare
alexey-tikhonov
force-pushed
the
supplementary-groups
branch
from
September 3, 2023 16:19
a69f122
to
0997d7a
Compare
alexey-tikhonov
force-pushed
the
supplementary-groups
branch
from
September 3, 2023 16:38
0997d7a
to
e0c9904
Compare
alexey-tikhonov
force-pushed
the
supplementary-groups
branch
from
September 4, 2023 11:55
e0c9904
to
aceb973
Compare
alexey-tikhonov
force-pushed
the
supplementary-groups
branch
from
September 4, 2023 16:58
aceb973
to
930c5f8
Compare
It will be used by 'monitor' to first read 'sssd.conf' then switch uid/gid before writing 'config.ldb' This is required in case sssd.service::User and sssd.conf::user do not match.
It's already read in `get_monitor_config()`
`sss_ini_get_string_config_value()` is a wrapper around `ini_get_string_config_value()`, whose docs says ``` Returned value needs to be freed after use. ``` But an attempt to free 'const char *' results in discarded-qualifiers warning.
- perform_checks(): log actual owner - sss_confdb_create_ldif(): use SSSDBG_TRACE_LDB
552390a mentioned ``` might be useful e.g. in RPM %post scripts. ``` but it didn't happen. SSSD performs cache upgrade at startup automatically, explicit command doesn't have any use. On the other hand, it can spoil cache files ownership if users used to run 'sssctl' and SSSD do not match. :relnote: sssct `cache-upgrade` command was removed. SSSD performs automatic upgrade at startup when needed.
There are some known issues like SSSD#5536 but those have to be solved differently. Having 'CAP_KILL' in sssd.service doesn't help anyway (and currently isn't used anyhow).
(1) read sssd.conf (should be readable by user that is used to start monitor) (2) switch user to sssd.conf::user (if configured), drop all capabilities (3) write config.ldb This ensures all SSSD components can read config.ldb without capabilities even if (deprecated) sssd.conf::user is used.
alexey-tikhonov
force-pushed
the
supplementary-groups
branch
from
February 14, 2024 14:13
ddc690c
to
0c5fce8
Compare
:relnote: *IMPORTANT note for downstream maintainers!* This release features significant improvements of "running with less privileges (under unprivileged service user)" feature. There is still a ./configure option '--with-sssd-user=' available that allows downstream package maintainers to choose if support of non-root service user should be built. In case such support is built, a preferred way to configure service user is simply by starting SSSD under this user; for example, using 'User=/Group=' options of systemd sssd.service file. Upstream defaults are to build "--with-sssd-user=sssd" and to install systemd service with "User=/Group=sssd'. In this case, only several helper processes - 'ldap_child', 'krb5_child' and 'selinux_child' - are executed with elevated capabilities (that are now granted using fine grained file capabilities instead of SUID bit). All other SSSD components run without any capabilities. In this scenario it's still possible to re-configure SSSD to run under 'root' (if needed for some reason): besides changing "User/Group=" options, some other tweaks of systemd service files are required. Those tweaks are described in the comments in service files. If SSSD is built "--with-sssd-user=sssd" but configured to run under "root", it's still possible to use a legacy sssd.conf::user option to change a service user at startup. This requires granting CAP_SET_UID/ CAP_SET_GID capabilities to sssd.service (again, read comments in the service file). There should be no reason to prefer sssd.conf::user option over sssd.service::User option, barring very exotics setups where it's impossible to configure initial service user. Take a note, that this release deprecates sssd.conf::user and it's support might be removed in future releases. Further, doesn't matter if SSSD is built "--with-sssd-user=sssd" or "--with-sssd-user=root", when it's configured to run under "root" (in both cases) it still runs without capabilities, the same way as when it's configured to run under "sssd" user. The only difference is from DAC perspective. Important: owner of /etc/sssd/sssd.conf file (and snippets) should match user configured to start SSSD service. Upstream spec file changes ownership of existing sssd.conf to 'sssd' during package installation for seamless upgrades. Additionally, this release fixes a large number of issues with "socket activation of responder" feature, making it operable out-of-the-box when the package is built "--with-sssd-user=sssd". Please take a note, that user configured to run main sssd.service and socket activated responders (if used) should match (i.e. if sssd.service is re-configured from upstream defaults to 'root' then responders services also should be re-configured). Downstream package maintainers are advised to carefully inspect changes in contrib/sssd.spec.in, src/sysv/systemd/* and ./configure options that this release brings!
Since now SSSD starts and runs under %{sssd_user} by default, make sure cache files left from previous version are %{sssd_user}:%{sssd_user} owned.
Since now SSSD starts and runs under %{sssd_user} by default, make sure config files left from previous version are %{sssd_user}:%{sssd_user} owned.
'sssd_kcm' doesn't need CAP CHOWN/SET-ID itself but needs to have it in bounding set so that 'krb5_child' run by 'sssd_kcm' can get those capabilities. CAP_DAC_OVERRIDE is used to access sssd.conf and log folder. The latter can be dropped once (if) 'sssd_kcm' is changed to run under 'sssd' user by default. An approach to use 'SupplementaryGroups=' isn't practical here because config files aren't readable by group and changing this in existing setups might be cumbersome. It should be easier to make 'sssd_kcm' to run under 'sssd' user.
User used to run 'sssctl', 'sssd_kcm', etc (typically root) might not match user configured to run SSSD service.
See https://www.freedesktop.org/software/systemd/man/latest/systemd.service.html#PIDFile= ``` Note that PID files should be avoided in modern projects. Use Type=notify, Type=notify-reload or Type=simple where possible, which does not require use of PID files to determine the main process of a service and avoids needless forking. ``` SSSD uses "Type=notify"
instead of /var/run. SSSD run under non-privileged user can't write to /var/run. Anyway this file is for internal use only, systemd doesn't need it.
This will also allow to use "SecureBits=noroot" in sssd.service
in sssd.service to avoid processes gaining all capabilities from bounding set during execv() with uid=0/gid=0 (so that, for example, 'sssd_be' runs without capabilities even if "User=root")
so that SSSD built --with-sssd-user=sssd but run under 'root' can get to sssd.conf without capabilities (using "SupplementaryGroups=sssd") sssd.conf still needs to be chown'ed to 'root:root' manually in this case.
For a real device this is handled by udev rule that makes device readable by SSSD. This rule doesn't work with mocked device.
alexey-tikhonov
force-pushed
the
supplementary-groups
branch
from
February 14, 2024 21:15
0c5fce8
to
8fd4c87
Compare
alexey-tikhonov
added
the
superseded
This PR is superseded in favor if a different one
label
Feb 15, 2024
Superseded by #7193 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
no-backport
This should go to target branch only.
non-privileged
superseded
This PR is superseded in favor if a different one
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.