-
Notifications
You must be signed in to change notification settings - Fork 193
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
Root permission required #2
Comments
It seems, that I've got carried away a little bit with my non-root assumption. At first, root was not required, but later I've added permissions related code, which is not compatible with this statement. However, I'm not sure if forcing root user is a good idea. I'll explain how it works right now, and maybe you will have some thoughts regarding this issue - I'm open to any suggestions. From the user perspective, connected Bluetooth device should be seen as an extra audio device. All actions (reading, writing, controlling) should be managed with the same permissions as other ALSA devices (e.g. PCI audio card). Therefore, I'm using the "audio" group to manage access permissions. That's why you see "Permission denied" message - user bluealsa is not able to change controller socket group to "audio". Starting daemon with Internally, bluealsa has to register audio profiles in BlueZ, which is done via D-Bus. However, accessing BlueZ interface is controlled via the policy file /etc/dbus-1/system.d/bluetooth.conf (at least on gentoo). Obviously, root has granted access, but bluealsa user has not. I haven't seen this issue before, because my user belongs to the plugdev group, so I'm also able to interact with BlueZ. So, long story sort. After granting BlueZ access to user bluealsa:
and changing daemon group to audio:
I'm now able to run bluealsa as a non-root user and any user who belongs to the audio group is able to connect to virtual Bluetooth PCM device. I've tested this on the current master snapshot, however v1.1.0 should be compatible. |
Thanks for reply and explanation, I'll poke at this some more and report how things went 😄 |
I can make bluealsa part of the plugdev group to fix that. The problem I see now is that bluealsa (any non root user probably) is not allowed create files/dirs in But then when I try to create the bluealsa dir in |
Had a quick look at avahi, they appear to set everything up (pid file, dirs etc) and then drop root privileges. |
I've chosen
Why not just create this directory within the init script? Before running
I know this is kinda ugly, however I'm not sure if dropping privileges is necessary. I'm not against the idea of dropping privileges, but bluealse does not require root privileges (in theory). It does not interact with the OS in a destructive way. The only interaction it has, is with D-Bus and filesystem. Incorporating setreuid in the codebase requires new program argument. Then, if there is --user argument, it is kind of natural to add --group argument. Then (like in e.g. avahi) I might add PID file, which brings the need of adding code for daemonization. And so on, and so on :) I'm not against new features, but new features (imho) should be related to the problem the program is trying to solve. Since, there is |
Yeah, adding all that is a bit much for bluealsa. I submitted my modified ebuild and init script to the gentoo bug tracker [1]. It builds and runs correctly now, creating the directory if needed. Thanks for the help 😄. |
bluealsa is supposed to run in "audio" group, see arkq/bluez-alsa#2 (comment)
bluealsa is supposed to run in "audio" group, see arkq/bluez-alsa#2 (comment) Closes: #3968 [via git-merge-pr]
According to the README [1] is should be possible to run this as non root user as long as bluealsa can write to `/var/run/bluealsa``. I tried that with version 1.1.0 as user bluealsa but it fails not being able to initialize a thread.
[1] root privileges are not required per se, the only requirement is a write access to /var/run/bluealsa
The text was updated successfully, but these errors were encountered: