diff --git a/CHANGELOG.md b/CHANGELOG.md index 6360372..84e0a62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # History +- 2026-09-05: Better error handling, Address issues running profiles show command as the logged in user. + - 2026-01-31: Minor code cleanup. Update help. Add telemetry deck integration. - 2025-11-15: Fix MDM removal script (issue #21) along with a typo for macOS minor version. diff --git a/ReEnroller.xcodeproj/project.pbxproj b/ReEnroller.xcodeproj/project.pbxproj index 20c99de..501dcc2 100644 --- a/ReEnroller.xcodeproj/project.pbxproj +++ b/ReEnroller.xcodeproj/project.pbxproj @@ -403,7 +403,7 @@ COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = 1; DEAD_CODE_STRIPPING = YES; - DEVELOPMENT_TEAM = PS2F6S478M; + DEVELOPMENT_TEAM = 483DWKW443; ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = ReEnroller/Info.plist; INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities"; @@ -412,7 +412,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.15; - MARKETING_VERSION = 5.9.0; + MARKETING_VERSION = 5.9.1; PRODUCT_BUNDLE_IDENTIFIER = com.jamf.pse.ReEnroller; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; @@ -431,7 +431,7 @@ COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = 1; DEAD_CODE_STRIPPING = YES; - DEVELOPMENT_TEAM = PS2F6S478M; + DEVELOPMENT_TEAM = 483DWKW443; ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = ReEnroller/Info.plist; INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities"; @@ -440,7 +440,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.15; - MARKETING_VERSION = 5.9.0; + MARKETING_VERSION = 5.9.1; PRODUCT_BUNDLE_IDENTIFIER = com.jamf.pse.ReEnroller; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; diff --git a/ReEnroller/Alert.swift b/ReEnroller/Alert.swift index a942aa9..9cd5783 100644 --- a/ReEnroller/Alert.swift +++ b/ReEnroller/Alert.swift @@ -2,8 +2,6 @@ // Alert.swift // ReEnroller // -// Created by Leslie Helou on 2/15/21 -// import Cocoa diff --git a/ReEnroller/ApiCall.swift b/ReEnroller/ApiCall.swift index 9431a9f..7bce4f2 100644 --- a/ReEnroller/ApiCall.swift +++ b/ReEnroller/ApiCall.swift @@ -2,9 +2,6 @@ // ApiCall.swift // ReEnroller // -// Created by Leslie N. Helou on 3/18/19. -// Copyright © 2019 jamf. All rights reserved. -// import Cocoa import Foundation diff --git a/ReEnroller/AppDelegate.swift b/ReEnroller/AppDelegate.swift index 5c94ccc..cce54c5 100644 --- a/ReEnroller/AppDelegate.swift +++ b/ReEnroller/AppDelegate.swift @@ -2,8 +2,6 @@ // AppDelegate.swift // ReEnroller // -// Created by Leslie Helou on 2/12/21. -// import Cocoa diff --git a/ReEnroller/Command.swift b/ReEnroller/Command.swift index 2c3538e..b0a6c28 100644 --- a/ReEnroller/Command.swift +++ b/ReEnroller/Command.swift @@ -2,9 +2,6 @@ // command.swift // ReEnroller // -// Created by Leslie Helou on 9/27/18. -// Copyright © 2018 Leslie Helou. All rights reserved. -// import Foundation diff --git a/ReEnroller/Globals.swift b/ReEnroller/Globals.swift index c665aef..9d77233 100644 --- a/ReEnroller/Globals.swift +++ b/ReEnroller/Globals.swift @@ -2,8 +2,6 @@ // Globals.swift // ReEnroller // -// Created by Leslie Helou on 2/14/21 -// import Foundation diff --git a/ReEnroller/HelpViewController.swift b/ReEnroller/HelpViewController.swift index 8f9b924..e5da475 100644 --- a/ReEnroller/HelpViewController.swift +++ b/ReEnroller/HelpViewController.swift @@ -2,8 +2,6 @@ // HelpViewController.swift // ReEnroller // -// Created by Leslie Helou on 2/12/21 -// import Cocoa import WebKit diff --git a/ReEnroller/Info.plist b/ReEnroller/Info.plist index 5c20196..4158988 100644 --- a/ReEnroller/Info.plist +++ b/ReEnroller/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString $(MARKETING_VERSION) CFBundleVersion - 20260201.012954 + 20260905.132519 LSApplicationCategoryType public.app-category.utilities LSMinimumSystemVersion diff --git a/ReEnroller/JamfPro.swift b/ReEnroller/JamfPro.swift index 7674894..0fb11e0 100644 --- a/ReEnroller/JamfPro.swift +++ b/ReEnroller/JamfPro.swift @@ -1,9 +1,6 @@ // // JamfPro.swift -// prune -// -// Created by Leslie Helou on 12/11/19. -// Copyright © 2019 Leslie Helou. All rights reserved. +// ReEnroller // import Foundation diff --git a/ReEnroller/ObjectXML.swift b/ReEnroller/ObjectXML.swift index ead59a2..5bd964f 100644 --- a/ReEnroller/ObjectXML.swift +++ b/ReEnroller/ObjectXML.swift @@ -2,8 +2,6 @@ // ObjectXML.swift // ReEnroller // -// Created by Leslie Helou on 2/15/21 -// import Foundation diff --git a/ReEnroller/ViewController.swift b/ReEnroller/ViewController.swift index 2cdc1c3..8f0dfeb 100644 --- a/ReEnroller/ViewController.swift +++ b/ReEnroller/ViewController.swift @@ -2,36 +2,6 @@ // ViewController.swift // ReEnroller // -// Created by Leslie Helou on 2/19/17 -// Based on the bash ReEnroller script by Douglas Worley -// -//****************************************************************************************** -// -// Copyright (c) 2017 Jamf. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of the Jamf nor the names of its contributors may be -// used to endorse or promote products derived from this software without -// specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY JAMF SOFTWARE, LLC "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL JAMF SOFTWARE, LLC BE LIABLE FOR ANY -// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -//****************************************************************************************** // PI-000524: prevents management account password from being reset if password on // client doesn't match password on server. @@ -648,7 +618,7 @@ class ViewController: NSViewController, URLSessionDelegate { var binaryExists = false var binaryDownloaded = false - if retryCount > maxRetries && maxRetries > -1 { + if retryCount >= maxRetries && maxRetries > -1 { // retry count has been met, stop retrying and remove the app WriteToLog.shared.message(theMessage: "Retry count: \(retryCount)") WriteToLog.shared.message(theMessage: "Maximum retries: \(maxRetries)") @@ -1265,6 +1235,11 @@ class ViewController: NSViewController, URLSessionDelegate { // alert the user, we're done Alert.shared.display(header: "Process Complete", message: "A package (\(packageName)-\(self.shortHostname).pkg) has been created in Downloads which is ready to be deployed with your current Jamf server.\n\nThe package \(self.includesMsg) a postinstall script to load the launch daemon and start the \(packageName) app.\(self.includesMsg2)\(self.policyMsg)") processQuickAdd_Button.isEnabled = true + + WriteToLog.shared.message(theMessage: "[TelemetryDeck] - sending signal - params: \(TelemetryDeckConfig.parameters)") + Task {@MainActor in + TelemetryDeckSignal.shared.send("runComplete", parameters: TelemetryDeckConfig.parameters) + } } func connectedToNetwork() -> Bool { @@ -2211,7 +2186,7 @@ class ViewController: NSViewController, URLSessionDelegate { // update inventory - end // see if device is scoped to a prestage enrollment - _ = Command.shared.myExitCode(cmd: "/bin/launchctl", args: "asuser", "$(id -u \"$(stat -f%Su /dev/console)\")", "/usr/bin/profiles", "show", "-type", "enrollment") + _ = Command.shared.myExitCode(cmd: "/bin/bash", args: "-c", "/bin/launchctl asuser $(id -u \"$(stat -f%Su /dev/console)\") /usr/bin/profiles show -type enrollment") if callEnrollment == "yes" { // launch profiles renew -type enrollment to initiate ADE process @@ -2613,7 +2588,6 @@ class ViewController: NSViewController, URLSessionDelegate { TelemetryDeckConfig.optOut = plistData["optOutdaf"] as? Bool ?? false - print("optOutdaf: \(TelemetryDeckConfig.optOut)") jssUrl_TextField.stringValue = userDefaults.string(forKey: "jamfProUrl") ?? "" jssUsername_TextField.stringValue = userDefaults.string(forKey: "jamfProUser") ?? "" diff --git a/ReEnroller/WriteToLog.swift b/ReEnroller/WriteToLog.swift index e9a03d4..b158344 100644 --- a/ReEnroller/WriteToLog.swift +++ b/ReEnroller/WriteToLog.swift @@ -2,8 +2,6 @@ // WriteToLog.swift // ReEnroller // -// Created by Leslie Helou on 2/15/21. -// import Foundation class WriteToLog { diff --git a/ReEnroller/help/apiMDM_remove.txt b/ReEnroller/help/apiMDM_remove.txt index 6bb27a9..5320684 100755 --- a/ReEnroller/help/apiMDM_remove.txt +++ b/ReEnroller/help/apiMDM_remove.txt @@ -57,6 +57,7 @@ # - updated 20200918: Updates due to changes in xpath for Big Sur # - updated 20240726: Update to use token for authentication # - updated 20251020: Update for Jamf Pro 11.21 (removal of UnmanageDevice from Classic API) +# - updated 20260831: Update for Jamf Pro 11.31 (new remove-mdm-profile endpoint) # #################################################################################################### @@ -164,7 +165,10 @@ jpMajVer=$(echo $version | awk -F. {'print $1'}) jpMinVer=$(echo $version | awk -F. {'print $2'}) ## send unmanage command to machine -if [ $jpMajVer -gt 10 ] && [ $jpMinVer -gt 20 ];then +if [ $jpMajVer -gt 10 ] && [ $jpMinVer -gt 30 ];then + echo "unmanage machine: curl -m 20 -s ${server}api/v4/computers-inventory/${compId}/remove-mdm-profile -X POST -H \"Authorization: Bearer $(echo $token | head -n15)...\"" + /usr/bin/curl -m 20 -s ${server}api/v4/computers-inventory/${compId}/remove-mdm-profile -X POST -H "Authorization: Bearer $token" +elif [ $jpMajVer -gt 10 ] && [ $jpMinVer -gt 20 ];then echo "unmanage machine: curl -m 20 -s ${server}api/v1/computer-inventory/${compId}/remove-mdm-profile -X POST -H \"Authorization: Bearer $(echo $token | head -n15)...\"" /usr/bin/curl -m 20 -s ${server}api/v1/computer-inventory/${compId}/remove-mdm-profile -X POST -H "Authorization: Bearer $token" else diff --git a/ReEnroller/help/help.html b/ReEnroller/help/help.html index 75a554f..4baa093 100644 --- a/ReEnroller/help/help.html +++ b/ReEnroller/help/help.html @@ -334,6 +334,7 @@

ReEnroller

# - updated 20200918: Updates due to changes in xpath for Big Sur # - updated 20240726: Update to use token for authentication # - updated 20251020: Update for Jamf Pro 11.21 (removal of UnmanageDevice from Classic API) + # - updated 20260831: Update for Jamf Pro 11.31 (new remove-mdm-profile endpoint) # #################################################################################################### @@ -441,7 +442,10 @@

ReEnroller

jpMinVer=$(echo $version | awk -F. {'print $2'}) ## send unmanage command to machine - if [ $jpMajVer -gt 10 ] && [ $jpMinVer -gt 20 ];then + if [ $jpMajVer -gt 10 ] && [ $jpMinVer -gt 30 ];then + echo "unmanage machine: curl -m 20 -s ${server}api/v4/computers-inventory/${compId}/remove-mdm-profile -X POST -H \"Authorization: Bearer $(echo $token | head -n15)...\"" + /usr/bin/curl -m 20 -s ${server}api/v4/computers-inventory/${compId}/remove-mdm-profile -X POST -H "Authorization: Bearer $token" + elif [ $jpMajVer -gt 10 ] && [ $jpMinVer -gt 20 ];then echo "unmanage machine: curl -m 20 -s ${server}api/v1/computer-inventory/${compId}/remove-mdm-profile -X POST -H \"Authorization: Bearer $(echo $token | head -n15)...\"" /usr/bin/curl -m 20 -s ${server}api/v1/computer-inventory/${compId}/remove-mdm-profile -X POST -H "Authorization: Bearer $token" else