chilcote / outset

Automatically process packages, profiles, and scripts during boot, login, or on demand.
572 stars 58 forks source link

Running from --login command, but getting error when actually logging in #74

Closed GabeShack closed 3 years ago

GabeShack commented 4 years ago

Im getting 2020-08-05 02:18:12 PM - INFO: Output from /usr/local/outset/login-every/1stTrigger.sh on stderr but it still ran successfully: b'sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper\n' Thats when I leave it on login-every, if I move it to privileged login it states Output from /usr/local/outset/login-privileged-every/1stTrigger.sh on stderr but it still ran successfully: b'sudo: jamf: command not found\n' when trying to make a script call a policy in my Jamf server which is `

!/bin/sh

sudo jamf policy -trigger policyname exit 0`

I'm sure this is a simple issue since Im new to Outset.

chilcote commented 4 years ago

you're running sudo in a script that's triggered by a LaunchAgent?

GabeShack commented 4 years ago

I suppose instead of calling the script from my JAMF server I can just put the script directly in outset to run at login.

Gabe Shackney Coordinator of Device Operations and Systems Integration Princeton Public Schools 609-806-4299 x2

On Aug 5, 2020, at 3:54 PM, Joseph Chilcote notifications@github.com wrote:



you're running sudo in a script that's triggered by a LaunchAgent?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/chilcote/outset/issues/74#issuecomment-669461837, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AMYXY7DGQ67WMXQS6CWIEMTR7G2FJANCNFSM4PVYYDXQ.

chilcote commented 4 years ago

You might have luck using privileged login without the sudo in the script (since those are already run as root). But I'm not sure I ever tried triggering a jamf policy in this manner.

gregneagle commented 4 years ago

also, given this message (b'sudo: jamf: command not found\n') you should probably provide the full path to the jamf tool since it does not appear to be in the PATH effective when that job runs.

GabeShack commented 4 years ago

Changed the path and removed the sudo and error is now ERROR: Failure processing /usr/local/outset/login-privileged-every/1stTrigger.sh: [Errno 1] Operation not permitted: '/usr/local/outset/login-privileged-every/1stTrigger.sh'

Gabe Shackney Coordinator of Device Operations and Systems Integration Princeton Public Schools 609-806-4299 x2

On Aug 5, 2020, at 4:27 PM, Greg Neagle notifications@github.com<mailto:notifications@github.com> wrote:

also, given this message (b'sudo: jamf: command not found\n') you should probably provide the full path to the jamf tool since it does not appear to be in the PATH effective when that job runs.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/chilcote/outset/issues/74#issuecomment-669485200, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AMYXY7EZTTEW5GNX4NRK2LLR7G6BXANCNFSM4PVYYDXQ.

GabeShack commented 4 years ago

So if I take the scripts and directly put them in login-every and run it from the command line it works and looks like it is working on login as well with the full scripts. I only wanted to call the jamf tool to trigger it from our server since then i could track the records of it running.

Gabe Shackney Coordinator of Device Operations and Systems Integration Princeton Public Schools 609-806-4299 x2

On Aug 5, 2020, at 4:51 PM, Gabe gabeshackney@princetonk12.org<mailto:gabeshackney@princetonk12.org> wrote:

Changed the path and removed the sudo and error is now ERROR: Failure processing /usr/local/outset/login-privileged-every/1stTrigger.sh: [Errno 1] Operation not permitted: '/usr/local/outset/login-privileged-every/1stTrigger.sh'

Gabe Shackney Coordinator of Device Operations and Systems Integration Princeton Public Schools 609-806-4299 x2

On Aug 5, 2020, at 4:27 PM, Greg Neagle notifications@github.com<mailto:notifications@github.com> wrote:

also, given this message (b'sudo: jamf: command not found\n') you should probably provide the full path to the jamf tool since it does not appear to be in the PATH effective when that job runs.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/chilcote/outset/issues/74#issuecomment-669485200, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AMYXY7EZTTEW5GNX4NRK2LLR7G6BXANCNFSM4PVYYDXQ.

GabeShack commented 4 years ago

Again in testing I am still getting an error when running a call to the jamf server: 2020-08-07 02:00:07 PM - ERROR: Failure processing /usr/local/outset/login-privileged-once/Trigger 1st.sh: [Errno 1] Operation not permitted: '/usr/local/outset/login-privileged-once/Trigger 1st.sh running script: #!/bin/sh /usr/local/jamf/bin/jamf policy -trigger 1st

gregneagle commented 4 years ago

If that is literally your script it is formatted wrong. It should be

#!/bin/sh
/usr/local/jamf/bin/jamf policy -trigger 1st
GabeShack commented 4 years ago

Paste did not format correctly but yes that is it and it will not run without that error

gregneagle commented 4 years ago

What is the owner, group, and mode for "/usr/local/outset/login-privileged-once/Trigger 1st.sh"? And does it behave better if "Trigger 1st.sh" is renamed to "Trigger_1st.sh", eliminating the space?

GabeShack commented 4 years ago

root:admin 755

Trying again without the space now.

GabeShack commented 4 years ago

2020-08-07 02:28:00 PM - INFO: Processing /usr/local/outset/login-privileged-once/Trigger1st.sh 2020-08-07 02:28:00 PM - ERROR: Failure processing /usr/local/outset/login-privileged-once/Trigger1st.sh: b''

Slightly further...does the script require an exit 0?

gregneagle commented 4 years ago

could /usr/local/jamf/bin/jamf policy -trigger 1st be returning non-zero? This is a different failure than "ERROR: Failure processing /usr/local/outset/login-privileged-once/Trigger 1st.sh: [Errno 1] Operation not permitted: '/usr/local/outset/login-privileged-once/Trigger 1st.sh"

GabeShack commented 4 years ago

Failure processing /usr/local/outset/login-privileged-once/Trigger1st.sh: [Errno 1] Operation not permitted: '/usr/local/outset/login-privileged-once/Trigger1st.sh' is what I get when I add an exit 0

chilcote commented 4 years ago

Is this resolved?

arubdesu commented 3 years ago

@GabeShack can you let this issue close? Feel free to ask for further assistance in MacAdmins slack - invites are here, outset-specific channel is here

GabeShack commented 3 years ago

In the way we wanted to use this, it just didn't work for our environment.