How to use BetterAuthorizationSample? – Cocoa
I am trying to use BetterAuthorizationSample rather then go the so called “malicious” way of using setuid in order to get root privileges.
Currently I am using AuthorizationCreate(); with BLAuthentication to have root access to changing some files, but I am somewhat irritated by the fact that I have to constantly enter my password in every time the app launches.
So I came across Apple’s method of a HelperTool, and I just can’t figure it out.
I’ve been working with Cocoa for a couple months now, but this is just out of my reach, yet I still need it. How would I implement this tool to do simple root-privileged tasks?
Is there a simpler way to use the concept of a HelperTool, so that my users can just enter their password once and it would grant root-privileges forever?
Solutions Collect From Internet About “How to use BetterAuthorizationSample? – Cocoa”
The “modern” way to do a helper tool on Mac OS X is to ship it as part of your app, and use the
ServiceManagement framework to deploy it. Your users enter their password once, when deploying the tool. That installs it as a
launchd job; from then on you use any launchd on-demand mechanism to launch the helper and get it to do work for you.
Notice that the blog post linked above recommends that you protect subsequent invocations of the helper with an Authorization Services escalation, to avoid having an arbitrary privilege escalation that anyone can use. This seems like it somewhat impacts the “users can just enter their password once” benefit, although you can use
AuthorizationRightSet() to create your app’s authorization token in the policy database, so you can actually define whether users need to present passwords on first deployment.
The sample code from that post is on GitHub, and demonstrates using
ServiceManagement to deploy the helper tool and Authorization Services to control access to it.
- LLDB Makes Xcode 5.1 Crash on Project Run
- Using Firebase to send and receive push notification for an iOS app
- Combining Navigation Controller with Tab Bar Controller
- Coloration of UIButtons of type UIButtonTypeRoundedRect
- CocoaPods and Swift 3.0
- TestFight beta testing for internal testers – Build state is “processing”
- Xcode: libpods.a is red
- Removing iOS SDKs from OSX
- How can I perform hardware-accelerated H.264 encoding and decoding for streaming?
- NSString initWithData returns null
- App Crashing: Mutating method sent to immutable object
- Swift 4 Codable decoding json
- How To Replace UITableView With Image?
- iOS SpriteKit – collisions and contacts not working as expected
- Mobile Safari: Audio + cache manifest