OpenAFS Master Repository branch, master, updated. openafs-devel-1_9_2-27-g89eafda
Gerrit Code Review
gerrit@openafs.org
Fri, 6 Dec 2024 11:13:45 -0500
The following commit has been merged in the master branch:
commit 120871f03f38538cbaf3b25d6b2bca08d0f4652d
Author: Marcio Barbosa <mbarbosa@sinenomine.net>
Date: Sat Nov 23 06:46:52 2024 -0800
DARWIN: Add 'privhelper' tool for PrefPane
The prefpane for macOS runs as the logged-in user, but needs root access
for some operations: starting/stopping the client, editing various
configuration files like CellServDB, etc. We currently use functions
like AuthorizationExecuteWithPrivileges() to run commands with root
privileges directly, but this approach no longer works as of macOS 10.8
(Mountain Lion); the relevant functions have been removed.
Instead, a new approach exists as of macOS 10.6 (Snow Leopard). The
prefpane application itself cannot gain root privileges, but we can
provide another daemon process that runs as root, and the PrefPane sends
requests to that process to perform the privileged operations we need.
In this commit, create a separate helper program called PrivilegedHelper
(privhelper for short) that serves this purpose. Define the
executePrivTask() method in TaskUtil to handle communicating with
privhelper over XPC.
This commit does not define any of the tasks that privhelper will
actually perform; this just implements privhelper itself. Later commits
will add and use various privileged tasks in privhelper.
In order for privhelper to be able to run as root, both privhelper and
the prefpane itself must be code signed and the relevant apple team id
must be specified in their Info.plist when they are built, as well as
inside privhelper.c. Currently, we have
no way of specifying code signatures info during the build, since all code
signing is done when generating packages (via pkgbuild.sh) after
binaries are built. For now, just put a commented-out section in
src/platform/DARWIN/AFSPreference/Info.plist and
src/platform/DARWIN/PrivilegedHelper/privhelper-info.plist and a
placeholder in src/platform/DARWIN/PrivilegedHelper/privhelper.c to show
how to add this information. The package builder must add their own team
id to these before privhelper can work properly.
The privhelper tool checks that the calling user has authorization to
run commands as root (via AuthorizationCopyRights()), and that the
calling process is either our AFSBackgrounder menu bar or the prefpane.
We use xpc_connection_set_peer_code_signing_requirement() for this where
available, but fallback to using SecCodeCheckValidity() with
SecCodeCreateWithXPCMessage() or
xpc_dictionary_get_audit_token()/SecCodeCopyGuestWithAttributes() if
needed.
Change-Id: I724b6d486ee5397c89c79e589ddcb2a5987a895b
Reviewed-on: https://gerrit.openafs.org/15956
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Makefile.in | 1 +
configure.ac | 1 +
src/packaging/MacOS/OpenAFS.post_install | 37 ++
src/packaging/MacOS/OpenAFS.pre_upgrade | 5 +
src/packaging/MacOS/Uninstall.14.15 | 14 +-
.../DARWIN/AFSPreference/AFSCommanderPref.m | 11 +
src/platform/DARWIN/AFSPreference/AuthUtil.h | 2 +
src/platform/DARWIN/AFSPreference/AuthUtil.m | 10 +
src/platform/DARWIN/AFSPreference/Info.plist | 8 +
src/platform/DARWIN/AFSPreference/TaskUtil.h | 3 +
src/platform/DARWIN/AFSPreference/TaskUtil.m | 88 +++++
src/platform/DARWIN/Makefile.in | 8 +-
src/platform/DARWIN/PrivilegedHelper/Makefile.in | 29 ++
.../DARWIN/PrivilegedHelper/privhelper-info.plist | 21 ++
.../PrivilegedHelper/privhelper-launchd.plist | 13 +
src/platform/DARWIN/PrivilegedHelper/privhelper.c | 392 +++++++++++++++++++++
16 files changed, 637 insertions(+), 6 deletions(-)
--
OpenAFS Master Repository