robjschroeder / Elevate

Elevate is a script that can be ran from Jamf Pro to help elevate a standard user to admin for a specific amount of time
35 stars 5 forks source link

Reason for Request Message in Slack Notification is blank #28

Open regorian opened 1 year ago

regorian commented 1 year ago

Hello - we have recently started seeing an issue where the Slack webhook notification does not contain the Reason for the request. Looking at the local jsonprompt file, it looks like it not being captured there either. The webhook message does correctly capture and display the Computer Hostname, Serial, User, and OS, but reason only contains the date. This is occuring on version 2.0.4 and 2.0.3 of the script. We last tested 2.0.3 on August 16th, and it worked then, so not sure what changed (if anything)

Screenshot and local log below

image

###
# Elevate (2.0.4)
# https://techitout.xyz/
###

2023-08-24 11:02:16 - Elevate Pre-flight: Initiating ...
2023-08-24 11:02:16 - Elevate Pre-flight: Caffeinating this script (PID: 46797)
2023-08-24 11:02:16 - Elevate: Managed Configuration Profile is defined and will be used
2023-08-24 11:02:16 - Elevate: Settings variables based on plist values
2023-08-24 11:02:17 - Elevate: Checking to see if user is already an admin
2023-08-24 11:02:17 - Elevate: user is not an admin user, continuing...
2023-08-24 11:02:23 - Elevate: user provided input
2023-08-24 11:02:23 - Elevate: Reason for elevation: 
2023-08-24 11:02:23 - : Continuing to elevate user
2023-08-24 11:02:23 - Elevate: Temporarily disable 'jamf' binary check-in
2023-08-24 11:02:23 - Elevate: Promoting user to admin
2023-08-24 11:02:23 - Elevate: Confirming user group membership in '80(admin)' …

2023-08-24 11:02:40 - Generating Slack Message …
2023-08-24 11:02:40 - Send the message to Slack …
2023-08-24 11:02:40 -         {
            "blocks": [
                {
                    "type": "header",
                    "text": {
                        "type": "plain_text",
                        "text": "Security: Elevate Request",
                        "emoji": true
                    }
                },
                {
                    "type": "section",
                    "fields": [
                        {
                            "type": "mrkdwn",
                            "text": "*Elevation Request:*
user"
                        },
                        {
                            "type": "mrkdwn",
                            "text": "*Serial:*
Serial"
                        },
                        {
                            "type": "mrkdwn",
                            "text": "*User:*
user"
                        },
                        {
                            "type": "mrkdwn",
                            "text": "*OS Version:*
14.0"
                        },
                        {
                            "type": "mrkdwn",
                            "text": "*Reason:*
2023-08-24 11:02:23: "
                        }
                    ]
                },
                {
                    "type": "actions",
                    "elements": [
                        {
                            "type": "button",
                            "text": {
                                "type": "plain_text",
                                "text": "View in Jamf Pro"
                                },
                            "style": "primary",
                            "url": "Jamf instance"
                        }
                    ]
                }
            ]
        }
2023-08-24 11:02:40 - Slack Webhook Result: 0
2023-08-24 11:06:32 - Elevate: Allowed time of 900 seconds has passed, demoting user to standard
2023-08-24 11:06:37 - Elevate: Confirming user is NOT a member of '80(admin)' …
2023-08-24 11:06:37 - (No results equals sucessful removal from '80(admin)' group.)
2023-08-24 11:06:41 - QUIT SCRIPT: Exiting …
2023-08-24 11:06:41 - QUIT SCRIPT: De-caffeinate …
2023-08-24 11:06:41 - Attempting to terminate the 'caffeinate' process …
2023-08-24 11:06:41 - (Termination message indicates success.)
2023-08-24 11:06:41 - QUIT SCRIPT: Removing /var/tmp/overlayicon.icns …
2023-08-24 11:06:41 - QUIT SCRIPT: Removing /var/tmp/dialogPrompt.Iei …
2023-08-24 11:06:41 - QUIT SCRIPT: Removing /var/tmp/promptJSONFile.9IQ …
2023-08-24 11:06:41 - QUIT SCRIPT: Removing LaunchDaemon plist
2023-08-24 11:06:41 - QUIT SCRIPT: Killing LaunchDaemon process
2023-08-24 11:06:41 - QUIT SCRIPT: Removing Dialog script
2023-08-24 11:06:41 - QUIT SCRIPT: Removing Dialog overlayicon
2023-08-24 11:06:41 - QUIT SCRIPT: Removing Elevate script
2023-08-24 11:06:41 - QUIT SCRIPT: Re-enabling 'jamf' binary check-in
2023-08-24 11:06:41 - QUIT SCRIPT: 'jamf' binary check-in daemon not loaded, attempting to bootstrap and start
2023-08-24 11:06:41 - QUIT SCRIPT: Staring 'jamf' binary check-in daemon
2023-08-24 11:06:41 - QUIT SCRIPT: Submitting Jamf Inventory Update
2023-08-24 11:06:41 - 
regorian commented 1 year ago

Not sure if this is the case, but the only change I see is that could impact this was that SwiftDialog version 2.3.1 was released on 2023-08-21 . For us this last worked on swiftDialog version 2.2.1.4591

Script result: 2023-08-16 10:26:04 - 

###
# Elevate (2.0.3)
# https://techitout.xyz
###

2023-08-16 10:26:04 - PRE-FLIGHT CHECK (Elevate): Initiating …
2023-08-16 10:26:05 - PRE-FLIGHT CHECK (Elevate): Finder & Dock are running; proceeding …
2023-08-16 10:26:05 - PRE-FLIGHT CHECK: Check for Logged-in System Accounts …
2023-08-16 10:26:05 - PRE-FLIGHT CHECK (Elevate): Current Logged-in User: USER
2023-08-16 10:26:05 - PRE-FLIGHT CHECK (Elevate): Current Logged-in User First Name: User
2023-08-16 10:26:05 - PRE-FLIGHT CHECK (Elevate): Current Logged-in User ID: 503
2023-08-16 10:26:05 - PRE-FLIGHT CHECK (Elevate): macOS 14 installed; continuing ...
2023-08-16 10:26:05 - PRE-FLIGHT CHECK (Elevate): swiftDialog version 2.2.1.4591 found; proceeding...
2023-08-16 10:26:05 - PRE-FLIGHT CHECK (Elevate): Complete
2023-08-16 10:26:05 - Elevate: Managed Configuration Profile exists, assuming settings are set in this configuraiton profiles...
2023-08-16 10:26:05 - Elevate: Updating /Library/Preferences/xyz.techitout.elevate.plist with extra variables...
Add: ":scriptVersion" Entry Already Exists
Add: ":scriptLog" Entry Already Exists
Add: ":webhookURL" Entry Already Exists
Creating script at "/var/tmp/elevate.sh"
Setting correct ownership and permissions on "/var/tmp/elevate.sh" script
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>EnvironmentVariables</key>
    <dict>
        <key>PATH</key>
        <string>/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
    </dict>
    <key>Label</key>
    <string>OMITTED</string>
    <key>ProgramArguments</key>
    <array>
        <string>/bin/zsh</string>
        <string>-c</string>
        <string>"/var/tmp/elevate.sh"</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
</dict>
</plist>
Creating LaunchDaemon at /Library/LaunchDaemons/com.xometry.elevate.plist
Setting correct ownership and permissions on LaunchDaemon
Starting LaunchDaemon
robjschroeder commented 1 year ago

Possibly fixed with swiftDialog version 2.3.2.4726

robjschroeder commented 1 year ago

Hey @regorian, can you give 2.0.5 a go with the latest dialog (at this moment it is 2.3.1.4721, it looks like it is working.