supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
* chpst -u and supplementary groups
@ 2019-08-19 12:08 Jan Braun
  2019-08-19 19:33 ` Steve Litt
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Jan Braun @ 2019-08-19 12:08 UTC (permalink / raw)
  To: supervision

[-- Attachment #1: Type: text/plain, Size: 1527 bytes --]

Hello list!

Yesterday, I spent way too much time chasing down a permissions problem
caused by the fact that "chpst -u acc prog..." only sets the account's
primary group, and ignores any supplementary groups the account may be a
member of.

TFM mentions "All initial supplementary groups are removed.", but I
failed to memorize that. (Also, what does "initial" signify here?)

My inability to see the issue came from the fact that all other similar
programs (I'm aware of) do in fact add the supplementary groups. Watch:

| # chpst -u test id
| uid=1003(test) gid=1003(test) groups=1003(test)
| # runuser -u test id
| uid=1003(test) gid=1003(test) groups=1003(test),4(adm)
| # s6-setuidgid test id
| uid=1003(test) gid=1003(test) groups=1003(test),4(adm)
| # su - test -c id
| uid=1003(test) gid=1003(test) groups=1003(test),4(adm)
| # su test -c id
| uid=1003(test) gid=1003(test) groups=1003(test),4(adm)
| # sudo -u test id
| uid=1003(test) gid=1003(test) groups=1003(test),4(adm)
| #

So now I'm wondering:
What are the use cases for not applying existing supplementary groups?
Should chpst apply them by default?
Should chpst grow an option to (not) apply them?
    "chpst -u acc: prog..." is still free.
Or is everything as it's supposed to be, and people might need to munge
    the output of "getent initgroups acc" and feed it to the -u option?

I'll be happy to try to come up with a patch (even if it's still a
fatter warning in the manpage) if people can agree here what the right
thing to do is.

regards,
    Jan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread
* Re: chpst -u and supplementary groups
@ 2019-08-27 23:44 Jeff
  0 siblings, 0 replies; 11+ messages in thread
From: Jeff @ 2019-08-27 23:44 UTC (permalink / raw)
  To: init

> Apparently everyone re-implementing daemontools does something like
> this. So that brings me back to my original question:
> is there consensus that the historical behaviour is a bug?

no, this is no bug.

> Or are there valid use cases?

most of the time one does not want the subprocess to run under
additional GIDs, so that is a sane default behaviour.

obviously there should be an option that makes "chpst" add all
supplementary GIDs the UID belongs to, though
(when this is desired by the user).

would not be too much work to add such a commandline option to it.



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2019-08-27 23:44 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-19 12:08 chpst -u and supplementary groups Jan Braun
2019-08-19 19:33 ` Steve Litt
2019-08-19 22:06 ` Bougy Man
2019-08-20  7:25 ` Jonathan de Boyne Pollard
2019-08-20 10:04   ` Jan Braun
2019-08-20 18:21     ` Laurent Bercot
2019-08-21  3:50       ` Jan Braun
2019-08-20 18:25 ` Cameron Nemo
2019-08-21  3:22   ` Jan Braun
2019-08-21 22:26     ` Steve Litt
2019-08-27 23:44 Jeff

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).