benwhitis / Jamf_Conditional_Access

Resources and documents for the Jamf Pro/Azure AD Conditional Access integration
MIT License
49 stars 5 forks source link

Self Service Crash with User Registration Prompt.zsh #7

Open jaedwards24 opened 1 month ago

jaedwards24 commented 1 month ago

This script worked well for us until sometime recently. Now launching the Self Service policy with "jamfselfservice://..." results in Self Service launching and immediately crashing.

Jamf Support said this could be an issue with zsh and to try bash. Running the script with bash had the same result though.

benwhitis commented 1 month ago

Hey @jaedwards24

There's currently a known issue with macOS Self Service - PI119354: Self Service macOS Crashes when using URL schemes to open content

The issue does not occur if Self Service is already running before we call the URL scheme. We could use that to our advantage with this script by opening Self Service 1 line before opening the specific policy.

Lines 347 through 348 currently look like this: su - "${loggedInUser}" -c "/usr/bin/killall Self\ Service" su - "${loggedInUser}" -c "/usr/bin/open \"jamfselfservice://content?entity=policy&id=$jamfProPolicyID&action=view\""

We could add one line after the killall Self\ Service to open it, then wait a few seconds before running the URL: su - "${loggedInUser}" -c "/usr/bin/open /Applications/Self\ Service.app" && sleep 3

Lines 347 through 349 would now look like this: su - "${loggedInUser}" -c "/usr/bin/killall Self\ Service" su - "${loggedInUser}" -c "/usr/bin/open /Applications/Self\ Service.app" && sleep 3 su - "${loggedInUser}" -c "/usr/bin/open \"jamfselfservice://content?entity=policy&id=$jamfProPolicyID&action=view\""

Could you give that a try and see if it solves the issue for the time being?

jaedwards24 commented 1 month ago

Thanks Ben! I finally had a chance to test and this seems to be a good workaround for us.