-
Notifications
You must be signed in to change notification settings - Fork 104
Invalid MDM service URL 5.1.0-rc4 #368
Description
My super.log indicated that my MDM was unreachable, so I dug into the code a bit and found this line:
mdm_service_url="https://$(echo "${profiles_response}" | grep 'MDM server' | awk -F '/' '{print $3;}')"
....where the $profiles_response is the output of the command 'profiles status -type enrollment'. When I run that command, I see that the string "MDM server" appears twice. The results of that is that $mdm_service_url is populated with my MDM hostname twice with a line ending in between them, which is not a valid URL to later pass to curl.
❯ profiles status -type enrollment
ReadDebugLevel gDebugLevel = -2
ReadDebugLevel gCollateLogs = 1
Apr 3 09:58:24[13852:0]: profiles: built Feb 27 2026 20:59:16
Apr 3 09:58:24[13852:0]: profiles: running as euid: 828784241
Apr 3 09:58:24[13852:0]: profiles: new option = t
Apr 3 09:58:24[13852:0]: profiles command = 100 (100+ = configuration; 200+ = provisioning)
Apr 3 09:58:24[13852:0]: profiles command: has configuration profiles installed?
Apr 3 09:58:24[13852:0]: profiles.Status_Profiles
ReadDebugLevel gDebugLevel = -2
ReadDebugLevel gCollateLogs = 1
Apr 3 09:58:24[13852:0]:+CPProfileManager.allProfiles _________________________________________________________
Apr 3 09:58:24[13852:0]:+MIG_ProfilesForAllUsersAsCPProfile inDictLength = 70, inDictBytes = TRUE
Apr 3 09:58:24[13852:0]:+MIG_ProfilesForAllUsersAsCPProfile sending command = 6
Apr 3 09:58:24[13852:0]:+ server returned result 0, status = 0
Apr 3 09:58:24[13852:0]:+MIG_ProfilesForAllUsersAsCPProfile return count = 104 (error = 0)
Apr 3 09:58:24[13852:0]:+Loading MCXTools interface from: /System/Library/CoreServices/ManagedClient.app/Contents/PlugIns/MCXToolsInterface.bundle
Apr 3 09:58:24[13852:0]: profiles.Status_Profiles: MDM server: https://my_org.jamfcloud.com/mdm/ServerURL
Enrolled via DEP: Yes
MDM enrollment: Yes (User Approved)
MDM server: https://my_org.jamfcloud.com/mdm/ServerURL
Apr 3 09:58:24[13852:0]: profiles: main exit returned no error
Perhaps the grep should be anchored to the beginning of the line?
mdm_service_url="https://$(echo "${profiles_response}" | grep '^MDM server' | awk -F '/' '{print $3;}')"