Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Message not shown on OS X 10.10 Yosemite #48

Closed
jarias opened this issue Oct 20, 2014 · 22 comments
Closed

Message not shown on OS X 10.10 Yosemite #48

jarias opened this issue Oct 20, 2014 · 22 comments

Comments

@jarias
Copy link

jarias commented Oct 20, 2014

I trigger a message from the web interface but it didn't show up, looking at the logs the command was trigger but for some reason didn't execute.

From the logs:

10/20/14 2:51:28.607 PM sudo[728]:     prey : TTY=unknown ; PWD=/usr/lib/prey/versions/1.2.10 ; USER=root ; COMMAND=/usr/bin/su jarias -c "osascript" "-e" "tell app \"System Events\" to display dialog \"Test\" with title \"Important\" buttons \"OK\""
@jarias
Copy link
Author

jarias commented Oct 20, 2014

If I run the command manually it just hangs after I input my password

/usr/bin/su jarias -c "osascript" "-e" "tell app \"System Events\" to display dialog \"Test\" with title \"Important\" buttons \"OK\""

If I run it without "su" it works fine.

@tomas
Copy link
Contributor

tomas commented Oct 20, 2014

Interesting. What happens with the other actions? Does lock work, for instance? (Trying to understand if this is an impersonation problem or just related to osascript).

@jarias
Copy link
Author

jarias commented Oct 20, 2014

Haven't test it, I'll let you know

@tomas
Copy link
Contributor

tomas commented Oct 21, 2014

Any news?

@jarias
Copy link
Author

jarias commented Oct 21, 2014

Yup didn't work I see like a million of these:

10/21/14 4:31:59.690 PM sudo[23754]:     prey : TTY=unknown ; PWD=/usr/lib/prey/versions/1.2.10 ; USER=root ; COMMAND=/usr/bin/su jarias -c "/usr/lib/prey/versions/1.2.10/lib/agent/actions/lock/mac/prey-lock" "XXXXXXXX"

If I run it in the console I get

/usr/bin/su jarias -c "/usr/lib/prey/versions/1.2.10/lib/agent/actions/lock/mac/prey-lock" "e75f0173be748b6f68b3feb61255693c"
Password:
Traceback (most recent call last):
  File "/usr/lib/prey/versions/1.2.10/lib/agent/actions/lock/mac/prey-lock", line 15, in <module>
    from AppKit import *
ImportError: No module named AppKit

I think the problem is the shim on the python script and my environment, I have homebrew python installed and overriding the system python by modifying the PATH and the script uses:

#!/usr/bin/env python

But that doesn't explains the osascript issue

@jarias
Copy link
Author

jarias commented Oct 21, 2014

The sound alarm option did work.

@jarias
Copy link
Author

jarias commented Oct 21, 2014

Here is more logs that I didn't notice after trigering the popup message

10/21/14 4:42:32.461 PM com.apple.xpc.launchd[1]: (com.apple.xpc.launchd.domain.system) Caller not allowed to perform action: osascript.46448, action = service submission, code = 1: Operation not permitted, uid = 501, euid = 501, gid = 20, egid = 20, asid = 100000
10/21/14 4:42:32.470 PM com.apple.xpc.launchd[1]: (com.apple.xpc.launchd.domain.system) Caller not allowed to perform action: osascript.46448, action = legacy spawn, code = 1: Operation not permitted, uid = 501, euid = 501, gid = 20, egid = 20, asid = 100000
10/21/14 4:42:32.470 PM osascript[46448]: spawn_via_launchd() failed, errno=1 label=[0x0-0x1c61c6].com.apple.systemevents path=/System/Library/CoreServices/System Events.app/Contents/MacOS/System Events flags=0 : LaunchApplicationClient.cp #963 LaunchApplicationWithSpawnViaLaunchD() q=com.apple.main-thread
10/21/14 4:42:32.470 PM osascript[46448]: spawn_via_launchd() failed, errno=1 label=[0x0-0x1c61c6].com.apple.systemevents path=/System/Library/CoreServices/System Events.app/Contents/MacOS/System Events flags=0

@tomas
Copy link
Contributor

tomas commented Oct 21, 2014

Great, thanks for all the info. I guess we'll need to do a similar thing to the system Ruby call that we did for launching the GUI. What do get out of this command?

/System/Library/Frameworks/Python.framework/Versions/Current/bin/python --version

@jarias
Copy link
Author

jarias commented Oct 21, 2014

Python 2.7.6

What do you think about the osascript? looks like some issue with permissions.

@tomas
Copy link
Contributor

tomas commented Oct 21, 2014

Yeah, I've been hitting my head trying to get around that. The only similar issue that I found was this one:

http://apple.stackexchange.com/questions/151453/error-while-trying-to-open-new-emacs-app-after-upgrade-to-yosemite

Does that apply to your setup as well?

@tomas
Copy link
Contributor

tomas commented Oct 21, 2014

Another quick question. Does /usr/bin/python point to the system one or the one you installed via brew?

@tomas
Copy link
Contributor

tomas commented Oct 23, 2014

Any news @jarias ? :)

@jarias
Copy link
Author

jarias commented Oct 23, 2014

Yeah homebrew doesn't modify any system software, I just modify the PATH so my homebrew python my default.

@dodysw
Copy link

dodysw commented Nov 21, 2014

I saw tons of these messages, and sending message does not work on yosemite.

11/21/14 15:39:52.197 com.apple.xpc.launchd[1]: (com.prey.trigger[1910]) Service could not initialize: 14B25: xpcproxy + 14045 [1344][1016C726-9ACF-3A24-9C51-A279F5C6B167]: 0x2
11/21/14 15:39:52.197 com.apple.xpc.launchd[1]: (com.prey.trigger) Service only ran for 0 seconds. Pushing respawn out by 10 seconds.

@jarias
Copy link
Author

jarias commented Dec 2, 2014

Looks like the latest release fix this

Yosemite: 10.10.1
Prey Node Client: 1.3.1

@jarias jarias closed this as completed Dec 2, 2014
@tomas
Copy link
Contributor

tomas commented Dec 2, 2014

Boom! Excellent. Thanks for the help.

@fritz-fritz
Copy link

@tomas Did this revert? I'm experiencing the same issues described here in prey 1.3.9 on OS X 10.10.3.

If i open the prey console in terminal I can issue a lock but I cannot from the web interface even though it will report the action active.

@mauricioschneider
Copy link
Contributor

@fritz-fritz what about running the following command?

# that's the md5 for the password "preyrocks"
/usr/lib/prey/current/lib/agent/actions/lock/mac/prey-lock e75f0173be748b6f68b3feb61255693c

@fritz-fritz
Copy link

double checked the md5 first then ran the above line and it locked properly as both my user and as the prey user.

@fritz-fritz
Copy link

@lemavri Did some further digging after investigating the console log. I see this multiple times a second:

5/4/15 1:36:59.525 PM sudo[91730]:     prey : a password is required ; TTY=unknown ; PWD=/usr/lib/prey/versions/1.3.9/lib/agent/actions/lock/mac ; USER=root ; COMMAND=/usr/bin/su fritzfritz -c "/usr/lib/prey/versions/1.3.9/lib/agent/actions/lock/mac/prey-lock" "e75f0173be748b6f68b3feb61255693c"

It seems the problem is with the quoting of the MD5 hash as seen below:

MacBook-Pro:~ root# cd /usr/lib/prey/versions/1.3.9/lib/agent/actions/lock/mac
MacBook-Pro:mac root# /usr/bin/su fritzfritz -c "/usr/lib/prey/versions/1.3.9/lib/agent/actions/lock/mac/prey-lock" "e75f0173be748b6f68b3feb61255693c"
You need to pass an MD5 hexdigested string.

Works after changed to this:

MacBook-Pro:mac root# /usr/bin/su fritzfritz -c "/usr/lib/prey/versions/1.3.9/lib/agent/actions/lock/mac/prey-lock e75f0173be748b6f68b3feb61255693c"
Process PID: 90706

@mauricioschneider
Copy link
Contributor

Thanks @fritz-fritz, that's a very helpful feedback. I'll look into the issue.

@fritz-fritz
Copy link

@lemavri Same problem with the alert message. Also a quote encapsulation issue.
Console:

5/4/15 1:49:37.649 PM sudo[94449]:     prey : a password is required ; TTY=unknown ; PWD=/usr/lib/prey/versions/1.3.9 ; USER=root ; COMMAND=/usr/bin/su fritzfritz -c "/usr/lib/prey/versions/1.3.9/lib/agent/actions/alert/darwin/flash.py" "-l" "info" "This device is stolen property. Please contact *** to arrange its safe return."

Command executed in terminal:

MacBook-Pro:mac root# cd /usr/lib/prey/versions/1.3.9/
MacBook-Pro:1.3.9 root# /usr/bin/su fritzfritz -c "/usr/lib/prey/versions/1.3.9/lib/agent/actions/alert/darwin/flash.py" "-l" "info" "This device is stolen property. Please contact *** to arrange its safe return."
usage: flash.py [-h] [-t TITLE] [-e ENTRY] [-l LEVEL] message
flash.py: error: too few arguments

Fixed:

MacBook-Pro:1.3.9 root# /usr/bin/su fritzfritz -c "/usr/lib/prey/versions/1.3.9/lib/agent/actions/alert/darwin/flash.py -l info 'This device is stolen property. Please contact *** to arrange its safe return.'"
2015-05-04 13:52:37.316 Python[95091:840592] Couldn't contact spell checker for U.S. English

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants