twocanoes / xcreds

Open Source Project for Syncing IdP password with macOS login password
BSD 3-Clause "New" or "Revised" License
223 stars 25 forks source link

XCreds Login Window Overlay Wallpaper not caching? #247

Open dstranathan opened 2 months ago

dstranathan commented 2 months ago

It appears that when some of my test Macs (usually on Ethernet) do not cache the wallpaper as expected when using a URL to a publicly-host URL.

Process to test:

1 Install and test XCreds. Log in with Entra/AD accounts works fine. Wallpaper appears.

2 Reboot Mac. If network is down (or Mac is still obtaining an IP via DHCP etc), the native Apple macOS wallpaper appears - not the cached wallpaper in /Library/Caches/com.twocanoes.xcreds/. Sometimes the cached wallpaper exists in Library/Caches/com.twocanoes.xcreds/, sometimes it does not.

Other test users on desktop Macs have reported this.

I can navigate to the URL manually in any browser and see the wallpaper image.

Key:

loginWindowBackgroundImageURL https://srmextpubcontent.blob.core.windows.net/wwwpub/ITOPS/xcreds/xcreds_loginwindow_00.png

Simple test: -Boot a Mac (with live Ethernet in this example). Do not log in. -Connect over SSH to the Mac to monitor /Library/Caches/com.twocanoes.xcreds/ -XCreds will render the wallpaper as expected. Wallpaper does not get cached. -Disconnect Ethernet (loses SSH). -After a few minutes (XCreds set to refresh every ~5 mins), the wallpaper reverts to Apple default. -Plug the Ethernet back in and the wallpaper will be rendered by XCreds again. -After I log into the Mac, I can confirm again that the wallpaper was not cached.

(I tried logging this test over SSH via debug enabled but I dont see any details regarding the wallpaper)

Note: I have tested on my LAN (802.1x EAP-TLS machine auth) but also on a 'consumer' Spectrum cable connection. Seems like the Macs dont get an IP fast enough sometimes, and therefore XCreds renders an Apple default wallpaper (because the Mac doesn't have a cached wallpaper).

I have noticed on some test Macs that the XCreds cached image is 20+ MB(!), but the hosted image is ~150k (even when manually downloaded from a browser or using curl its ~150k). I have talked to my web team and they dont have an answer ("Its XCreds - not us").

Example curl test: curl https://srmextpubcontent.blob.core.windows.net/wwwpub/ITOPS/xcreds/xcreds_loginwindow_00.png --output ~/Downloads/testing_wallpaper.png

dstranathan commented 1 month ago

Update: I noticed on 2 test Macs that XCReds happened to cache one of Apple's default wallpapers (even though it already exists locally in /System/Library/Desktop Pictures/)

The cached image is /Library/Caches/com.twocanoes.xcreds/DefaultDesktop.heic and it is 542MB in size!

davelebbing commented 1 month ago

@twocanoes I am seeing the background image get cached immediately at the login screen as expected. I'm not able to replicate the scenario where the login screen refresh reverts the background image but this may need further consideration.

I am seeing the cached image files be larger than expected and caching of the default background image, but so far they are smaller than as described previously.

dstranathan commented 1 month ago

More info to share - hope it's useful...

In some cases, XCreds will display our custom wallpaper from its hosted URL as expected, but it won't get cached. Makes me think XCReds cant write to the cache directory...?

I attached ls terminal output of the cache dir's POSIX permissions. See screenshot.

Sometimes deleting the cache dir ( /Library/Caches/com.twocanoes.xcreds) and rebooting resolves the issue. I haven't monitored to see if the problem will return later (Ill have test users reboot/logout more often to increase the frequency).

In other cases the wallpaper may not be displayed at all (reverts to native Apple wallpaper) and of course doesn't (or cant) get cached.

Sometimes when an Apple native HEIC wallpaper is displayed, it also gets cached into /Library/Caches/com.twocanoes.xcreds. Not sure if this expected or not. And as I mentioned, the file can be as big as 243MB. See screenshot.

I attached an example of our custom cached wallpaper file size (~23MB). Source is ~152k. See screenshot.

Screenshot 2024-08-02 at 10 22 46

Screenshot 2024-08-02 at 10 24 16

Screenshot 2024-08-02 at 10 46 21

twocanoes commented 1 month ago

fixed large local image being cached, as well as added in additional logging to figure out the other mentioned issues. Please see if you can replicate and then send me the log. Build 7106 or later.

dstranathan commented 1 month ago

So far, as of build 7130, XCreds appears to be caching more consistently, but the cached image is still ~23MB.

I have removed any exiting cached images, rebooted, etc (making sure Im getting a "fresh" image cached). I have tested on various networks and 3 versions of macOS.

I have 5 test Macs at my disposal today but will ask other IT testers to get build 7130, delete any existing caches, and try again.

dstranathan commented 1 month ago

Update as of 7147:

XCreds is caching consistently, but cached image is ~23MB.

Im up to 10+ test Macs now and this is 100% reproducible.