Skip to content
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

Make Unix sockets writable for user group #56

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

very-amused
Copy link

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.

Copy link

@djmattyg007 djmattyg007 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a feature flag for this?

mopidy_mpd/network.py Outdated Show resolved Hide resolved
@very-amused
Copy link
Author

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
Copy link

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.

Modified the call signature Server.create_server_socket to accept
socket_permissions as an optional parameter. get_socket_umask will
return the default umask of `0o002` when called with no explicit
permissions.
@very-amused
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants