fleetdm / fleet

Open-source platform for IT, security, and infrastructure teams. (Linux, macOS, Chrome, Windows, cloud, data center)
https://fleetdm.com
Other
3.02k stars 419 forks source link

Takes too long to clear ABM terms banner #13012

Closed noahtalerman closed 11 months ago

noahtalerman commented 1 year ago

Fleet version: Observed in Fleet's dogfood environment (commit 8fb694f)


🧑‍💻  Expected behavior

Apple Business Manager (ABM) terms expired. I saw the new terms banner in the Fleet UI. I accepted the new terms on ABM.

I navigated to the Hosts page in Fleet and waited 60 seconds. I refreshed the page. I expected the ABM terms banner in Fleet to be gone because the default interval in which Fleet talks to ABM is 60 seconds (see configuration option here).

💥  Actual behavior

It took ~15 mins for the ABM terms banner to dissapear.

More info

A customer also experienced this delay. It took 1 hr+ for the banner to clear.

This customer also had something weird going on with their ABM connection. More in Slack here (internal). Separate issue is captured here: #12958

Code where we connect to DEP: https://github.com/fleetdm/fleet/blob/09e6bf98079cd66eeb0cd8b0f0ba5801ebbebb9e/server/mdm/apple/apple_mdm.go#L531

Original story for the ABM terms banner feature: #8537

noahtalerman commented 1 year ago

@gillespi314 when does Fleet hit the DEP API and clear the flag? If we hit the API on every page in the UI we might want to update the copy in the banner.

Currently the copy tells the IT admin to navigate to the Hosts page to clear the banner. For reference, I saw the banner clear when I navigated to the Host details page.

gillespi314 commented 1 year ago

when does Fleet hit the DEP API and clear the flag?

By my reading, this happens when a server starts up and then every DEP-sync loop (60 seconds by default). If it detects a change, it is supposed to update the flag in the app config. It's not tied directly to any UI actions.

In most cases, UI reloads the app config when the user navigates between main tabs. There might be some exceptions that I can't recall right now.

noahtalerman commented 1 year ago

Update from Martin: IIRC the flag would clear on the next successful API call to Apple's DEP API (once the terms have been accepted). I'm not sure how often/at what frequency those calls are made, though.

ireedy commented 1 year ago

Bug has aged out. Moving back to product drafting.

georgekarrv commented 11 months ago

Timebox this to trying to find the missing link for ~2hr otherwise would love to bring a user action button through design if we can't easily find this.

mna commented 11 months ago

Uses of the Apple DEP API Client

Caching of AppConfig

Logging of Terms-related Actions

Potential Causes

The fact that the banner does show up and disappear eventually would indicate that the logic and behavior around detecting the terms changes is working as intended.

In light of this:

mna commented 11 months ago

@noahtalerman @georgekarrv See my comment above for my findings in the timeboxed investigation.

tl;dr; a) I created and merged a PR which logs without requiring Debug logging when the terms flag changes, b) someone from the frontend should confirm that there's no caching issue on the frontend, c) next terms change we should grab the logs and look at the time-frame of events.

It's possible that ~15 minutes is the time it takes for Apple to reflect the newly-agreed state in the API requests.

Should I move this to "ready for release" as there's nothing to QA for now, or should we keep the ticket active so we do the follow-up steps next time the terms change?

mna commented 11 months ago

We were able to test this through a real ABM terms change almost immediately, and we could see that:

  1. The cron job calls the Apple API each minute as expected;
  2. Once the terms were accepted in ABM, Apple kept on replying to the API calls with the T_C_NOT_SIGNED error for over 25 minutes;
  3. Once Apple's API stop returning that error, the banner promptly disappeared from the Web page, so there's no frontend caching that is causing other delays

So the reason for the delay is out of our control, due to how Apple keeps sending the T_C_NOT_SIGNED error long after the terms were accepted. We should handle that through UX/UI, I'll assign the ticket to @noahtalerman to review the banner text.

noahtalerman commented 11 months ago

Thanks Martin!

Hey @marko-lisica passing this one to you. Do you think we should update the copy?

marko-lisica commented 11 months ago

Private Zenhub Image

The decision for this one is to change copy only to make clear that user might need to wait some time for banner to disappear. (see image above)

New copy: Your organization can’t automatically enroll macOS hosts until you accept the new terms and conditions for Apple Business Manager (ABM). An ABM administrator can accept these terms. Done? It might take some time for ABM to report back to Fleet.

@mna @noahtalerman @georgekarrv

sabrinabuckets commented 11 months ago

Due to the nature of this issue—only being testable when Apple releases new T&Cs—it isn't immediately testable. I have reviewed the copy changes in the linked PR and am comfortable with the decisions made.

noahtalerman commented 11 months ago

@sabrinabuckets FWIW I think you can test this by manually setting a specific flag.

fleet-release commented 11 months ago

Banner lingers on, Swift sync brings clarity, Fleet's time now aligns.