jamf / mut

MIT License
131 stars 11 forks source link

Enforce Mobile Device Names throwing an error #89

Closed ChicagoJay closed 1 year ago

ChicagoJay commented 1 year ago

When we try to import device names and set the Enforce Mobile Device Names flag, we get an error:

Enforcing Mobile Device Names requires Jamf Pro 10.33 or higher. Please upgrade to the latest version of Jamf Pro in order to use this feature.

We originally saw this when we were hosted. Right in the middle of a run, we got an INVALID_TOKEN error, and it hasn't worked since.

2022-09-13 03:17:16 [INFO  ]: <?xml version="1.0" encoding="UTF-8"?><mobile_device><id>6927</id></mobile_device>
2022-09-13 03:17:16 [INFO  ]: Submitting a request to to update the name of device *REDACTED* to 'iPad 7548' with enforcement set to TRUE.
2022-09-13 03:17:16 [INFO  ]: Successful name enforcement request. 200.
2022-09-13 03:17:16 [INFO  ]: Submitting a PUT to https://*REDACTED*:8443/JSSResource/mobiledevices/serialnumber/*REDACTED*
2022-09-13 03:17:17 [INFO  ]: Successful PUT completed. 201.
2022-09-13 03:17:17 [INFO  ]: <?xml version="1.0" encoding="UTF-8"?><mobile_device><id>6921</id></mobile_device>
2022-09-13 03:17:17 [INFO  ]: Submitting a request to to update the name of device *REDACTED* to 'iPad 7549' with enforcement set to TRUE.
2022-09-13 03:17:17 [INFO  ]: Successful name enforcement request. 200.
2022-09-13 03:36:59 [INFO  ]: Beginning CSV Parse - Attributes update.
2022-09-13 03:36:59 [INFO  ]: Attempting to GET the Jamf Pro Version from the API.
2022-09-13 03:36:59 [ERROR ]: Failed PATCH. 401.
2022-09-13 03:36:59 [ERROR ]: {
  "httpStatus" : 401,
  "errors" : [ {
    "code" : "INVALID_TOKEN",
    "description" : "Unauthorized",
    "id" : "0",
    "field" : null
  } ]
}
2022-09-13 03:36:59 [INFO  ]: Jamf Pro Version: 
2022-09-13 03:36:59 [ERROR ]: Enforcing Mobile Device Names requires Jamf Pro 10.33 or higher. Please upgrade to the latest version of Jamf Pro in order to use this feature.
2022-09-13 03:36:59 [INFO  ]: Submitting a PUT to https://*REDACTED*:8443/JSSResource/mobiledevices/serialnumber/*REDACTED*
2022-09-13 03:37:00 [INFO  ]: Successful PUT completed. 201.
2022-09-13 03:37:00 [INFO  ]: <?xml version="1.0" encoding="UTF-8"?><mobile_device><id>4945</id></mobile_device>
2022-09-13 03:37:00 [ERROR ]: Enforcing Mobile Device Names requires Jamf Pro 10.33 or higher. Please upgrade to the latest version of Jamf Pro in order to use this feature.
2022-09-13 03:37:00 [INFO  ]: Submitting a PUT to https://*REDACTED*:8443/JSSResource/mobiledevices/serialnumber/*REDACTED*
2022-09-13 03:37:00 [INFO  ]: Successful PUT completed. 201.

Since we've migrated to the cloud, nothing has changed. Same error.

ChicagoJay commented 1 year ago

OK, so I changed the address in MUT from our CNAME to the jamfcloud.com address, and it's not throwing the error any more, but it's taking a full 10-12 seconds to do a single row from the CSV. I imagine that is a hosting issue though.

I'll leave this here for posterity, so maybe someone else having the error about the version can see how to get past it.

ChicagoJay commented 1 year ago

OK, I opened a case with Jamf, and I think the problem is that the token expires after 30 minutes - that's hard coded. When I am trying to set values on more than about 100 devices, the token expires before the MUT gets through the CSV. When we were on-prem, each line took a second or two. But on cloud-hosted, each one is taking 6-7 seconds. I'm still working with Jamf to get those API calls to run faster, but I'll never be able to do a MUT run on a thousand devices unless the MUT can renew that token when it expires, and retry the line that failed.

mike-levenick commented 1 year ago

Hey @ChicagoJay , I have a pre-release build that auto-renews tokens. I'd be happy to send it your way if you want. Feel free to shoot me an email, and I'll get it built and send it over.

ChicagoJay commented 1 year ago

Heck yeah!  I'm in!

-- Jay Duff, ACMT, ACiT, CCE Network Specialist Mannheim School District 83 Franklin Park, IL

On 10/6/2022 11:54 AM, Mike Levenick wrote:

Hey @ChicagoJay https://github.com/ChicagoJay , I have a pre-release build that auto-renews tokens. I'd be happy to send it your way if you want. Feel free to shoot me an email, and I'll get it built and send it over.

— Reply to this email directly, view it on GitHub https://github.com/mike-levenick/mut/issues/89#issuecomment-1270406289, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADHLKBW25A55ZM3NA6EE3VDWB373JANCNFSM6AAAAAAQ36EWDY. You are receiving this because you were mentioned.Message ID: @.***>

mikelevenick commented 1 year ago

Hey @ChicagoJay I'm going to mark this one as closed. Let us know if you have any other issues or questions.

The auto-renew of the token will be merged to the main product sometime soon.