├── .DS_Store ├── Jamf Return To Service.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── xcuserdata │ │ └── richard.mallion.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── richard.mallion.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── Jamf Return To Service ├── Assets.xcassets │ ├── AccentColor.colorset │ │ └── Contents.json │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── app_icon-1024.png │ │ ├── app_icon-128.png │ │ ├── app_icon-16.png │ │ ├── app_icon-256 1.png │ │ ├── app_icon-256.png │ │ ├── app_icon-32 1.png │ │ ├── app_icon-32.png │ │ ├── app_icon-512 1.png │ │ ├── app_icon-512.png │ │ └── app_icon-64.png │ └── Contents.json ├── ContentView.swift ├── JamfProApi.swift ├── Jamf_Return_To_Service.entitlements ├── Jamf_Return_To_ServiceApp.swift ├── Keychain.swift ├── Logger.swift ├── Models.swift ├── Preview Content │ └── Preview Assets.xcassets │ │ └── Contents.json └── SettingsView.swift ├── LICENSE └── README.md /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/red5coder/jamf-return-to-service/f380acfde4a671a15d2f75fa0d3dc4fcbbebbc3e/.DS_Store -------------------------------------------------------------------------------- /Jamf Return To Service.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 56; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | FBD8CFCB2AA7CF40004965AB /* Jamf_Return_To_ServiceApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = FBD8CFCA2AA7CF40004965AB /* Jamf_Return_To_ServiceApp.swift */; }; 11 | FBD8CFCD2AA7CF40004965AB /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FBD8CFCC2AA7CF40004965AB /* ContentView.swift */; }; 12 | FBD8CFCF2AA7CF40004965AB /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = FBD8CFCE2AA7CF40004965AB /* Assets.xcassets */; }; 13 | FBD8CFD22AA7CF40004965AB /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = FBD8CFD12AA7CF40004965AB /* Preview Assets.xcassets */; }; 14 | FBD8CFDA2AA7CF68004965AB /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FBD8CFD92AA7CF68004965AB /* SettingsView.swift */; }; 15 | FBD8CFDC2AA7CFA8004965AB /* Keychain.swift in Sources */ = {isa = PBXBuildFile; fileRef = FBD8CFDB2AA7CFA8004965AB /* Keychain.swift */; }; 16 | FBD8CFDE2AA7CFBD004965AB /* JamfProApi.swift in Sources */ = {isa = PBXBuildFile; fileRef = FBD8CFDD2AA7CFBD004965AB /* JamfProApi.swift */; }; 17 | FBD8CFE02AA7CFD8004965AB /* Logger.swift in Sources */ = {isa = PBXBuildFile; fileRef = FBD8CFDF2AA7CFD8004965AB /* Logger.swift */; }; 18 | FBD8CFE22AA7DEF1004965AB /* Models.swift in Sources */ = {isa = PBXBuildFile; fileRef = FBD8CFE12AA7DEF1004965AB /* Models.swift */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXFileReference section */ 22 | FBD8CFC72AA7CF40004965AB /* Jamf Return To Service.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Jamf Return To Service.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 23 | FBD8CFCA2AA7CF40004965AB /* Jamf_Return_To_ServiceApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Jamf_Return_To_ServiceApp.swift; sourceTree = ""; }; 24 | FBD8CFCC2AA7CF40004965AB /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 25 | FBD8CFCE2AA7CF40004965AB /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 26 | FBD8CFD12AA7CF40004965AB /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 27 | FBD8CFD32AA7CF40004965AB /* Jamf_Return_To_Service.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Jamf_Return_To_Service.entitlements; sourceTree = ""; }; 28 | FBD8CFD92AA7CF68004965AB /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = ""; }; 29 | FBD8CFDB2AA7CFA8004965AB /* Keychain.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Keychain.swift; sourceTree = ""; }; 30 | FBD8CFDD2AA7CFBD004965AB /* JamfProApi.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JamfProApi.swift; sourceTree = ""; }; 31 | FBD8CFDF2AA7CFD8004965AB /* Logger.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Logger.swift; sourceTree = ""; }; 32 | FBD8CFE12AA7DEF1004965AB /* Models.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Models.swift; sourceTree = ""; }; 33 | /* End PBXFileReference section */ 34 | 35 | /* Begin PBXFrameworksBuildPhase section */ 36 | FBD8CFC42AA7CF40004965AB /* Frameworks */ = { 37 | isa = PBXFrameworksBuildPhase; 38 | buildActionMask = 2147483647; 39 | files = ( 40 | ); 41 | runOnlyForDeploymentPostprocessing = 0; 42 | }; 43 | /* End PBXFrameworksBuildPhase section */ 44 | 45 | /* Begin PBXGroup section */ 46 | FBD8CFBE2AA7CF40004965AB = { 47 | isa = PBXGroup; 48 | children = ( 49 | FBD8CFC92AA7CF40004965AB /* Jamf Return To Service */, 50 | FBD8CFC82AA7CF40004965AB /* Products */, 51 | ); 52 | sourceTree = ""; 53 | }; 54 | FBD8CFC82AA7CF40004965AB /* Products */ = { 55 | isa = PBXGroup; 56 | children = ( 57 | FBD8CFC72AA7CF40004965AB /* Jamf Return To Service.app */, 58 | ); 59 | name = Products; 60 | sourceTree = ""; 61 | }; 62 | FBD8CFC92AA7CF40004965AB /* Jamf Return To Service */ = { 63 | isa = PBXGroup; 64 | children = ( 65 | FBD8CFCA2AA7CF40004965AB /* Jamf_Return_To_ServiceApp.swift */, 66 | FBD8CFCC2AA7CF40004965AB /* ContentView.swift */, 67 | FBD8CFCE2AA7CF40004965AB /* Assets.xcassets */, 68 | FBD8CFD32AA7CF40004965AB /* Jamf_Return_To_Service.entitlements */, 69 | FBD8CFD02AA7CF40004965AB /* Preview Content */, 70 | FBD8CFD92AA7CF68004965AB /* SettingsView.swift */, 71 | FBD8CFDB2AA7CFA8004965AB /* Keychain.swift */, 72 | FBD8CFDD2AA7CFBD004965AB /* JamfProApi.swift */, 73 | FBD8CFE12AA7DEF1004965AB /* Models.swift */, 74 | FBD8CFDF2AA7CFD8004965AB /* Logger.swift */, 75 | ); 76 | path = "Jamf Return To Service"; 77 | sourceTree = ""; 78 | }; 79 | FBD8CFD02AA7CF40004965AB /* Preview Content */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | FBD8CFD12AA7CF40004965AB /* Preview Assets.xcassets */, 83 | ); 84 | path = "Preview Content"; 85 | sourceTree = ""; 86 | }; 87 | /* End PBXGroup section */ 88 | 89 | /* Begin PBXNativeTarget section */ 90 | FBD8CFC62AA7CF40004965AB /* Jamf Return To Service */ = { 91 | isa = PBXNativeTarget; 92 | buildConfigurationList = FBD8CFD62AA7CF40004965AB /* Build configuration list for PBXNativeTarget "Jamf Return To Service" */; 93 | buildPhases = ( 94 | FBD8CFC32AA7CF40004965AB /* Sources */, 95 | FBD8CFC42AA7CF40004965AB /* Frameworks */, 96 | FBD8CFC52AA7CF40004965AB /* Resources */, 97 | ); 98 | buildRules = ( 99 | ); 100 | dependencies = ( 101 | ); 102 | name = "Jamf Return To Service"; 103 | productName = "Jamf Return To Service"; 104 | productReference = FBD8CFC72AA7CF40004965AB /* Jamf Return To Service.app */; 105 | productType = "com.apple.product-type.application"; 106 | }; 107 | /* End PBXNativeTarget section */ 108 | 109 | /* Begin PBXProject section */ 110 | FBD8CFBF2AA7CF40004965AB /* Project object */ = { 111 | isa = PBXProject; 112 | attributes = { 113 | BuildIndependentTargetsInParallel = 1; 114 | LastSwiftUpdateCheck = 1430; 115 | LastUpgradeCheck = 1430; 116 | TargetAttributes = { 117 | FBD8CFC62AA7CF40004965AB = { 118 | CreatedOnToolsVersion = 14.3.1; 119 | }; 120 | }; 121 | }; 122 | buildConfigurationList = FBD8CFC22AA7CF40004965AB /* Build configuration list for PBXProject "Jamf Return To Service" */; 123 | compatibilityVersion = "Xcode 14.0"; 124 | developmentRegion = en; 125 | hasScannedForEncodings = 0; 126 | knownRegions = ( 127 | en, 128 | Base, 129 | ); 130 | mainGroup = FBD8CFBE2AA7CF40004965AB; 131 | productRefGroup = FBD8CFC82AA7CF40004965AB /* Products */; 132 | projectDirPath = ""; 133 | projectRoot = ""; 134 | targets = ( 135 | FBD8CFC62AA7CF40004965AB /* Jamf Return To Service */, 136 | ); 137 | }; 138 | /* End PBXProject section */ 139 | 140 | /* Begin PBXResourcesBuildPhase section */ 141 | FBD8CFC52AA7CF40004965AB /* Resources */ = { 142 | isa = PBXResourcesBuildPhase; 143 | buildActionMask = 2147483647; 144 | files = ( 145 | FBD8CFD22AA7CF40004965AB /* Preview Assets.xcassets in Resources */, 146 | FBD8CFCF2AA7CF40004965AB /* Assets.xcassets in Resources */, 147 | ); 148 | runOnlyForDeploymentPostprocessing = 0; 149 | }; 150 | /* End PBXResourcesBuildPhase section */ 151 | 152 | /* Begin PBXSourcesBuildPhase section */ 153 | FBD8CFC32AA7CF40004965AB /* Sources */ = { 154 | isa = PBXSourcesBuildPhase; 155 | buildActionMask = 2147483647; 156 | files = ( 157 | FBD8CFDA2AA7CF68004965AB /* SettingsView.swift in Sources */, 158 | FBD8CFE02AA7CFD8004965AB /* Logger.swift in Sources */, 159 | FBD8CFDC2AA7CFA8004965AB /* Keychain.swift in Sources */, 160 | FBD8CFDE2AA7CFBD004965AB /* JamfProApi.swift in Sources */, 161 | FBD8CFCD2AA7CF40004965AB /* ContentView.swift in Sources */, 162 | FBD8CFCB2AA7CF40004965AB /* Jamf_Return_To_ServiceApp.swift in Sources */, 163 | FBD8CFE22AA7DEF1004965AB /* Models.swift in Sources */, 164 | ); 165 | runOnlyForDeploymentPostprocessing = 0; 166 | }; 167 | /* End PBXSourcesBuildPhase section */ 168 | 169 | /* Begin XCBuildConfiguration section */ 170 | FBD8CFD42AA7CF40004965AB /* Debug */ = { 171 | isa = XCBuildConfiguration; 172 | buildSettings = { 173 | ALWAYS_SEARCH_USER_PATHS = NO; 174 | CLANG_ANALYZER_NONNULL = YES; 175 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 176 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; 177 | CLANG_ENABLE_MODULES = YES; 178 | CLANG_ENABLE_OBJC_ARC = YES; 179 | CLANG_ENABLE_OBJC_WEAK = YES; 180 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 181 | CLANG_WARN_BOOL_CONVERSION = YES; 182 | CLANG_WARN_COMMA = YES; 183 | CLANG_WARN_CONSTANT_CONVERSION = YES; 184 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 185 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 186 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 187 | CLANG_WARN_EMPTY_BODY = YES; 188 | CLANG_WARN_ENUM_CONVERSION = YES; 189 | CLANG_WARN_INFINITE_RECURSION = YES; 190 | CLANG_WARN_INT_CONVERSION = YES; 191 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 192 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 193 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 194 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 195 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 196 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 197 | CLANG_WARN_STRICT_PROTOTYPES = YES; 198 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 199 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 200 | CLANG_WARN_UNREACHABLE_CODE = YES; 201 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 202 | COPY_PHASE_STRIP = NO; 203 | DEBUG_INFORMATION_FORMAT = dwarf; 204 | ENABLE_STRICT_OBJC_MSGSEND = YES; 205 | ENABLE_TESTABILITY = YES; 206 | GCC_C_LANGUAGE_STANDARD = gnu11; 207 | GCC_DYNAMIC_NO_PIC = NO; 208 | GCC_NO_COMMON_BLOCKS = YES; 209 | GCC_OPTIMIZATION_LEVEL = 0; 210 | GCC_PREPROCESSOR_DEFINITIONS = ( 211 | "DEBUG=1", 212 | "$(inherited)", 213 | ); 214 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 215 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 216 | GCC_WARN_UNDECLARED_SELECTOR = YES; 217 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 218 | GCC_WARN_UNUSED_FUNCTION = YES; 219 | GCC_WARN_UNUSED_VARIABLE = YES; 220 | MACOSX_DEPLOYMENT_TARGET = 13.3; 221 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 222 | MTL_FAST_MATH = YES; 223 | ONLY_ACTIVE_ARCH = YES; 224 | SDKROOT = macosx; 225 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 226 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 227 | }; 228 | name = Debug; 229 | }; 230 | FBD8CFD52AA7CF40004965AB /* Release */ = { 231 | isa = XCBuildConfiguration; 232 | buildSettings = { 233 | ALWAYS_SEARCH_USER_PATHS = NO; 234 | CLANG_ANALYZER_NONNULL = YES; 235 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 236 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; 237 | CLANG_ENABLE_MODULES = YES; 238 | CLANG_ENABLE_OBJC_ARC = YES; 239 | CLANG_ENABLE_OBJC_WEAK = YES; 240 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 241 | CLANG_WARN_BOOL_CONVERSION = YES; 242 | CLANG_WARN_COMMA = YES; 243 | CLANG_WARN_CONSTANT_CONVERSION = YES; 244 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 245 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 246 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 247 | CLANG_WARN_EMPTY_BODY = YES; 248 | CLANG_WARN_ENUM_CONVERSION = YES; 249 | CLANG_WARN_INFINITE_RECURSION = YES; 250 | CLANG_WARN_INT_CONVERSION = YES; 251 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 252 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 253 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 254 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 255 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 256 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 257 | CLANG_WARN_STRICT_PROTOTYPES = YES; 258 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 259 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 260 | CLANG_WARN_UNREACHABLE_CODE = YES; 261 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 262 | COPY_PHASE_STRIP = NO; 263 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 264 | ENABLE_NS_ASSERTIONS = NO; 265 | ENABLE_STRICT_OBJC_MSGSEND = YES; 266 | GCC_C_LANGUAGE_STANDARD = gnu11; 267 | GCC_NO_COMMON_BLOCKS = YES; 268 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 269 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 270 | GCC_WARN_UNDECLARED_SELECTOR = YES; 271 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 272 | GCC_WARN_UNUSED_FUNCTION = YES; 273 | GCC_WARN_UNUSED_VARIABLE = YES; 274 | MACOSX_DEPLOYMENT_TARGET = 13.3; 275 | MTL_ENABLE_DEBUG_INFO = NO; 276 | MTL_FAST_MATH = YES; 277 | SDKROOT = macosx; 278 | SWIFT_COMPILATION_MODE = wholemodule; 279 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 280 | }; 281 | name = Release; 282 | }; 283 | FBD8CFD72AA7CF40004965AB /* Debug */ = { 284 | isa = XCBuildConfiguration; 285 | buildSettings = { 286 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 287 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 288 | CODE_SIGN_ENTITLEMENTS = "Jamf Return To Service/Jamf_Return_To_Service.entitlements"; 289 | CODE_SIGN_STYLE = Automatic; 290 | COMBINE_HIDPI_IMAGES = YES; 291 | CURRENT_PROJECT_VERSION = 35; 292 | DEVELOPMENT_ASSET_PATHS = "\"Jamf Return To Service/Preview Content\""; 293 | DEVELOPMENT_TEAM = VR4GB7TBDP; 294 | ENABLE_HARDENED_RUNTIME = YES; 295 | ENABLE_PREVIEWS = YES; 296 | GENERATE_INFOPLIST_FILE = YES; 297 | INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities"; 298 | INFOPLIST_KEY_NSHumanReadableCopyright = ""; 299 | LD_RUNPATH_SEARCH_PATHS = ( 300 | "$(inherited)", 301 | "@executable_path/../Frameworks", 302 | ); 303 | MACOSX_DEPLOYMENT_TARGET = 13.0; 304 | MARKETING_VERSION = 0.9.5; 305 | PRODUCT_BUNDLE_IDENTIFIER = "uk.co.mallion.jamf-return-to-service"; 306 | PRODUCT_NAME = "$(TARGET_NAME)"; 307 | SWIFT_EMIT_LOC_STRINGS = YES; 308 | SWIFT_VERSION = 5.0; 309 | }; 310 | name = Debug; 311 | }; 312 | FBD8CFD82AA7CF40004965AB /* Release */ = { 313 | isa = XCBuildConfiguration; 314 | buildSettings = { 315 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 316 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 317 | CODE_SIGN_ENTITLEMENTS = "Jamf Return To Service/Jamf_Return_To_Service.entitlements"; 318 | CODE_SIGN_STYLE = Automatic; 319 | COMBINE_HIDPI_IMAGES = YES; 320 | CURRENT_PROJECT_VERSION = 35; 321 | DEVELOPMENT_ASSET_PATHS = "\"Jamf Return To Service/Preview Content\""; 322 | DEVELOPMENT_TEAM = VR4GB7TBDP; 323 | ENABLE_HARDENED_RUNTIME = YES; 324 | ENABLE_PREVIEWS = YES; 325 | GENERATE_INFOPLIST_FILE = YES; 326 | INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities"; 327 | INFOPLIST_KEY_NSHumanReadableCopyright = ""; 328 | LD_RUNPATH_SEARCH_PATHS = ( 329 | "$(inherited)", 330 | "@executable_path/../Frameworks", 331 | ); 332 | MACOSX_DEPLOYMENT_TARGET = 13.0; 333 | MARKETING_VERSION = 0.9.5; 334 | PRODUCT_BUNDLE_IDENTIFIER = "uk.co.mallion.jamf-return-to-service"; 335 | PRODUCT_NAME = "$(TARGET_NAME)"; 336 | SWIFT_EMIT_LOC_STRINGS = YES; 337 | SWIFT_VERSION = 5.0; 338 | }; 339 | name = Release; 340 | }; 341 | /* End XCBuildConfiguration section */ 342 | 343 | /* Begin XCConfigurationList section */ 344 | FBD8CFC22AA7CF40004965AB /* Build configuration list for PBXProject "Jamf Return To Service" */ = { 345 | isa = XCConfigurationList; 346 | buildConfigurations = ( 347 | FBD8CFD42AA7CF40004965AB /* Debug */, 348 | FBD8CFD52AA7CF40004965AB /* Release */, 349 | ); 350 | defaultConfigurationIsVisible = 0; 351 | defaultConfigurationName = Release; 352 | }; 353 | FBD8CFD62AA7CF40004965AB /* Build configuration list for PBXNativeTarget "Jamf Return To Service" */ = { 354 | isa = XCConfigurationList; 355 | buildConfigurations = ( 356 | FBD8CFD72AA7CF40004965AB /* Debug */, 357 | FBD8CFD82AA7CF40004965AB /* Release */, 358 | ); 359 | defaultConfigurationIsVisible = 0; 360 | defaultConfigurationName = Release; 361 | }; 362 | /* End XCConfigurationList section */ 363 | }; 364 | rootObject = FBD8CFBF2AA7CF40004965AB /* Project object */; 365 | } 366 | -------------------------------------------------------------------------------- /Jamf Return To Service.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Jamf Return To Service.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Jamf Return To Service.xcodeproj/project.xcworkspace/xcuserdata/richard.mallion.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/red5coder/jamf-return-to-service/f380acfde4a671a15d2f75fa0d3dc4fcbbebbc3e/Jamf Return To Service.xcodeproj/project.xcworkspace/xcuserdata/richard.mallion.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Jamf Return To Service.xcodeproj/xcuserdata/richard.mallion.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Jamf Return To Service.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Jamf Return To Service/Assets.xcassets/AccentColor.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "idiom" : "universal" 5 | } 6 | ], 7 | "info" : { 8 | "author" : "xcode", 9 | "version" : 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Jamf Return To Service/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "app_icon-16.png", 5 | "idiom" : "mac", 6 | "scale" : "1x", 7 | "size" : "16x16" 8 | }, 9 | { 10 | "filename" : "app_icon-32 1.png", 11 | "idiom" : "mac", 12 | "scale" : "2x", 13 | "size" : "16x16" 14 | }, 15 | { 16 | "filename" : "app_icon-32.png", 17 | "idiom" : "mac", 18 | "scale" : "1x", 19 | "size" : "32x32" 20 | }, 21 | { 22 | "filename" : "app_icon-64.png", 23 | "idiom" : "mac", 24 | "scale" : "2x", 25 | "size" : "32x32" 26 | }, 27 | { 28 | "filename" : "app_icon-128.png", 29 | "idiom" : "mac", 30 | "scale" : "1x", 31 | "size" : "128x128" 32 | }, 33 | { 34 | "filename" : "app_icon-256 1.png", 35 | "idiom" : "mac", 36 | "scale" : "2x", 37 | "size" : "128x128" 38 | }, 39 | { 40 | "filename" : "app_icon-256.png", 41 | "idiom" : "mac", 42 | "scale" : "1x", 43 | "size" : "256x256" 44 | }, 45 | { 46 | "filename" : "app_icon-512 1.png", 47 | "idiom" : "mac", 48 | "scale" : "2x", 49 | "size" : "256x256" 50 | }, 51 | { 52 | "filename" : "app_icon-512.png", 53 | "idiom" : "mac", 54 | "scale" : "1x", 55 | "size" : "512x512" 56 | }, 57 | { 58 | "filename" : "app_icon-1024.png", 59 | "idiom" : "mac", 60 | "scale" : "2x", 61 | "size" : "512x512" 62 | } 63 | ], 64 | "info" : { 65 | "author" : "xcode", 66 | "version" : 1 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /Jamf Return To Service/Assets.xcassets/AppIcon.appiconset/app_icon-1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/red5coder/jamf-return-to-service/f380acfde4a671a15d2f75fa0d3dc4fcbbebbc3e/Jamf Return To Service/Assets.xcassets/AppIcon.appiconset/app_icon-1024.png -------------------------------------------------------------------------------- /Jamf Return To Service/Assets.xcassets/AppIcon.appiconset/app_icon-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/red5coder/jamf-return-to-service/f380acfde4a671a15d2f75fa0d3dc4fcbbebbc3e/Jamf Return To Service/Assets.xcassets/AppIcon.appiconset/app_icon-128.png -------------------------------------------------------------------------------- /Jamf Return To Service/Assets.xcassets/AppIcon.appiconset/app_icon-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/red5coder/jamf-return-to-service/f380acfde4a671a15d2f75fa0d3dc4fcbbebbc3e/Jamf Return To Service/Assets.xcassets/AppIcon.appiconset/app_icon-16.png -------------------------------------------------------------------------------- /Jamf Return To Service/Assets.xcassets/AppIcon.appiconset/app_icon-256 1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/red5coder/jamf-return-to-service/f380acfde4a671a15d2f75fa0d3dc4fcbbebbc3e/Jamf Return To Service/Assets.xcassets/AppIcon.appiconset/app_icon-256 1.png -------------------------------------------------------------------------------- /Jamf Return To Service/Assets.xcassets/AppIcon.appiconset/app_icon-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/red5coder/jamf-return-to-service/f380acfde4a671a15d2f75fa0d3dc4fcbbebbc3e/Jamf Return To Service/Assets.xcassets/AppIcon.appiconset/app_icon-256.png -------------------------------------------------------------------------------- /Jamf Return To Service/Assets.xcassets/AppIcon.appiconset/app_icon-32 1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/red5coder/jamf-return-to-service/f380acfde4a671a15d2f75fa0d3dc4fcbbebbc3e/Jamf Return To Service/Assets.xcassets/AppIcon.appiconset/app_icon-32 1.png -------------------------------------------------------------------------------- /Jamf Return To Service/Assets.xcassets/AppIcon.appiconset/app_icon-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/red5coder/jamf-return-to-service/f380acfde4a671a15d2f75fa0d3dc4fcbbebbc3e/Jamf Return To Service/Assets.xcassets/AppIcon.appiconset/app_icon-32.png -------------------------------------------------------------------------------- /Jamf Return To Service/Assets.xcassets/AppIcon.appiconset/app_icon-512 1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/red5coder/jamf-return-to-service/f380acfde4a671a15d2f75fa0d3dc4fcbbebbc3e/Jamf Return To Service/Assets.xcassets/AppIcon.appiconset/app_icon-512 1.png -------------------------------------------------------------------------------- /Jamf Return To Service/Assets.xcassets/AppIcon.appiconset/app_icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/red5coder/jamf-return-to-service/f380acfde4a671a15d2f75fa0d3dc4fcbbebbc3e/Jamf Return To Service/Assets.xcassets/AppIcon.appiconset/app_icon-512.png -------------------------------------------------------------------------------- /Jamf Return To Service/Assets.xcassets/AppIcon.appiconset/app_icon-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/red5coder/jamf-return-to-service/f380acfde4a671a15d2f75fa0d3dc4fcbbebbc3e/Jamf Return To Service/Assets.xcassets/AppIcon.appiconset/app_icon-64.png -------------------------------------------------------------------------------- /Jamf Return To Service/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Jamf Return To Service/ContentView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ContentView.swift 3 | // Jamf Return To Service 4 | // 5 | // Created by Richard Mallion on 05/09/2023. 6 | // 7 | 8 | import SwiftUI 9 | import os.log 10 | 11 | struct ContentView: View { 12 | @AppStorage("jamfURL") var jamfURL: String = "" 13 | @AppStorage("userName") var userName: String = "" 14 | @AppStorage("useAPIRoles") var useAPIRoles: Bool = false 15 | 16 | @State private var password = "" 17 | 18 | //Buttons 19 | @State private var disableRTSFButton = true 20 | 21 | //Alert 22 | @State private var showAlert = false 23 | @State private var alertMessage = "" 24 | @State private var alertTitle = "" 25 | 26 | 27 | @State private var serialNumber = "" 28 | @State private var showActivity = false 29 | 30 | //Picker 31 | @State private var wifiMenuItems = [WiFiMenuItem(name: "No Wi-Fi Profiles", profileID: "0")] 32 | @State private var selectedWifiItem = "0" 33 | @State private var foundWiFiProfiles = false 34 | 35 | var body: some View { 36 | 37 | HStack(alignment: .center) { 38 | 39 | VStack(alignment: .trailing, spacing: 12.0) { 40 | Text("Wi-Fi Profile:") 41 | Text("Serial Number:") 42 | } 43 | 44 | VStack(alignment: .leading, spacing: 7.0) { 45 | Picker("", selection: $selectedWifiItem) { 46 | ForEach(wifiMenuItems, id: \.profileID) { 47 | Text($0.name) 48 | } 49 | } 50 | TextField("" , text: $serialNumber) 51 | .textFieldStyle(.roundedBorder) 52 | .onChange(of: serialNumber) { newValue in 53 | if !foundWiFiProfiles || serialNumber.isEmpty { 54 | disableRTSFButton = true 55 | } else { 56 | disableRTSFButton = false 57 | } 58 | } 59 | } 60 | 61 | } 62 | .padding([.leading,.trailing]) 63 | .alert(isPresented: self.$showAlert, 64 | content: { 65 | self.showCustomAlert() 66 | }) 67 | .padding([.leading,.trailing, .bottom]) 68 | .task { 69 | let defaults = UserDefaults.standard 70 | useAPIRoles = defaults.bool(forKey: "useAPIRoles") 71 | let jamfURL = defaults.string(forKey: "jamfURL") ?? "" 72 | if jamfURL.isEmpty { 73 | NSApp.sendAction(Selector(("showSettingsWindow:")), to: nil, from: nil) 74 | } 75 | } 76 | .onAppear { 77 | fetchPassword() 78 | } 79 | 80 | HStack(alignment: .center) { 81 | 82 | VStack(alignment: .leading, spacing: 7.0) { 83 | 84 | } 85 | } 86 | .padding([.leading,.trailing]) 87 | 88 | HStack(alignment: .center) { 89 | Button("Find Wi-Fi Profiles") { 90 | Task { 91 | fetchPassword() 92 | await verifyWiFiProfile() 93 | } 94 | } 95 | 96 | Button("Return To Service") { 97 | Task { 98 | fetchPassword() 99 | await sendRTS() 100 | } 101 | } 102 | .disabled(disableRTSFButton) 103 | ProgressView() 104 | .scaleEffect(0.5) 105 | .opacity(showActivity ? 1 : 0) 106 | } 107 | 108 | } 109 | 110 | func fetchPassword() { 111 | let credentialsArray = Keychain().retrieve(service: "uk.co.mallion.jamf-return-to-service") 112 | if credentialsArray.count == 2 { 113 | //userName = credentialsArray[0] 114 | password = credentialsArray[1] 115 | } 116 | let defaults = UserDefaults.standard 117 | useAPIRoles = defaults.bool(forKey: "useAPIRoles") 118 | jamfURL = defaults.string(forKey: "jamfURL") ?? "" 119 | userName = defaults.string(forKey: "userName") ?? "" 120 | } 121 | 122 | func showCustomAlert() -> Alert { 123 | return Alert( 124 | title: Text(alertTitle), 125 | message: Text(alertMessage), 126 | dismissButton: .default(Text("OK")) 127 | ) 128 | } 129 | 130 | func sendRTS() async { 131 | showActivity = true 132 | let jamfPro = JamfProAPI(username: userName, password: password) 133 | let (bearerToken, _) = await jamfPro.getToken(jssURL: jamfURL, base64Credentials: jamfPro.base64Credentials, useAPIRole: useAPIRoles) 134 | guard let bearerToken else { 135 | alertMessage = "Could not authenticate. Please check the url and authentication details" 136 | alertTitle = "Authentication Error" 137 | showAlert = true 138 | showActivity = false 139 | return 140 | } 141 | 142 | guard let jamfProVersion = await jamfPro.getJamfProVersion(jssURL: jamfURL, authToken: bearerToken) else { 143 | alertMessage = "Could not fetch Jamf Pro Version" 144 | alertTitle = "Error" 145 | showAlert = true 146 | showActivity = false 147 | return 148 | } 149 | if jamfProVersion < 10.50 { 150 | alertMessage = "Jamf Pro version 10.50 or higher is required" 151 | alertTitle = "Error" 152 | showAlert = true 153 | showActivity = false 154 | return 155 | } 156 | let (mobileConfig, response) = await jamfPro.fetchMobileConfig(jssURL: jamfURL, authToken: bearerToken, id: selectedWifiItem) 157 | 158 | guard let mobileConfig else { return } 159 | 160 | let (mobileID, idresponse) = await jamfPro.getMobileDevceID(jssURL: jamfURL, authToken: bearerToken, serialNumber: serialNumber) 161 | 162 | guard let mobileID else { return } 163 | 164 | let (managementid, manresponse) = await jamfPro.getMobileManagementID(jssURL: jamfURL, authToken: bearerToken, id: mobileID) 165 | guard let managementid else { return } 166 | 167 | let rtsresponse = await jamfPro.sendRTS(jssURL: jamfURL, authToken: bearerToken, wifi: mobileConfig.configurationProfile.general.payloads, managementid: managementid) 168 | 169 | guard let rtsresponse else { return } 170 | 171 | if rtsresponse == 201 { 172 | //Success 173 | alertMessage = "The return to service command was succesfulluy sent." 174 | alertTitle = "Return To Service" 175 | showAlert = true 176 | showActivity = false 177 | } else { 178 | //failure 179 | alertMessage = "The return to service command failed with error \(rtsresponse)" 180 | alertTitle = "Return To Service" 181 | showAlert = true 182 | showActivity = false 183 | } 184 | } 185 | 186 | func verifyWiFiProfile() async { 187 | showActivity = true 188 | 189 | let jamfPro = JamfProAPI(username: userName, password: password) 190 | let (bearerToken, _) = await jamfPro.getToken(jssURL: jamfURL, base64Credentials: jamfPro.base64Credentials, useAPIRole: useAPIRoles) 191 | 192 | guard let bearerToken else { 193 | alertMessage = "Could not authenticate. Please check the url and authentication details" 194 | alertTitle = "Authentication Error" 195 | showAlert = true 196 | showActivity = false 197 | return 198 | } 199 | 200 | let (allMobileConfigProfiles , allProfilesResponse) = await jamfPro.getAllMobileConfigProfiles(jssURL: jamfURL, authToken: bearerToken) 201 | 202 | guard let allMobileConfigProfiles, allMobileConfigProfiles.configurationProfiles.count > 0 else { 203 | alertMessage = "Could not locate any mobile config. Please verify the ID or name." 204 | alertTitle = "Wi-Fi Mobile Config Profile" 205 | showAlert = true 206 | showActivity = false 207 | return 208 | } 209 | 210 | wifiMenuItems = [WiFiMenuItem]() 211 | 212 | for profile in allMobileConfigProfiles.configurationProfiles { 213 | if await jamfPro.isWifiMobileConfigProfile(jssURL: jamfURL, authToken: bearerToken, id: profile.id) { 214 | wifiMenuItems.append(WiFiMenuItem(name: profile.name, profileID: String(profile.id))) 215 | } 216 | } 217 | if wifiMenuItems.count > 0 { 218 | selectedWifiItem = wifiMenuItems[0].profileID 219 | foundWiFiProfiles = true 220 | } else { 221 | wifiMenuItems = [WiFiMenuItem(name: "No Wi-Fi Profiles Found", profileID: "0")] 222 | selectedWifiItem = "0" 223 | foundWiFiProfiles = false 224 | } 225 | 226 | if !foundWiFiProfiles || serialNumber.isEmpty { 227 | disableRTSFButton = true 228 | } else { 229 | disableRTSFButton = false 230 | } 231 | 232 | showActivity = false 233 | } 234 | } 235 | 236 | struct ContentView_Previews: PreviewProvider { 237 | static var previews: some View { 238 | ContentView() 239 | } 240 | } 241 | -------------------------------------------------------------------------------- /Jamf Return To Service/JamfProApi.swift: -------------------------------------------------------------------------------- 1 | // 2 | // JamfProApi.swift 3 | // Jamf Return To Service 4 | // 5 | // Created by Richard Mallion on 05/09/2023. 6 | // 7 | 8 | import Foundation 9 | import os.log 10 | 11 | struct JamfProAPI { 12 | 13 | 14 | var username: String 15 | var password: String 16 | 17 | var base64Credentials: String { 18 | return "\(username):\(password)" 19 | .data(using: String.Encoding.utf8)! 20 | .base64EncodedString() 21 | } 22 | 23 | 24 | func isWifiMobileConfigProfile(jssURL: String, authToken: String, id: Int ) async -> Bool { 25 | Logger.rts.info("Checking config profile id \(id, privacy: .public) for Wi-Fi payload") 26 | 27 | guard var jamfmobileEndpoint = URLComponents(string: jssURL) else { 28 | return false 29 | } 30 | 31 | jamfmobileEndpoint.path="/JSSResource/mobiledeviceconfigurationprofiles/id/\(id)/subset/General" 32 | 33 | guard let url = jamfmobileEndpoint.url else { 34 | return false 35 | } 36 | 37 | var mobileConfigRequest = URLRequest(url: url) 38 | mobileConfigRequest.httpMethod = "GET" 39 | mobileConfigRequest.setValue("Bearer \(authToken)", forHTTPHeaderField: "Authorization") 40 | mobileConfigRequest.setValue("application/json", forHTTPHeaderField: "Accept") 41 | guard let (data, response) = try? await URLSession.shared.data(for: mobileConfigRequest) 42 | else { 43 | return false 44 | } 45 | 46 | let httpResponse = response as? HTTPURLResponse 47 | if let response = httpResponse?.statusCode { 48 | Logger.rts.info("Response code for fetching mobile config profile: \(response, privacy: .public)") 49 | } 50 | do { 51 | let mobileConfigProfile = try JSONDecoder().decode(MobileConfigProfile.self, from: data) 52 | if mobileConfigProfile.configurationProfile.general.payloads.lowercased().contains("com.apple.wifi.managed") { 53 | Logger.rts.info("Profile \(id, privacy: .public) does have a wi-fi payload") 54 | 55 | return true 56 | } else { 57 | Logger.rts.info("Profile \(id, privacy: .public) does not have a wi-fi payload") 58 | return false 59 | } 60 | } catch _ { 61 | Logger.rts.error("Could not decode mobile config profile") 62 | return false 63 | } 64 | } 65 | 66 | 67 | func getAllMobileConfigProfiles(jssURL: String, authToken: String) async -> (AllMobileConfigProfiles?, Int?) { 68 | Logger.rts.info("About to fetch all Mobile Config Profiles") 69 | guard var jamfcomputerEndpoint = URLComponents(string: jssURL) else { 70 | return (nil,nil) 71 | } 72 | jamfcomputerEndpoint.path="/JSSResource/mobiledeviceconfigurationprofiles" 73 | 74 | guard let url = jamfcomputerEndpoint.url else { 75 | return (nil,nil) 76 | } 77 | 78 | var mobileConfigRequest = URLRequest(url: url) 79 | mobileConfigRequest.httpMethod = "GET" 80 | mobileConfigRequest.setValue("Bearer \(authToken)", forHTTPHeaderField: "Authorization") 81 | mobileConfigRequest.setValue("application/json", forHTTPHeaderField: "Accept") 82 | guard let (data, response) = try? await URLSession.shared.data(for: mobileConfigRequest) 83 | else { 84 | return (nil,nil) 85 | } 86 | 87 | let httpResponse = response as? HTTPURLResponse 88 | if let response = httpResponse?.statusCode { 89 | Logger.rts.info("Response code for fetching all mobile config profiles: \(response, privacy: .public)") 90 | } 91 | do { 92 | let allMobileConfigProfiles = try JSONDecoder().decode(AllMobileConfigProfiles.self, from: data) 93 | Logger.rts.info("\(allMobileConfigProfiles.configurationProfiles.count, privacy: .public) mobile config profiles where found") 94 | return ( allMobileConfigProfiles, httpResponse?.statusCode) 95 | } catch _ { 96 | Logger.rts.error("Could not decode mobile config profile") 97 | return (nil , nil) 98 | } 99 | } 100 | 101 | 102 | func getMobileDevceID(jssURL: String, authToken: String, serialNumber: String) async -> (Int?,Int?) { 103 | Logger.rts.info("About to fetch the mobile id for \(serialNumber)") 104 | 105 | guard var jamfMobileEndpoint = URLComponents(string: jssURL) else { 106 | return (nil, nil) 107 | } 108 | 109 | jamfMobileEndpoint.path="/JSSResource/mobiledevices/serialnumber/\(serialNumber)" 110 | 111 | guard let url = jamfMobileEndpoint.url else { 112 | return (nil, nil) 113 | } 114 | 115 | 116 | var mobileRequest = URLRequest(url: url) 117 | mobileRequest.httpMethod = "GET" 118 | mobileRequest.setValue("Bearer \(authToken)", forHTTPHeaderField: "Authorization") 119 | mobileRequest.setValue("application/json", forHTTPHeaderField: "Accept") 120 | Logger.rts.info("Fetching Mobile ID for \(serialNumber)") 121 | guard let (data, response) = try? await URLSession.shared.data(for: mobileRequest) 122 | else { 123 | return (nil, nil) 124 | } 125 | let httpResponse = response as? HTTPURLResponse 126 | if let response = httpResponse?.statusCode { 127 | Logger.rts.info("Response code for fetching mobile id: \(response, privacy: .public)") 128 | } 129 | do { 130 | let mobile = try JSONDecoder().decode(Mobile.self, from: data) 131 | Logger.rts.info("Mobile ID found: \(mobile.mobile_device.general.id, privacy: .public)") 132 | return (mobile.mobile_device.general.id, httpResponse?.statusCode) 133 | } catch _ { 134 | Logger.rts.error("No Mobile ID found") 135 | return (nil, httpResponse?.statusCode) 136 | } 137 | } 138 | 139 | 140 | 141 | 142 | 143 | func getMobileManagementID(jssURL: String, authToken: String, id: Int) async -> (String?,Int?) { 144 | Logger.rts.info("About to fetch ManagementID for mobile id \(id)") 145 | guard var jamfMobileEndpoint = URLComponents(string: jssURL) else { 146 | return (nil, nil) 147 | } 148 | jamfMobileEndpoint.path="/api/v2/mobile-devices/\(id)" 149 | guard let url = jamfMobileEndpoint.url else { 150 | return (nil, nil) 151 | } 152 | 153 | var managementidRequest = URLRequest(url: url) 154 | managementidRequest.httpMethod = "GET" 155 | managementidRequest.setValue("Bearer \(authToken)", forHTTPHeaderField: "Authorization") 156 | managementidRequest.setValue("application/json", forHTTPHeaderField: "Accept") 157 | Logger.rts.info("Fetching Management ID") 158 | guard let (data, response) = try? await URLSession.shared.data(for: managementidRequest) 159 | else { 160 | return (nil, nil) 161 | } 162 | let httpResponse = response as? HTTPURLResponse 163 | if let response = httpResponse?.statusCode { 164 | Logger.rts.info("Response code for fetching management id: \(response, privacy: .public)") 165 | } 166 | do { 167 | let mobile = try JSONDecoder().decode(MobileManagementDetail.self, from: data) 168 | Logger.rts.info("Management ID found: \(mobile.managementId, privacy: .public)") 169 | return (mobile.managementId, httpResponse?.statusCode) 170 | } catch _ { 171 | Logger.rts.error("No Management ID found") 172 | return (nil, httpResponse?.statusCode) 173 | } 174 | } 175 | 176 | 177 | 178 | func sendRTS(jssURL: String, authToken: String, wifi: String, managementid: String) async -> Int? { 179 | Logger.rts.info("About to send Return to service command to") 180 | let stringData = wifi.data(using: .utf8)! 181 | let base64EncodedString = stringData.base64EncodedString() 182 | 183 | guard var jamfMobileEndpoint = URLComponents(string: jssURL) else { 184 | return nil 185 | } 186 | jamfMobileEndpoint.path="/api/preview/mdm/commands" 187 | guard let url = jamfMobileEndpoint.url else { 188 | return nil 189 | } 190 | 191 | var rtsRequest = URLRequest(url: url) 192 | rtsRequest.httpMethod = "POST" 193 | rtsRequest.setValue("Bearer \(authToken)", forHTTPHeaderField: "Authorization") 194 | rtsRequest.setValue("application/json", forHTTPHeaderField: "Content-Type") 195 | Logger.rts.info("Sending RTS") 196 | 197 | let json = """ 198 | { 199 | "clientData": [ 200 | { 201 | "managementId": "\(managementid)" 202 | } 203 | ], 204 | "commandData": { 205 | "commandType": "ERASE_DEVICE", 206 | "returnToService": { 207 | "enabled": true, 208 | "wifiProfileData": "\(base64EncodedString)" 209 | } 210 | } 211 | } 212 | """ 213 | 214 | let data = Data(json.utf8) 215 | 216 | rtsRequest.httpBody = data 217 | guard let (data, response) = try? await URLSession.shared.data(for: rtsRequest) 218 | else { 219 | return nil 220 | } 221 | let httpResponse = response as? HTTPURLResponse 222 | if let response = httpResponse?.statusCode { 223 | Logger.rts.info("Response code for sending Return To Service: \(response, privacy: .public)") 224 | return response 225 | } 226 | 227 | return nil 228 | } 229 | 230 | func getJamfProVersion(jssURL: String, authToken: String) async -> Double? { 231 | Logger.rts.info("About to fetch the Jamf Pro version") 232 | guard var jamfcomputerEndpoint = URLComponents(string: jssURL) else { 233 | return nil 234 | } 235 | jamfcomputerEndpoint.path="/api/v1/jamf-pro-version" 236 | guard let url = jamfcomputerEndpoint.url else { 237 | return nil 238 | } 239 | var jamfProVersionRequest = URLRequest(url: url) 240 | jamfProVersionRequest.httpMethod = "GET" 241 | jamfProVersionRequest.setValue("Bearer \(authToken)", forHTTPHeaderField: "Authorization") 242 | jamfProVersionRequest.setValue("application/json", forHTTPHeaderField: "Accept") 243 | guard let (data, response) = try? await URLSession.shared.data(for: jamfProVersionRequest) 244 | else { 245 | return nil 246 | } 247 | 248 | let httpResponse = response as? HTTPURLResponse 249 | if let response = httpResponse?.statusCode { 250 | Logger.rts.info("Response code for fetching jamf pro version: \(response, privacy: .public)") 251 | } 252 | do { 253 | let jamfproVersion = try JSONDecoder().decode(JamfProVersion.self, from: data) 254 | let versionString = jamfproVersion.version 255 | if !versionString.isEmpty { 256 | let tmpArray = versionString.components(separatedBy: ".") 257 | if tmpArray.count > 2 { 258 | var realJamfVersion = Double(tmpArray[0]) ?? 0 259 | realJamfVersion = realJamfVersion + (Double(tmpArray[1]) ?? 0) / 100 260 | Logger.rts.info("Jamf pro version: \(realJamfVersion, privacy: .public)") 261 | return realJamfVersion 262 | } else { 263 | return nil 264 | } 265 | 266 | } else { 267 | return nil 268 | } 269 | 270 | } catch _ { 271 | Logger.rts.error("Could not decode jamf pro version") 272 | return nil 273 | } 274 | 275 | } 276 | 277 | func fetchMobileConfig(jssURL: String, authToken: String, id: String) async -> (MobileConfigProfile?,Int?) { 278 | Logger.rts.info("About to fetch Mobile Config for \(id, privacy: .public)") 279 | guard var jamfcomputerEndpoint = URLComponents(string: jssURL) else { 280 | return (nil, nil) 281 | } 282 | 283 | jamfcomputerEndpoint.path="/JSSResource/mobiledeviceconfigurationprofiles/id/\(id)" 284 | 285 | guard let url = jamfcomputerEndpoint.url else { 286 | return (nil, nil) 287 | } 288 | 289 | var mobileConfigRequest = URLRequest(url: url) 290 | mobileConfigRequest.httpMethod = "GET" 291 | mobileConfigRequest.setValue("Bearer \(authToken)", forHTTPHeaderField: "Authorization") 292 | mobileConfigRequest.setValue("application/json", forHTTPHeaderField: "Accept") 293 | guard let (data, response) = try? await URLSession.shared.data(for: mobileConfigRequest) 294 | else { 295 | return (nil, nil) 296 | } 297 | 298 | let httpResponse = response as? HTTPURLResponse 299 | if let response = httpResponse?.statusCode { 300 | Logger.rts.info("Response code for fetching mobile config: \(response, privacy: .public)") 301 | } 302 | do { 303 | let mobileConfig = try JSONDecoder().decode(MobileConfigProfile.self, from: data) 304 | Logger.rts.info("Mobile config profile received") 305 | return (mobileConfig, httpResponse?.statusCode) 306 | } catch _ { 307 | Logger.rts.error("Could not decode mobile config profile") 308 | return (nil, httpResponse?.statusCode) 309 | } 310 | } 311 | 312 | 313 | 314 | 315 | func getToken(jssURL: String, base64Credentials: String , useAPIRole: Bool) async -> (String?,Int?) { 316 | Logger.rts.info("About to fetch Authentication Token") 317 | guard var jamfAuthEndpoint = URLComponents(string: jssURL) else { 318 | return (nil, nil) 319 | } 320 | 321 | if useAPIRole { 322 | jamfAuthEndpoint.path="/api/oauth/token" 323 | } else { 324 | jamfAuthEndpoint.path="/api/v1/auth/token" 325 | } 326 | 327 | 328 | guard let url = jamfAuthEndpoint.url else { 329 | return (nil, nil) 330 | } 331 | 332 | let parameters = [ 333 | "client_id": username, 334 | "grant_type": "client_credentials", 335 | "client_secret": password 336 | ] 337 | 338 | 339 | var authRequest = URLRequest(url: url) 340 | authRequest.httpMethod = "POST" 341 | if useAPIRole { 342 | authRequest.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type") 343 | let postData = parameters.map { key, value in 344 | return "\(key)=\(value)" 345 | }.joined(separator: "&") 346 | authRequest.httpBody = postData.data(using: .utf8) 347 | } else { 348 | authRequest.setValue("Basic \(base64Credentials)", forHTTPHeaderField: "Authorization") 349 | } 350 | 351 | Logger.rts.info("Fetching Authentication Token") 352 | guard let (data, response) = try? await URLSession.shared.data(for: authRequest) 353 | else { 354 | return (nil, nil) 355 | } 356 | 357 | let httpResponse = response as? HTTPURLResponse 358 | 359 | if let response = httpResponse?.statusCode { 360 | Logger.rts.info("Response code for authentication: \(response, privacy: .public)") 361 | } 362 | 363 | do { 364 | 365 | if useAPIRole { 366 | let jssToken = try JSONDecoder().decode(JamfOAuth.self, from: data) 367 | Logger.rts.info("Authentication token received") 368 | return (jssToken.access_token, httpResponse?.statusCode) 369 | } else { 370 | let jssToken = try JSONDecoder().decode(JamfAuth.self, from: data) 371 | Logger.rts.info("Authentication token received") 372 | return (jssToken.token, httpResponse?.statusCode) 373 | } 374 | } catch _ { 375 | Logger.rts.error("No authentication token received") 376 | return (nil, httpResponse?.statusCode) 377 | } 378 | } 379 | 380 | 381 | 382 | 383 | 384 | } 385 | 386 | // MARK: - LAPS Password 387 | struct LAPSPassword: Codable { 388 | let password: String 389 | } 390 | 391 | // MARK: - Jamf Pro LAPS Settings 392 | struct LAPSSettings: Codable { 393 | let autoDeployEnabled: Bool 394 | let passwordRotationTime: Int 395 | let autoRotateEnabled: Bool //Added for v2 396 | let autoRotateExpirationTime: Int //Used to be autoExpirationTime under v1 397 | } 398 | 399 | 400 | 401 | 402 | // MARK: - Jamf Pro Auth Model 403 | struct JamfAuth: Decodable { 404 | let token: String 405 | let expires: String 406 | enum CodingKeys: String, CodingKey { 407 | case token 408 | case expires 409 | } 410 | } 411 | 412 | // MARK: - Jamf Pro Auth Model - API Role 413 | struct JamfOAuth: Decodable { 414 | let access_token: String 415 | let expires_in: Int 416 | enum CodingKeys: String, CodingKey { 417 | case access_token 418 | case expires_in 419 | } 420 | } 421 | 422 | 423 | // MARK: - Computer Record 424 | struct Computer: Codable { 425 | let computer: ComputerDetail 426 | } 427 | 428 | // MARK: - Computer Model 429 | struct ComputerDetail: Codable { 430 | let general: General 431 | 432 | enum CodingKeys: String, CodingKey { 433 | case general 434 | } 435 | } 436 | 437 | struct General: Codable { 438 | let id: Int 439 | enum CodingKeys: String, CodingKey { 440 | case id 441 | } 442 | } 443 | 444 | 445 | // MARK: - ComputerManagementId 446 | struct ComputerManagementId: Decodable { 447 | let id: String 448 | let general: GeneralManagementId 449 | enum CodingKeys: String, CodingKey { 450 | case id 451 | case general 452 | } 453 | 454 | } 455 | 456 | struct GeneralManagementId: Codable { 457 | let managementId: String 458 | enum CodingKeys: String, CodingKey { 459 | case managementId 460 | } 461 | 462 | } 463 | 464 | -------------------------------------------------------------------------------- /Jamf Return To Service/Jamf_Return_To_Service.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.files.user-selected.read-only 8 | 9 | com.apple.security.network.client 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Jamf Return To Service/Jamf_Return_To_ServiceApp.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Jamf_Return_To_ServiceApp.swift 3 | // Jamf Return To Service 4 | // 5 | // Created by Richard Mallion on 05/09/2023. 6 | // 7 | 8 | import SwiftUI 9 | 10 | @main 11 | struct Jamf_Return_To_ServiceApp: App { 12 | var body: some Scene { 13 | WindowGroup { 14 | ContentView() 15 | .frame( 16 | minWidth: 500, maxWidth: 500, 17 | minHeight: 150, maxHeight: 150) 18 | 19 | } 20 | .windowResizability(.contentSize) 21 | 22 | Settings { 23 | SettingsView() 24 | .frame( 25 | minWidth: 500, maxWidth: 500, 26 | minHeight: 175, maxHeight: 175) 27 | } 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Jamf Return To Service/Keychain.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Keychain.swift 3 | // Jamf Return To Service 4 | // 5 | // Created by Richard Mallion on 05/09/2023. 6 | // 7 | 8 | import Foundation 9 | import Security 10 | 11 | let kSecAttrAccountString = NSString(format: kSecAttrAccount) 12 | let kSecValueDataString = NSString(format: kSecValueData) 13 | let kSecClassGenericPasswordString = NSString(format: kSecClassGenericPassword) 14 | 15 | class Keychain { 16 | 17 | func save(service: String, account: String, data: String) { 18 | 19 | if let password = data.data(using: String.Encoding.utf8) { 20 | var keychainQuery: [String: Any] = [kSecClass as String: kSecClassGenericPassword, 21 | kSecAttrService as String: service, 22 | kSecAttrAccount as String: account, 23 | kSecValueData as String: password] 24 | 25 | // see if credentials already exist for server 26 | let accountCheck = retrieve(service: service) 27 | if accountCheck.count == 0 { 28 | // try to add new credentials, if account exists we'll try updating it 29 | let addStatus = SecItemAdd(keychainQuery as CFDictionary, nil) 30 | if (addStatus != errSecSuccess) { 31 | if let addErr = SecCopyErrorMessageString(addStatus, nil) { 32 | print("[addStatus] Write failed for new credentials: \(addErr)") 33 | } 34 | } 35 | } else { 36 | // credentials already exist, try to update 37 | keychainQuery = [kSecClass as String: kSecClassGenericPasswordString, 38 | kSecAttrService as String: service, 39 | kSecMatchLimit as String: kSecMatchLimitOne, 40 | kSecReturnAttributes as String: true] 41 | let updateStatus = SecItemUpdate(keychainQuery as CFDictionary, [kSecAttrAccountString:account,kSecValueDataString:password] as [NSString : Any] as CFDictionary) 42 | if (updateStatus != errSecSuccess) { 43 | if let updateErr = SecCopyErrorMessageString(updateStatus, nil) { 44 | print("[updateStatus] Update failed for existing credentials: \(updateErr)") 45 | } 46 | } 47 | } 48 | } 49 | } 50 | 51 | func retrieve(service: String) -> [String] { 52 | 53 | var storedCreds = [String]() 54 | 55 | let keychainQuery: [String: Any] = [kSecClass as String: kSecClassGenericPasswordString, 56 | kSecAttrService as String: service, 57 | kSecMatchLimit as String: kSecMatchLimitOne, 58 | kSecReturnAttributes as String: true, 59 | kSecReturnData as String: true] 60 | var item: CFTypeRef? 61 | let status = SecItemCopyMatching(keychainQuery as CFDictionary, &item) 62 | guard status != errSecItemNotFound else { return [] } 63 | guard status == errSecSuccess else { return [] } 64 | 65 | guard let existingItem = item as? [String : Any], 66 | let passwordData = existingItem[kSecValueData as String] as? Data, 67 | let account = existingItem[kSecAttrAccount as String] as? String, 68 | let password = String(data: passwordData, encoding: String.Encoding.utf8) 69 | else { 70 | return [] 71 | } 72 | storedCreds.append(account) 73 | storedCreds.append(password) 74 | return storedCreds 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /Jamf Return To Service/Logger.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Logger.swift 3 | // Jamf Return To Service 4 | // 5 | // Created by Richard Mallion on 05/09/2023. 6 | // 7 | 8 | import Foundation 9 | import os.log 10 | 11 | extension Logger { 12 | private static var subsystem = Bundle.main.bundleIdentifier! 13 | 14 | //Categories 15 | static let rts = Logger(subsystem: subsystem, category: "rts") // added lnh 16 | } 17 | -------------------------------------------------------------------------------- /Jamf Return To Service/Models.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Models.swift 3 | // Jamf Return To Service 4 | // 5 | // Created by Richard Mallion on 05/09/2023. 6 | // 7 | 8 | import Foundation 9 | 10 | // MARK: - Wi-Fi PopupMenu 11 | struct WiFiMenuItem: Hashable { 12 | let id = UUID() 13 | let name: String 14 | let profileID: String 15 | 16 | } 17 | 18 | // MARK: - All MobileConfigProfile 19 | struct AllMobileConfigProfiles: Codable { 20 | let configurationProfiles: [ConfigurationProfile] 21 | 22 | enum CodingKeys: String, CodingKey { 23 | case configurationProfiles = "configuration_profiles" 24 | } 25 | 26 | // MARK: - ConfigurationProfile 27 | struct ConfigurationProfile: Codable { 28 | let id: Int 29 | let name: String 30 | } 31 | 32 | } 33 | 34 | // MARK: - MobileConfigProfile 35 | struct MobileConfigProfile: Codable { 36 | let configurationProfile: ConfigurationProfile 37 | 38 | enum CodingKeys: String, CodingKey { 39 | case configurationProfile = "configuration_profile" 40 | } 41 | } 42 | 43 | // MARK: - ConfigurationProfile 44 | struct ConfigurationProfile: Codable { 45 | let general: GeneralPayload 46 | 47 | enum CodingKeys: String, CodingKey { 48 | case general 49 | } 50 | } 51 | 52 | // MARK: - GeneralPayload 53 | struct GeneralPayload: Codable { 54 | let id: Int 55 | let name: String 56 | let payloads: String 57 | 58 | enum CodingKeys: String, CodingKey { 59 | case id, name 60 | case payloads 61 | } 62 | } 63 | 64 | 65 | // MARK: - Jamf Pro Version 66 | struct JamfProVersion: Codable { 67 | let version: String 68 | 69 | enum CodingKeys: String, CodingKey { 70 | case version 71 | } 72 | } 73 | 74 | 75 | // MARK: - Mobile Record 76 | struct Mobile: Codable { 77 | let mobile_device: MobileDetail 78 | } 79 | 80 | // MARK: - Mobile Detail 81 | struct MobileDetail: Codable { 82 | let general: MobileGeneral 83 | 84 | enum CodingKeys: String, CodingKey { 85 | case general 86 | } 87 | } 88 | 89 | struct MobileGeneral: Codable { 90 | let id: Int 91 | enum CodingKeys: String, CodingKey { 92 | case id 93 | } 94 | } 95 | 96 | 97 | 98 | struct MobileManagementDetail: Codable { 99 | let id: String 100 | let serialNumber: String 101 | let managementId: String 102 | enum CodingKeys: String, CodingKey { 103 | case id 104 | case serialNumber 105 | case managementId 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /Jamf Return To Service/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Jamf Return To Service/SettingsView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SettingsView.swift 3 | // Jamf Return To Service 4 | // 5 | // Created by Richard Mallion on 05/09/2023. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct SettingsView: View { 11 | @AppStorage("jamfURL") var jamfURL: String = "" 12 | @AppStorage("userName") var userName: String = "" 13 | @AppStorage("useAPIRoles") var useAPIRoles: Bool = false 14 | 15 | @State var userNameLabel: String = "Username:" 16 | @State var passwordLabel: String = "Password:" 17 | 18 | // @AppStorage("savePassword") var savePassword: Bool = false 19 | @State private var password = "" 20 | 21 | var body: some View { 22 | VStack(alignment: .trailing){ 23 | HStack(alignment: .center) { 24 | 25 | VStack(alignment: .trailing, spacing: 12.0) { 26 | Text("Jamf Server URL:") 27 | Text(userNameLabel) 28 | Text(passwordLabel) 29 | } 30 | 31 | VStack(alignment: .leading, spacing: 7.0) { 32 | TextField("https://your-jamf-server.com" , text: $jamfURL) 33 | .textFieldStyle(.roundedBorder) 34 | 35 | TextField("Your Jamf Pro admin user name" , text: $userName) 36 | .textFieldStyle(.roundedBorder) 37 | 38 | SecureField("Your password" , text: $password) 39 | .textFieldStyle(.roundedBorder) 40 | .onChange(of: password) { newValue in 41 | savePasswordToKeychain() 42 | } 43 | } 44 | } 45 | .padding() 46 | HStack() { 47 | Spacer() 48 | Toggle(isOn: $useAPIRoles) { 49 | Text("Use API Roles and Clients") 50 | } 51 | .toggleStyle(.checkbox) 52 | .onChange(of: useAPIRoles) { newValue in 53 | if useAPIRoles { 54 | userNameLabel = "Client ID:" 55 | passwordLabel = "Client Secret:" 56 | } else { 57 | userNameLabel = "Username:" 58 | passwordLabel = "Password:" 59 | } 60 | } 61 | 62 | Spacer() 63 | } 64 | 65 | // Toggle(isOn: $savePassword) { 66 | // Text("Save Password") 67 | // } 68 | // .toggleStyle(CheckboxToggleStyle()) 69 | // .offset(x: -260 , y: -10) 70 | // .onChange(of: savePassword) { newValue in 71 | // savePasswordToKeychain() 72 | // } 73 | 74 | } 75 | .onAppear { 76 | let defaults = UserDefaults.standard 77 | userName = defaults.string(forKey: "userName") ?? "" 78 | jamfURL = defaults.string(forKey: "jamfURL") ?? "" 79 | useAPIRoles = defaults.bool(forKey: "useAPIRoles") 80 | if useAPIRoles { 81 | userNameLabel = "Client ID:" 82 | passwordLabel = "Client Secret:" 83 | } else { 84 | userNameLabel = "Username:" 85 | passwordLabel = "Password:" 86 | } 87 | 88 | // savePassword = defaults.bool(forKey: "savePassword" ) 89 | // if savePassword { 90 | let credentialsArray = Keychain().retrieve(service: "uk.co.mallion.jamf-return-to-service") 91 | if credentialsArray.count == 2 { 92 | userName = credentialsArray[0] 93 | password = credentialsArray[1] 94 | } 95 | // } 96 | } 97 | } 98 | 99 | func savePasswordToKeychain() { 100 | DispatchQueue.global(qos: .background).async { 101 | Keychain().save(service: "uk.co.mallion.jamf-return-to-service", account: userName, data: password) 102 | } 103 | } 104 | } 105 | 106 | struct SettingsView_Previews: PreviewProvider { 107 | static var previews: some View { 108 | SettingsView() 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 red5coder 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # jamf-return-to-service 2 | With the release of Jamf Pro 10.50, a new API endpoint was added, which introduces the new Return To Service feature for iOS 17 and iPadOS 17. 3 | 4 | Return to Service enables a mobile device management server (MDM) such as Jamf Pro to send a wipe command (Erase All Content and Settings) that includes an enrollment profile and Wi-Fi profile. 5 | 6 | This allows you to wipe the device and have it automatically re-enroll straight back to the home screen without user interaction. 7 | 8 | This app is a POC to demonstrate this new feature. When launched you can ask it to fetch a list of configuration profiles that contain a wi-fi payload from Jamf Pro. Just select which one you want to use and enter the serial number of the mobile device. 9 | 10 | ### Requirements 11 | 12 | - A Mac running macOS Ventura (13.0) or higher to run this app 13 | - Jamf Pro 10.50 or higher 14 | - The iOS and iPadOS devices must be running v17+ 15 | - The iOS and iPadOS must be enabled for Automated Enrollment 16 | - A Wi-Fi configuration profile that can be used with the Return of Service. This profile must allow wi-fi access without user interaction and must not use a captive portal. Make sure this profile stays scoped to the device after enrollment. 17 | - Jamf Pro Account or API Role / Client that has the following minimum permissions 18 | - Read Mobile Devices 19 | - Read Mobile Device Configuration Profiles 20 | - Send Mobile Device Remote Wipe Command 21 | - View MDM Command Information in Jamf Pro API 22 | 23 | ### PLEASE NOTE THIS IS CURRENTLY IN BETA 24 | 25 | ### History 26 | 27 | - 0.9 , Initial release 28 | - 0.9.5 , Now searches for configuration profiles in Jamf Pro that contain a wi-fi payload 29 | 30 | 31 | v0 9 5 32 | --------------------------------------------------------------------------------