I am developing an Authorisation Plugin which talks to Launch daemons over XPC.
Above is working neat, now I have to decide on how to get it installed on a machine.
Installation requires.
- Plugin Installation
- Launch Daemon Installation
Both require
- Moving binary and text (.plist) file into privileged system managed directory.
- Firing install/load commands as root (sudo).
I have referred this post BSD Privilege Escalation on macOS, but I am still not clear how to approach this.
Q: My requirement is:
I can use .pkg
builder and install via script, however I have some initialisation task that needs to be performed. User will enter some details talk to a remote server and get some keys, all goes well restarts the system and my authorisation plugin will welcome him and get him started.
If I cannot perform initialisation I will have to do it post restart on login screen which I want to avoid if possible.
I tried unconventional way of using AppleScript from a SwiftUI application to run privileged commands, I am fine if it prompts for admin
credentials, but it did not work.
I don't want that I do something and when approving it from Apple it gets rejected.
Basically, how can I provide some GUI to do initialisation during installation or may be an app which helps in this.
Q: Please also guide if I am doing elevated actions, how will it affect app distribution mechanism. In Read Me for EvenBetterAuthorizationSample
I read it does.
Thanks.
Please also guide if I am doing elevated actions, how will it affect app distribution mechanism.
I’m not 100% I understand what you’re asking here, but my best guess is that it’s about App Store distribution versus direct distribution using Developer ID signing. If so, then the answer is clear: Authorisation plug-ins can’t be distributed on the App Store.
As to your overall strategy here, IMO it depends on the focus of your product. Most authorisation plug-in vendors target managed environments — business, education, and so on — and in that context an installer package makes a lot of sense. Management (MDM) systems have good infrastructure for dealing with installer packages.
Implementing a self-install mechanism makes more sense if you’re targeting normal Mac users. They typically expect to download the app, as a zip archive or disk image, and then just run it.
Of course, there’s nothing stopping you from doing both, other than the amount of extra engineering team it’ll consume.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"