halo / LinkLiar

:link: Link-Layer MAC spoofing GUI for macOS
http://halo.github.io/LinkLiar
MIT License
1.23k stars 84 forks source link

Unable to write to config.json #62

Closed keithknott26 closed 7 months ago

keithknott26 commented 11 months ago

Despite allowing everyone read/write access to config.json LinkLiar reports its still unable to write to the config file. Im using the pre-release version of LinkLiar 3.2.0 OS X Ventura 13.4.1.

The advanced options show that the config file is writeable. However when you attempt to change the interface to random, it reports the error below in the logs and never saves the preference, even after killing the app and restarting it. image

Error Message: GUI - JSONWriter - Could not write: Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file “config.json” in the folder “io.github.halo.LinkLiar”." UserInfo={NSFilePath=/Library/Application Support/io.github.halo.LinkLiar/config.json, NSUserStringVariant=Folder, NSUnderlyingError=0x600002b90bd0 {Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied"}}

Full Debug: Daemon - JSONReader - Reading /Library/Application Support/io.github.halo.LinkLiar/config.json Daemon - JSONReader - Content: 289 bytes Daemon - JSONReader - Successfuly read it Daemon - LinkDaemon - Running Synchronizer because config changed... Daemon - Ifconfig - Interface en0 has the soft MAC address xx:xx:xx:xx:xx:xx Daemon - Synchronizer - Interface en0 is specified to be randomized. Daemon - Synchronizer - Checking among these prefixes: ["00:03:93", "00:05:02", "00:0a:27", "00:0a:95", "00:0d:93", "00:10:fa", "00:11:24", "00:14:51", "00:16:cb", "00:17:f2", "00:19:e3", "00:1b:63", "00:1c:b3", "00:1d:4f", "00:1e:52", "00:1e:c2", "00:1f:5b", "00:1f:f3", "00:21:e9", "00:22:41", "00:23:12", "00:23:32", "00:23:6c", "00:23:df", "00:24:36", "00:25:00", "00:25:4b", "00:25:bc", "00:26:08", "00:26:4a", "00:26:b0", "00:26:bb", "00:30:65", "00:3e:e1", "00:50:e4", "00:56:cd", "00:5b:94", "00:61:71", "00:6d:52", "00:88:65", "00:a0:40", "00:b3:62", "00:c6:10", "00:cd:fe", "00:db:70", "00:f4:b9", "00:f7:6f", "04:0c:ce", "04:15:52", "04:1e:64", "04:26:65", "04:48:9a", "04:4b:ed", "04:52:f3", "04:54:53", "04:69:f8", "04:72:95", "04:d3:cf", "04:db:56", "04:e5:36", "04:f1:3e", "04:f7:e4", "08:00:07", "08:2c:b6", "08:66:98", "08:6d:41", "08:70:45", "08:74:02", "08:e6:89", "08:f4:ab", "08:f6:9c", "08:f8:bc", "0c:15:39", "0c:30:21", "0c:3b:50", "0c:3e:9f", "0c:4d:e9", "0c:51:01", "0c:74:c2", "0c:77:1a", "0c:bc:9<…> Daemon - Synchronizer - The Interface en0 has the sanctioned prefix MACAddress(raw: "xx:xx:xx:xx:xx:xx"). Daemon - Synchronizer - Skipping randomization of Interface en0 because it is already random and no undesired address has been specified. GUI - Bar - Reloading status bar icon... GUI - Ifconfig - Interface en0 has the soft MAC address xx:xx:xx:xx:xx:xx GUI - Bar - Status bar icon reloaded. GUI - Bar - User clicked on the status bar menu icon. GUI - Menu - Updating... GUI - Menu - Reloading Interface menu items GUI - MACVendors - Looking up vendor of MAC GUI - PrefixesSubmenu - Updating... GUI - PrefixesSubmenu - Loading chosen vendors into submenu... GUI - PrefixesSubmenu - Loading chosen prefixes into submenu... GUI - PrefixesSubmenu - Loading available vendors into submenu... GUI - LaunchCtl - Querying launchctl for daemon... GUI - Intercom - The helper responded with its version GUI - Bar - Immediately refreshing GUI GUI - Ifconfig - Interface en0 has the soft MAC address xx:xx:xx:xx:xx:xx GUI - MACVendors - Looking up vendor of MAC xx:xx:xx:xx:xx:xx GUI - Bar - Immediately refreshing GUI GUI - Bar - Reloading status bar icon... GUI - Ifconfig - Interface en0 has the soft MAC address xx:xx:xx:xx:xx:xx GUI - Bar - Status bar icon reloaded. GUI - Intercom - The helper responded with its version GUI - Bar - Immediately refreshing GUI GUI - ConfigWriter - Changing config to randomize Interface en0 excluding its current address xx:xx:xx:xx:xx:xx GUI - JSONWriter - Could not write: Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file “config.json” in the folder “io.github.halo.LinkLiar”." UserInfo={NSFilePath=/Library/Application Support/io.github.halo.LinkLiar/config.json, NSUserStringVariant=Folder, NSUnderlyingError=0x600002b90bd0 {Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied"}} Daemon - IntervalTimer - 600.0 seconds have passed. Daemon - LinkDaemon - Time for periodic activity... Daemon - Ifconfig - Interface en0 has the soft MAC address xx:xx:xx:xx:xx:xx Daemon - Synchronizer - Interface en0 is specified to be randomized. Daemon - Synchronizer - Checking among these prefixes: ["00:03:93", "00:05:02", "00:0a:27", "00:0a:95", "00:0d:93", "00:10:fa", "00:11:24", "00:14:51", "00:16:cb", "00:17:f2", "00:19:e3", "00:1b:63", "00:1c:b3", "00:1d:4f", "00:1e:52", "00:1e:c2", "00:1f:5b", "00:1f:f3", "00:21:e9", "00:22:41", "00:23:12", "00:23:32", "00:23:6c", "00:23:df", "00:24:36", "00:25:00", "00:25:4b", "00:25:bc", "00:26:08", "00:26:4a", "00:26:b0", "00:26:bb", "00:30:65", "00:3e:e1", "00:50:e4", "00:56:cd", "00:5b:94", "00:61:71", "00:6d:52", "00:88:65", "00:a0:40", "00:b3:62", "00:c6:10", "00:cd:fe", "00:db:70", "00:f4:b9", "00:f7:6f", "04:0c:ce", "04:15:52", "04:1e:64", "04:26:65", "04:48:9a", "04:4b:ed", "04:52:f3", "04:54:53", "04:69:f8", "04:72:95", "04:d3:cf", "04:db:56", "04:e5:36", "04:f1:3e", "04:f7:e4", "08:00:07", "08:2c:b6", "08:66:98", "08:6d:41", "08:70:45", "08:74:02", "08:e6:89", "08:f4:ab", "08:f6:9c", "08:f8:bc", "0c:15:39", "0c:30:21", "0c:3b:50", "0c:3e:9f", "0c:4d:e9", "0c:51:01", "0c:74:c2", "0c:77:1a", "0c:bc:9<…> Daemon - Synchronizer - The Interface en0 has the sanctioned prefix MACAddress(raw: "xx:xx:xx:xx:xx:xx").

I appreciate you having a look, btw the MACs were masked in this debug message.

Btw the fix for this issue is to run "sudo chown -R $(whoami) /Library/Application\ Support/io.github.halo.LinkLiar/" which manually adjusts the permissions. Doing so through the OSX GUI didnt work for some reason or another.

halo commented 10 months ago

I've been able to reproduce this issue on Sonoma (so, that's good!). Unfortunately I cannot give an ETA at the moment as to when I'll find the time to fix this. Keeping the hope up :)

halo commented 9 months ago

ETA is by the end of the year. But it'll be for Sonoma only, unfortunately.

halo commented 7 months ago

So... you triggered me to rewrite LinkLiar from scratch 😆 It took a while, but it's about 90% done now and the basic functionality is working. It needs more testing then I'll cut an official release.

While refactoring, I noticed that there is a subtle problem with file permissions and writing to the config file, I think that might explain your problem: When LinkLiar tries to write to the config file atomically, the operating system creates a temporary file and then swaps out the original config file by moving the temporary file into place. This mechanism only works if there are writing permissions to the directory! I was able to fix this here, so I think the next release will not suffer from this problem any more.

I'll close this issue for now, please feel free to open it again should something new surface.