Address issues with /mdm/checkin endpoint#871
Conversation
jessepeterson
left a comment
There was a problem hiding this comment.
So my observation here is that in however many years we've been going we've never had the timestamp issue come up on cert verification. Further I'd want to determine where 5 minutes comes from — did we just pick that? I think the SCEP server tries to issue certs from -10 minutes ago — but of course that's for new enrollments. And then if we did want an arbitrary time in there we should make it a documented const.
I'd probably learn towards not wanting to add a specific verification timestamp exemption — especially if errors will be properly logged now (i.e. the case that brought this up would probably have been caught).
|
Yeah the 5 minutes was a bit arbitrary, but a fairly safe bet. For instance, this is what Microsoft recommends. I added a commit to move it to a documented var. I'm also surprised this is the first time we've seen it. I'm not sure, but it seems like the cert in question wasn't the SCEP cert, but a cert generated by the device (so maybe this was OTA enrollment? I don't really have any experience with that). The biggest reason I think that is because how else would this situation arise? If it was a SCEP cert, it would be generated by the server, so it wouldn't really matter what the device's time was. I think this would also answer the question of why it hasn't been seen yet: most people using MicroMDM are using DEP, so they would just use the SCEP cert to begin with. This particular issue occurred when someone was enrolling an Apple TV with Configurator. Apologies if I'm not understanding these processes correctly; I've read through the wiki and the OTA code, but I'm still not 100% clear on the process. Would it even make sense to see a device-generated cert on the /mdm/checkin endpoint? Assuming I am correct above, then adding a skew (of 5 minutes or whatever) makes a lot of sense. If a device is generating it's own cert on the fly, if it's just a few seconds ahead of the server, then it will be out of the validity period. When @tgunz synced his server with NTP, it was only 2 seconds offset, and that was enough to allow the device to enroll. |
|
To recap our discussion of this PR during office hours today:
|
c466341 to
505aac2
Compare
|
After doing some testing, I'm less convinced that a configurable skew (or skew at all) is needed. Despite adding a manual skew of several hours in both directions on the server, MicroMDM seems to have no issue verifying requests on For now, I suggest we merge this PR, which I've rebased to only contain the go-kit error logging fix, as we know that's definitely an issue and an easy fix. I've kept the skew flag code on this branch. If this does end up becoming a visible issue now that the error logging is fixed, we can address those changes again. |
|
Now that this is merged I came across #406 again fwiw — sort of related to errors being hidden and such. 🤷 |
This PR is to address some issues discovered while troubleshooting enrollment issues on the MacAdmins Slack: