An open community 
of Macintosh users,
for Macintosh users.

FineTunedMac Dashboard widget now available! Download Here

Previous Thread
Next Thread
Print Thread
displaying messages to remote computers
#33545 03/25/15 12:31 PM
Joined: Aug 2009
OP Offline

Joined: Aug 2009
I used to be able to push this terminal command with remote desktop, or ssh into a computer (as root) and enter it, to display a message for the user:

osascript -e "tell application \"System Events\" to display dialog \"access to Video Server has been restored\" buttons {\"OK\"} default button 1 with title \"Message from Administrator\" with icon file \"Macintosh HD:System:Library:CoreServices:Feedback Assistant.app:Contents:Resources:State-Success.icns\""

But sometime around 10.7 apple appears to have blocked applescript's access between user processes. From what I can tell, applescript can't "send messages to processes outside its call chain from LoginWindow". Whatever the specific issue, I'd like to be able to continue to display messages as needed. I can't be logged in as the user, since I don't know their password. Prepending "sudo -u theirusername " doesn't help either.

Any ideas?


I work for the Department of Redundancy Department
Re: displaying messages to remote computers
Virtual1 #33547 03/25/15 03:36 PM
Joined: Aug 2009
Likes: 8
Offline

Joined: Aug 2009
Likes: 8
No solution. Just wanted to compliment you on the nature of your issues (here and in other postings). You do not have run of the mill problems and you help to keep all of us on our toes in pursuit of solutions, etc.

Thanks. smirk


On a Mac since 1984.
Currently: 24" M1 iMac, M2 Pro Mac mini with 27" BenQ monitor, M2 Macbook Air, MacOS 14.x; iPhones, iPods (yes, still) and iPads.
Re: displaying messages to remote computers
Ira L #33550 03/25/15 07:06 PM
Joined: Aug 2009
OP Offline

Joined: Aug 2009
"The difficult I solve immediately. The impossible takes a little longer."


I work for the Department of Redundancy Department
Re: displaying messages to remote computers
Virtual1 #33551 03/25/15 07:24 PM
Joined: Aug 2009
Likes: 15
Online

Joined: Aug 2009
Likes: 15
Just to clarify, is this a sandbox issue?


The new Great Equalizer is the SEND button.

In Memory of Harv: Those who can make you believe absurdities can make you commit atrocities. ~Voltaire
Re: displaying messages to remote computers
Virtual1 #33554 03/25/15 10:13 PM
Joined: Aug 2009
Likes: 3
Moderator
Offline
Moderator

Joined: Aug 2009
Likes: 3

Are you sure you've done this more recently than, say, 2008?

I ask because that's when the notorious ARDAgent / Applescript root exploit surfaced, Apple's eventual cure for which was "not loading scripting addition plugins into applications running with system privileges."

Despite the invocation of System Events in your script, do shell script and, for that matter, display dialog, are both is part of Standard Additions.

Last edited by dkmarsh; 03/25/15 10:26 PM.


dkmarsh—member, FineTunedMac Co-op Board of Directors
Re: displaying messages to remote computers
dkmarsh #33563 03/26/15 12:23 PM
Joined: Aug 2009
OP Offline

Joined: Aug 2009
the ARD thing was basically this: When running remote desktop, one thing you can do is "send shell script". This script can either run as the current user on the target computer, or as root. (practically all of the time you want to run it as root, though, annoyingly, as user is the default) To do this, the admin tells the client to execute the command. It appears to have used applescript as a channel to do this. So basically the exploit was to use the same method (locally) to tell the local ARD client to run the shell command, as root.

To fix this probably required substantial re-engineering of how ARD sends shell commands.

I don't know if its related to my issue or not, it's quite possible. I don't know for certain when it stopped working, but my best memory is around 10.6 or 10.7. (it may have worked in 10.6 until a specific update hit)

I've been mulling it over. I also needed a way for users to resume a printer queue that was paused, which a standard user doesn't have the authority to do. (if a printer runs out of paper while a user is printing, it will pause. if they don't fix it and log out, the printer remains paused on the commuter FOR ALL USERS until an admin unpauses it) So I had to write a daemon that unpauses printers for users when they log in. It sent a request to a daemon that was running as root, whose only feature was to unpause printers) I have since gotten rid of that since I figured out how to allow non-admins to resume queues, but I could use the same technique here I think. Store a text string in the user's home in a hidden file, owned by the user, ~/.message for example. Have a launch agent running for the user, and if it sees that file and it's owned by the user, display the dialog using the text in the file, and remove the message file. Convoluted, but functional. *shrug*

I certainly do seem to be running into lots of opportunities to create very creative and customized solutions in my new job...



OK weirdness ensues... if I login as root and try this:

osascript -e "tell application \"System Events\" to display dialog \"access to Video Server has been restored\" buttons {\"OK\"} default button 1 with title \"Message from Administrator\" with icon file \"Macintosh HD:System:Library:CoreServices:Feedback Assistant.app:Contents:Resources:State-Success.icns\""

it gives me:

36:284: execution error: An error of type -10810 has occurred. (-10810)

BUT... if I use ARD to send shell command to the computer, with a user logged in, and send the above command as root, it WORKS.

yeah, ARD is definitely hacking around the system's security now.


I work for the Department of Redundancy Department

Moderated by  alternaut, dkmarsh, joemikeb 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.4.33 Page Time: 0.474s Queries: 26 (0.016s) Memory: 0.5958 MB (Peak: 0.6673 MB) Data Comp: Zlib Server Time: 2024-04-20 09:36:07 UTC
Valid HTML 5 and Valid CSS