Skip to content
Open

Dev #22

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
8 changes: 4 additions & 4 deletions ReEnroller.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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;
Expand All @@ -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";
Expand All @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions ReEnroller/Alert.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// Alert.swift
// ReEnroller
//
// Created by Leslie Helou on 2/15/21
//

import Cocoa

Expand Down
3 changes: 0 additions & 3 deletions ReEnroller/ApiCall.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions ReEnroller/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// AppDelegate.swift
// ReEnroller
//
// Created by Leslie Helou on 2/12/21.
//

import Cocoa

Expand Down
3 changes: 0 additions & 3 deletions ReEnroller/Command.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
// command.swift
// ReEnroller
//
// Created by Leslie Helou on 9/27/18.
// Copyright © 2018 Leslie Helou. All rights reserved.
//

import Foundation

Expand Down
2 changes: 0 additions & 2 deletions ReEnroller/Globals.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// Globals.swift
// ReEnroller
//
// Created by Leslie Helou on 2/14/21
//

import Foundation

Expand Down
2 changes: 0 additions & 2 deletions ReEnroller/HelpViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// HelpViewController.swift
// ReEnroller
//
// Created by Leslie Helou on 2/12/21
//

import Cocoa
import WebKit
Expand Down
2 changes: 1 addition & 1 deletion ReEnroller/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>20260201.012954</string>
<string>20260905.132519</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
Expand Down
5 changes: 1 addition & 4 deletions ReEnroller/JamfPro.swift
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 0 additions & 2 deletions ReEnroller/ObjectXML.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// ObjectXML.swift
// ReEnroller
//
// Created by Leslie Helou on 2/15/21
//

import Foundation

Expand Down
40 changes: 7 additions & 33 deletions ReEnroller/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)")
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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") ?? ""
Expand Down
2 changes: 0 additions & 2 deletions ReEnroller/WriteToLog.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// WriteToLog.swift
// ReEnroller
//
// Created by Leslie Helou on 2/15/21.
//

import Foundation
class WriteToLog {
Expand Down
6 changes: 5 additions & 1 deletion ReEnroller/help/apiMDM_remove.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
#
####################################################################################################

Expand Down Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion ReEnroller/help/help.html
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ <h1>ReEnroller</h1>
# - 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)
#
####################################################################################################

Expand Down Expand Up @@ -441,7 +442,10 @@ <h1>ReEnroller</h1>
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
Expand Down