-
Notifications
You must be signed in to change notification settings - Fork 247
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
IFP: allow running under non-root user #6862
Conversation
5323dc2
to
b99549e
Compare
901b9ad
to
27a1b8c
Compare
UPDATE: this comment is outdated. Some notes:
|
9af9a2b
to
aaba9ba
Compare
aaba9ba
to
b9c0482
Compare
Rebased on top of #6868 |
b9c0482
to
7183635
Compare
7183635
to
f5aec6a
Compare
I see this on my system installing this PR, is it expected?
|
Ah, this comment is outdated...
Well, this is expected in the sense it is my intention. The rationale is:
For this reason I allowed both to ease pain of configuration. |
I see the following error in testing the infopipe with dbus activation
|
That's because you mix 'sssd_be' running under 'root' and socket activated 'ifp' running under 'sssd'. We could overcome this via chown sssd:sssd pipe in sssd_be, but I'm not sure we should. |
f5aec6a
to
a563cb9
Compare
(rebased) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM, Ack.
@@ -9,6 +9,9 @@ Environment=DEBUG_LOGGER=--logger=files | |||
EnvironmentFile=-@environment_file@ | |||
Type=dbus | |||
BusName=org.freedesktop.sssd.infopipe | |||
ExecStart=@ifp_exec_cmd@ ${DEBUG_LOGGER} | |||
ExecStartPre=-/bin/chown @SSSD_USER@:@SSSD_USER@ @logpath@/sssd_ifp.log | |||
ExecStart=@libexecdir@/sssd/sssd_ifp ${DEBUG_LOGGER} --dbus-activated | |||
CapabilityBoundingSet= @additional_caps@ CAP_IPC_LOCK CAP_CHOWN CAP_DAC_READ_SEARCH CAP_FOWNER CAP_SETGID CAP_SETUID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,
in my testing it looks like the CapabilityBoundingSet
is only needed for the chown
in ExecStartPre
. What do you think about adding +
to ExecStartPre
and remove CapabilityBoundingSet
so that chown
runs with full privileges but sssd_ifp
has no extra rights?
bye,
Sumit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, there are a lot of excessive caps listed.
I'm working on clearing this stuff in #6873, 53c49f5 in particular.
With regards to CAP_DAC_OVERRIDE it's a bit tricky because if log file is missing at startup (i.e. nothing to chown()
) then if sssd_ifp is run under 'root' it needs CAP_DAC_OVERRIDE to create log file in /var/log/sssd
Perhaps this can be worked around by addition of 'touch' to ExecStartPre
Moreover, if User=sssd then no CapabilityBoundingSet
is needed at all (and it's presence is confusing).
I hope to improve all this in #6873
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw, merely removing CapabilityBoundingSet
means "unlimited capabilities". So to run 'sssd_ifp' under root but without caps it's required to assign empty set, IIUC.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another case where a responder needs CAP_DAC_OVERRIDE:
- sssd.conf::user=sssd, so sbus server sockets are sssd:sssd owned:
srw-------. 1 sssd sssd 0 Aug 25 11:53 sbus-dp_files.234537
srw-------. 1 sssd sssd 0 Aug 25 11:53 sbus-monitor
- but a socket activated responder is run under root for some reason (for example, for sssd_nss this is the only option currently)
Then a responder needs CAP_DAC_OVERRIDE to connect to monitor and DP (this is a reverse of a problem where sssd_be is run under root but a responder under sssd).
Currently this works because sssd-nss.service doesn't define any CapabilityBoundingSet
at all, so no limits.
Our options are:
- make socket activated sssd_nss to be able to run under sssd and then say we don't support mix of root/sssd at runtime
- keep CAP_DAC_OVERRIDE
maybe something else.
@sumit-bose, what would you say?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually:
sssd/src/responder/nss/nsssrv.c
Line 617 in 15a2213
* Adding the NSS process to the SSSD supplementary group avoids |
so I think another option could be to make sbus server sockets g+rw
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I can't understand - what was the source of
type=AVC msg=audit(1543524888.125:1495): avc: denied { fsetid } for
pid=7706 comm="sssd_nss" capability=4 scontext=system_u:system_r:sssd_t:s0
tcontext=system_u:system_r:sssd_t:s0 tclass=capability
mentioned in the commit message of 61e4ba5
First of all, IIRC, by that time all SSSD components run under root without any capabilities restrictions.
Another thing is that I don't understand how writing to non-executable mem-cache file would trigger such AVC (fsetid).
Moreover, tclass=capability - not a file...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And right, I missed '+' before ExecStartPre
.
In other service files it's solved with deprecated 'PermissionsStartOnly':
systemd/sssd-ssh.service.in:19:PermissionsStartOnly=true
systemd/sssd-autofs.service.in:19:PermissionsStartOnly=true
systemd/sssd-sudo.service.in:19:PermissionsStartOnly=true
systemd/sssd-pam.service.in:19:PermissionsStartOnly=true
systemd/sssd-pac.service.in:19:PermissionsStartOnly=true
-- it defaults to 'false'.
So currently ExecStartPre
for 'ifp.service' is executed with "User=..." and doesn't make sense.
I'll fix this in #6873
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,
thanks, I have no further comments, patch is working as expected, ACK.
bye,
Sumit
:relnote: Infopipe responder (ifp) can now be run under non-privileged 'sssd' user if SSSD is configured and built `--with-sssd-user=sssd` option. As with other components, for 'monitor' activated 'ifp' service feature is enabled by setting `user=sssd` sssd.conf option. For dbus-socket activated 'ifp' service it's a matter of User=/Group= in 'sssd-ifp.service' (configured to 'sssd' by default).
a563cb9
to
9fcc676
Compare
(just a rebase on the top of latest 'master' to see CI status) |
CI is green |
No description provided.