Bug 5324 - Slimserver should run with group permissions from /etc/groups
: Slimserver should run with group permissions from /etc/groups
Status: CLOSED FIXED
Product: Logitech Media Server
Classification: Unclassified
Component: Platform Support
: unspecified
: PC Windows XP
: P2 normal (vote)
: ---
Assigned To: Andy Grundman
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-08-28 01:26 UTC by Christopher Key
Modified: 2008-12-18 11:12 UTC (History)
1 user (show)

See Also:
Category: ---


Attachments
Patch as referenced in the bug report (4.40 KB, patch)
2007-08-28 01:28 UTC, Christopher Key
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Christopher Key 2007-08-28 01:26:34 UTC
This issue is documented in:

http://forums.slimdevices.com/showthread.php?t=21113
http://forums.slimdevices.com/showthread.php?t=24952&page=2
http://forums.slimdevices.com/showthread.php?t=18559

In summary, Slimserver is not setting it's supplementary groups to those listed in /etc/groups, which is a problem for people who don't want to have their music libraries world readable, and certainly rather counter intuitive.

Having had a closer look at the code, there were also a couple more problems.  Firstly, Slimserver wasn't removing itself from from any supplementary groups inherited at startup.  When started manually, slimserver was running as with primary group 'slimserv' and supplementary groups, 'wheel' and 'operator', which doesn't seem ideal.  Secondly, although I didn't manage to check it, I think it would have been possible to run slimserver as root by simply running 'slimserver.pl --user root'.

Attached is a patch which reworks changeEffectiveUserAndGroup to try to improve this.  The logic is now as follows:

o  If started as a non root user, don't try to change user / groups.  If --user or --groups was passed, then die.
o  If started as root, change to the user specified and that user's primary and supplementary groups.
o  If --group was specified, add that group to the list of supplementary groups.
o  If --user wasn't specified output a warning, and default to user slimserver.


I've briefly tested this under FreeBSD, and expect no problems under any Unix like systems, Win32 systems are unaffected.    The only query I have is over systems that don't support supplementary groups.  Is anyone aware of any such systems actually running Slimserver?

The patch is against 6.5, but it should apply quite happily against the trunk too.
Comment 1 Christopher Key 2007-08-28 01:28:10 UTC
Created attachment 2122 [details]
Patch as referenced in the bug report
Comment 2 Chris Owens 2007-08-28 10:07:34 UTC
Andy, should bugs like this one where a community member has provided a patch be assigned to you these days for review and  committing?
Comment 3 Andy Grundman 2007-08-28 10:15:33 UTC
Yes, thanks.
Comment 4 Andy Grundman 2007-08-28 12:06:44 UTC
Applied to trunk as change 12766.
Comment 5 Chris Owens 2008-03-07 09:03:14 UTC
This bug is being closed since it was resolved for a version which is now released!  Please download the new version of SqueezeCenter (formerly SlimServer) at http://www.slimdevices.com/su_downloads.html

If you are still seeing this bug, please re-open it and we will consider it for a future release.