I am developing a macOS system service (standalone binary running as a LaunchDaemon) that requires the ability to sign data using a private key which will be deployed via MDM.
The Setup:
Deployment: A .mobileconfig pushes a PKCS12 identity to the System Keychain.
Security Requirement: For compliance and security reasons, we cannot set AllowAllAppsAccess to <true/>. The key must remain restricted.
The Goal: I need to use the private key from the identity to be able to sign the data
The Problem:
The Certificate Payload does not support a TrustedApplications or AccessControl array to pre-authorize binary paths.
As a result, when the process tries to use the private key for signing (SecKeyCreateSignature), it prompts the user to allow this operation which creates a disruption and is not desired.
What i've tried so far:
Manually adding my process to the key's ACL in keychain access obviously works and prevents any prompts but this is not an "automatable" solution.
Using security tool in a script to attempt to modify the ACL in an automated way, but that also asks user for password and is not seamless.
The Question:
Is there a documented, MDM-compatible way to inject a specific binary path into the ACL of a private key?
If not, is there a better way to achieve the end goal?
Security Foundation
RSS for tagRestrict a user’s access to particular features in your macOS app or daemon using Security Foundation.
Posts under Security Foundation tag
2 Posts
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Since the introduction of the siblings / and /System/Volumes/Data architecture, some very basic, critical commands seems to have a broken behaviour ( cp, rsync, tar, cpio…).
As an example, ditto which was introduced more than 10 years ago to integrate correctly all the peculiarity of HFS Apple filesystem as compared to the UFS Unix filesystem is not behaving correctly.
For example, from man ditto:
--rsrc Preserve resource forks and HFS meta-data. ditto will
store this data in Carbon-compatible ._ AppleDouble files
on filesystems that do not natively support resource forks.
As of Mac OS X 10.4, --rsrc is default behavior.
[...]
--extattr Preserve extended attributes (requires --rsrc). As of Mac
OS X 10.5, --extattr is the default.
and nonetheless:
# ls -@delO /private/var/db/ConfigurationProfiles/Store
drwx------@ 5 root wheel datavault 160 Jan 20 2024 /private/var/db/ConfigurationProfiles/Store
*********
com.apple.rootless 28
***************************
# mkdir tmp
# ditto /private/var/db/ConfigurationProfiles tmp
ditto: /Users/alice/Security/Admin/Apple/APFS/tmp/Settings: Operation not permitted
ditto: /Users/alice/Security/Admin/Apple/APFS/tmp/Store: Operation not permitted
# ls -@delO tmp/Store
drwx------ 5 root wheel - 160 Aug 8 13:55 tmp/Store
*
#
The extended attribute on copied directory Store is empty, the file flags are missing, not preserved as documented and as usual behaviour of ditto was since a long time ( macOS 10.5 ).
cp, rsync, tar, cpio exhibit the same misbehaviour. But I was using ditto to be sure to avoid any incompatibility with the Apple FS propriaitary modifications.
As a consequence, all backup scripts and applications are failing more or less silently, and provide corrupted copies of files or directories. ( I was here investigating why one of my security backup shell script was making corrupted backups, and only on macOS ).
How to recover the standard behaviour --extattr working on modern macOS?
Topic:
App & System Services
SubTopic:
Core OS
Tags:
Files and Storage
macOS
Security
Security Foundation