Merged
Conversation
Recognise the system to configure, build and start. More work is required to actually work with shairport-sync. Tested on OpenBSD/amd64 7.4-current.
bind(2)ing ports below 1024 is the only privileged operation NQPTP does. Move its code up in main() before shared memory handling such that root privileges can be dropped immediately after it; no currently supported system does that, thus this should be a NOOP. Do so on OpenBSD where shm_open(3) does not allow access to shared memory objects by multiple UIDs, i.e. to communicate, shairport-sync and NQPTP must create them and run as the very same user. OpenBSD's official audio/shairport-sync user provides an rc.d(8) daemon script that runs as `_shairport` user.
Use pledge(2) to prevent fork/exec, filesystem access and other unused subsets of system calls, effectively leaving only shared memory and networking capabilities at runtime. (Those might be further reduced, but that warrants further analysis and most likely more code shuffling.)
Contributor
Author
|
@mikebrady Shall I rebase onto |
Owner
|
Thanks for all this! Let me take a look at it. |
Contributor
Author
|
@mikebrady If you want, I can also split out configure/build fixes from the more delicate (and important!) code hoisting and pledge(2) usage. |
Contributor
Author
Like the shairport-sync PR, this one is ready for review/merge as well. |
Owner
|
Many thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Build fixes, integration with shairport-sync and security improvements.
Running as unprivileged user could be moved from OpenBSD specific macros to proper configure flags,
then other non-Linux systems can avoid running as root as well.
Requires mikebrady/shairport-sync#1793