Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 936149 - media-sound/mpd-0.23.15-r1: resets permission of directory on startup 0600 (preventing access for other users)
Summary: media-sound/mpd-0.23.15-r1: resets permission of directory on startup 0600 (p...
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Adrian Schollmeyer
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-07-16 10:15 UTC by simon
Modified: 2024-09-23 11:55 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description simon 2024-07-16 10:15:35 UTC
Running mpd as user mpd and using socket in /var/lib/mpd/ to connect.
With the update from 0.23.13-r1 to 0.23.15-r1 the permissions of this directory are reset to 0600 on startup of mpd.
Not sure if this a upstream issue or not but if blocks access for any user even if in the same group.

Is this directory not suited (it is still listed in the gentoo wiki) or should the permissions be preserved or granted for the group at least?

Reproducible: Always

Steps to Reproduce:
1. upgrade mpd to 0.23.15-r1 
2. restart mpd 
3. try to connect to socket configured for /var/lib/mpd/socket
Actual Results:  
connection fails as user has no access to the directory in which the socket is

Expected Results:  
user can connect
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-07-16 22:47:59 UTC
commit e052555c5ead5ea46c5b8d5ebc61f9e89a4d5fa8
Author: Adrian Schollmeyer <nex+b-g-o@nexadn.de>
Date:   Sun Nov 12 22:11:27 2023 +0100

    media-sound/mpd: add 0.23.15

    The new version removes unnecessary modifications to the default
    configuration and adds default values for creating the PID file and log
    file in FHS directories.

    Co-Authored-By: Jeroen Roovers <jer@xs4all.nl>
    Closes: https://bugs.gentoo.org/872668
    Closes: https://bugs.gentoo.org/918421
    Closes: https://bugs.gentoo.org/919577
    Signed-off-by: Adrian Schollmeyer <nex+b-g-o@nexadn.de>
    Closes: https://github.com/gentoo/gentoo/pull/34469
    Signed-off-by: Joonas Niilola <juippis@gentoo.org>
Comment 2 simon 2024-07-17 06:56:31 UTC
Tried now also using 
@mpd to bind to socket by name only without path in filesystem. Works for ncmpc client but fails in cantata (no longer maintained).

Also using "/var/run/mpd/socket" as alternative worked as the directory is not managed by mpd nor the init script. Both are mentioned at https://mpd.readthedocs.io/en/stable/user.html#client-connections

not sure if this would be the solution in general and an update to wiki would be the way to go?
Comment 3 Adrian Schollmeyer 2024-09-21 15:15:25 UTC
Unfortunately, MPD doesn't properly protect its PID file (Owner root:root with chmod a-rwx), requiring us to protect the directory in which MPD creates its PID file. The second modification applies to the log dir, correcting the owner and granting write access for MPD.

The first of these measures is necessary for security reasons, while the second one is necessary for MPD to even be able to start.

I my opinion, the correct fix would be for users to create the PID and log files in the locations suggested by the default distro config (i.e. apply the change suggested by dispatch-conf). These files should not be touched by regular users, anyway, so keeping them in a directory where potential users might need access is not really a smart idea.

Actually, if you install the default Gentoo config shipped with media-sound/mpd, you should be able to change permissions for /var/lib/mpd and anything beneath it as you please.
Comment 4 simon 2024-09-23 11:55:56 UTC
Ok so the reset of the directory permissions i faced originally (preventing me of using 750 as directory permissions for /var/lib/mpd) was due to the fact that i had the .pid file also configured there (i guess based from an old default configuration which i did not update on etc-update, i assume i usually keep active settings which are working).

Now that i moved out the pid file to /run/mpd i can adapt the permissions of /var/lib/mpd and they are not reset on service restart.

So the problem is solved for me.
Thanks for the hint