ajdali wrote:
To say that any application configured as a launch agent or daemon
cannot simply get the connected SSID
Hmmm, that’s not what I said. Rather, there’s a agent vs daemon split here:
-
I think it’s feasible for a launchd
agent to get the location privilege and thus get access to this info. See below.
-
In contrast, as things currently stand I don’t think it’s feasible for a daemon to do this.
then what should we expect in the future?
Realistically, more of the same |-: There was a great quote about this way back at WWDC 2017, which I highlighted in a footnote on this post.
stenya wrote:
There is no way to obtain location permissions for non-UI apps, like
simple console apps. Is that correct?
There’s no way to answer that as written because the term “console app” isn’t one I use. You’re talking about a Mach-O executable here, but its behaviour depends on the context in which it’s run. For example, whether it’s:
-
Run by the user in Terminal
-
Run by the user over SSH
-
Run by an app as a ‘helper tool’
-
Run by launchd
as an agent
-
Run by launchd
as a daemon
As far as I understood your previous comments, LaunchAgent installed
by SMAppService
can obtain Location permissions and retrieve SSID
info. What are the requirements for this?
Lemme explain the backstory here…
Most privileges like this are managed by TCC and it has a good understanding of the concept of responsible code [1]. So, if your launchd
agent has a GUI app as its responsible code then granting the TCC privilege to the GUI app also grants it to your agent. I’ve tested this numerous times and it works reasonably well.
The tricky part here is Core Location, which doesn’t use the standard TCC infrastructure to manage its privilege [2]. I’ve not actually sat down to test the launchd
agent to responsible GUI app path for the location privilege.
If you want to try this out, create a GUI app that acquires both a standard TCC privilege, like Input Monitoring, and the location privilege. Then use that to install an agent and see if it ‘inherits’ those privileges from the responsible GUI app. I know that’ll work for Input Monitoring [3]. Does it work for the location privilege?
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
[1] I define that term in On File System Permissions.
[2] Because a) Core Location needs more flexibility than most TCC-managed privileges, and b) Core Location was one of the first privileges like this.
[3] Ah, um, it worked the last time I tested it, on macOS 13. I haven’t tried this on macOS 14 yet. AFAIK nothing has changed there but… *shrug*