mopidy / mopidy-mpd

Mopidy extension for controlling playback from MPD clients
https://mopidy.com/ext/mpd/
Apache License 2.0
99 stars 21 forks source link

Make Unix sockets writable for user group #56

Open very-amused opened 2 years ago

very-amused commented 2 years ago

When Mopidy is run as a system service under the mopidy user, Unix sockets are currently created with a umask of 022, which makes other users unable to connect due to having no write permission. This PR ensures Unix sockets are created with a umask of 002, making them writable to users in the mopidy group and thus usable to users added to this group.

very-amused commented 2 years ago

The try/finally clause that was requested has been added. I don't see the need for a feature flag to enable this behavior, I believe making sockets group-writable is a sane default.

djmattyg007 commented 2 years ago

I don't see the need for a feature flag to enable this behavior, I believe making sockets group-writable is a sane default.

While I agree with you, this code removes the ability of users to control the umask themselves for this socket, so it's worth thinking about.

very-amused commented 2 years ago

Apologies for the lack of updates for a while. I just implemented the config option mpd/socket_permissions with a default value of 775. The behavior of making Unix sockets group-writable by default is retained, while allowing users to control the umask themselves if desired.