Skip to content

Support OpenBSD#31

Merged
mikebrady merged 3 commits intomikebrady:mainfrom
klemensn:openbsd
Feb 25, 2024
Merged

Support OpenBSD#31
mikebrady merged 3 commits intomikebrady:mainfrom
klemensn:openbsd

Conversation

@klemensn
Copy link
Contributor

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

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.)
@klemensn
Copy link
Contributor Author

klemensn commented Feb 1, 2024

@mikebrady Shall I rebase onto development as is done for shairport-sync?

@mikebrady
Copy link
Owner

Thanks for all this! Let me take a look at it.

@klemensn
Copy link
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.

@klemensn
Copy link
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.

Like the shairport-sync PR, this one is ready for review/merge as well.
Let me know if there's anything to sort out.

@mikebrady mikebrady merged commit 5cd5e6e into mikebrady:main Feb 25, 2024
@mikebrady
Copy link
Owner

Many thanks!

@klemensn klemensn deleted the openbsd branch February 26, 2024 14:23
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.

2 participants