fleet icon indicating copy to clipboard operation
fleet copied to clipboard

Fleet Desktop: self-service option temporarily disappears

Open ambrusps opened this issue 2 years ago • 8 comments

4.56:

Chrome 128.0.6613.120:


💥  Actual behavior

Video: https://www.loom.com/share/de0e517b7c1e47b590f71bae46f64469 When clicking on Fleet Desktop, the "self-service" item temporarily disappears.

🧑‍💻  Steps to reproduce

  1. Click on Fleet Desktop

🕯️ More info (optional)

Ian: Just took a look at the code of Fleet Desktop/Orbit and it looks like you’re seeing the behavior shown in https://www.loom.com/share/7c5968b8ed1a481a8ffd46e8fdac1ea4. Basically, opening up the self-service UI triggers a resync of device status back to Fleet Desktop, so policy information in the menu bar icon matches what’s shown in the web UI. The catch with this is while things are syncing the self-service menu is greyed out because the client isn’t yet sure that that feature is enabled on the server (Fleet Free doesn’t have it). Victor: Please file a bug. When we refresh, we can keep the old state instead of disabling the self-service.

Test Plan

Since this is a Fleet Desktop change, it needs to be tested cross-platform.

  1. Apply this diff to make it quicker/easier to spot intermediate states, then change deviceAuthTokenTTL in server/service/devices.go to 20 * time.Second to force invalid auth, then build Fleet Desktop locally (local TUF). The second change here is needed because otherwise Orbit does too good a job of renewing tokens before they expire.
  2. With the server on Fleet Free, confirm that self-service menu item doesn't show up.
  3. Switch to Fleet Premium on the server. Shouldn't see a self-service item, including when reconnecting after failed auth, which should show as "Connecting..." every ~30 seconds for ~15 seconds.
  4. Add a self-service software title for the appropriate platform. Fleet Desktop should now show the Self-Service menu item as soon as "Connecting..." is replaced with "My Device", on a similar schedule to the above.

If you want to test as-is you'll need to wait for an hour for creds to roll over, and catch Fleet Desktop right as it's rotating the token after the token has expired, so while QA'ing that way is doable it's impractical.

ambrusps avatar Sep 10 '24 16:09 ambrusps

Related commit: https://github.com/fleetdm/fleet/commit/4a159dd0cca3ab43ebd96699b76e6f5c3a9e7f03

iansltx avatar Nov 06 '24 23:11 iansltx

@ambrusps I'm going to make a tweak that should solve this, but I'm not able to repro the issue so one thing that'll be helpful here is getting desktop logs: (at ~/Library/Logs/Fleet/fleet-desktop.log). Not 100% that the debug logging will be there, nor that the logs will go back to September 9th when this happened, but if the logs are there then I can be more sure that the fix will work.

iansltx avatar Nov 08 '24 05:11 iansltx

Going to go with the fix I have PR'd. Will move this to Ready for QA once I've tested on Windows and Linux.

iansltx avatar Nov 08 '24 15:11 iansltx

Was able to get logs and this is definitely a case of clicking when the token was rotating, with tray items not immediately fully populating:

2024-09-09T20:26:39-07:00 INF token file changed, rechecking
2024-09-09T20:26:39-07:00 DBG disabling tray items
2024-09-09T20:26:39-07:00 DBG successfully refetched the token from disk
2024-09-09T20:26:39-07:00 DBG enabling tray items

If we had enabled self-service in the block, as per the PR, it would've popped up quickly enough here to not be an issue.

iansltx avatar Nov 08 '24 16:11 iansltx

Confirmed in standup/parking lot that since this is a very platform-agnostic change, my self-QA will be limited to macOS, though I'll run with the full test plan mentioned above. @xpkoala confirmed that he'll test through this on Windows/Linux as part of QA-by-not-the-person-who-wrote-the-fix. Thx in advance @xpkoala!

iansltx avatar Nov 08 '24 19:11 iansltx

Verified on macOS with pathological timeouts client- and server-side.

iansltx avatar Nov 08 '24 23:11 iansltx

Menu fades, then returns, A syncing dance in the cloud, Users find their path.

fleet-release avatar Nov 27 '24 21:11 fleet-release