I was trying to figure out how to monitor keychain events, and wrote:
dispatch_async(dispatch_get_main_queue(), ^{
OSStatus kr = SecKeychainAddCallback(MyKeychainEventCallback, kSecEveryEventMask, NULL);
printf("Got result %d\n", kr);
});
dispatch_main();
However, the callback never gets called.
I put the same code into a simple GUI app (invoked from the didFinishLaunching method), and it does work. So presumably this is something run-loop related. But I can't seem to figure it out -- so what am I doing wrong?
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
For a variety of reasons, some of which are no doubt due to poor life decisions, I don't want my application to start automatically on restart. Is there a way to exempt myself from that?
Our TPP excludes our own processes from oversight, which makes some things very easy. Only I just found out that when our app uses a WKWebView... it's very securely shuffled off into its own process. With its own signing identifier. And a ppid of launchd.
How could I tell that a com.apple.WebKit.Networking process is related to our process? (I note that the Endpoint Security Framework has added a "responsible" audit token, presumably for this sort of situation.)
A bad time to ask, I'm sure, since everyone is busy with WWDC.
What is the difference between filterSockets and filterPackets? In terms of code and classes, I mean. (For my very simple test, if I set filterSockets to true, it just doesn't seem to work.)
Related to that: with filterPackets set to true, what data is NEFilterPacketProvider.packetHandler getting? It looks like a subset of an ethernet packet on my system (which, in fact, does have wired ethernet!). But it's missing some of the wire bits (the preamble and SFP), and the length is wrong. (Eg., the handler is given bytes of length 1514, but the ethernet length field is 1500 -- but there are 16 bytes before the length field, plus the two bytes of the length/type.) I suppose it's possible it's not an ethernet packet, but it certainly looks like one, just... slightly wrong.
Is it better to
Create an NSXPCConnection, keep it around, and create proxies using that as needed, or
Create an NSXPCConnection, create a proxy off of it, and then close the connection when done?
I thought Swift wasn't supposed to get them, which is part of the reason why I chose to use it for my network extension. But we're getting crashes occasionally, that look like:
Thread 4 Crashed:: Dispatch queue: com.apple.NSXPCConnection.user.endpoint
0 com.kithrup.MyApp.NExt 0x102c4ffe2 MyExt.sendData(_:data:completion:) + 610
1 com.kithrup.MyApp.NExt 0x102c5091f @objc MyExt.sendData(_:data:completion:) + 255
2 Foundation 0x7ff81ef97490 __NSXPCCONNECTION_IS_CALLING_OUT_TO_EXPORTED_OBJECT_S3__ + 10
3 Foundation 0x7ff81ef3fa1f -[NSXPCConnection _decodeAndInvokeMessageWithEvent:flags:] + 2322
4 Foundation 0x7ff81eef641e message_handler + 206
5 libxpc.dylib 0x7ff81de24b6c _xpc_connection_call_event_handler + 56
6 libxpc.dylib 0x7ff81de23947 _xpc_connection_mach_event + 1382
7 libdispatch.dylib 0x7ff81df2e3b1 _dispatch_client_callout4 + 9
8 libdispatch.dylib 0x7ff81df47041 _dispatch_mach_msg_invoke + 445
9 libdispatch.dylib 0x7ff81df341cd _dispatch_lane_serial_drain + 342
10 libdispatch.dylib 0x7ff81df47b77 _dispatch_mach_invoke + 484
11 libdispatch.dylib 0x7ff81df341cd _dispatch_lane_serial_drain + 342
12 libdispatch.dylib 0x7ff81df34e30 _dispatch_lane_invoke + 417
13 libdispatch.dylib 0x7ff81df3eeee _dispatch_workloop_worker_thread + 753
14 libsystem_pthread.dylib 0x7ff81e0e1fd0 _pthread_wqthread + 326
The XPC method is func sendData(_: UUID, data: Data?, completion: @escaping (_: Error?) -> Void)
It's crashing on address 0x10, so pretty clearly a NULL-dereference.
Since this is happening in my extension, it's in Swift (as I said above), so I have no idea what could be NULL without the compiler yelling at me first.
I must be missing something obvious here: I've got my packet filter running (yay), but every UDP packet it gets has a destination port of 0. Also I am confused by this other behaviour:
let udpHeader = (bytes + etherHeaderSize + ip4HeaderSize).bindMemory(to: udphdr.self, capacity: udpHeaderSize)
switch Int(udpHeader.pointee.uh_dport).bigEndian {
case 80, 443:
return true
case 0:
os_log(.debug, log: Self.log, "UDP port 0: ip_dst = %{public}s", ReadableIPAddr(ipPacket.pointee.ip_dst))
return false
default:
os_log(.debug, log: Self.log, "Got UDP packet dest port %#x, ip_dst = %{public}s", Int(udpHeader.pointee.uh_dport).bigEndian, ReadableIPAddr(ipPacket.pointee.ip_dst))
return false
}
The case 0 is not used, even though the default prints out a value of 0.
We want to have a login window stay in front and key, until the user signs in. We want it to stay in front even if switching away from it. Now, this does seem possible, since zoom just did it to me while I was getting into a call to discuss this, but I can't figure out how.
In this particular case, I am instantiating an NSViewController subclass, and then creating an NSWindow for it to use. I have tried setting the NSWindow.level to all sorts of values, and they don't seem to work.
help?
I put a cromulent plist file in /Library/LaunchAgents; I load it for the current user using launchctl bootstrap gui/501 $plistfile. Great!
But if I then log in as a different user, without rebooting, it doesn't run. I can't do a bootstrap for a user who isn't there; I can't do a launchctl load for an agent. This seems like I'm missing something, but googling hasn't helped me a lot.
(On top of all that, I am pretty positive this used to work, but I may be thinking back to MacOS not macOS.)
This query should find everything with a display name of "Safari." That should include, for example, /Applications/Safari.app.
[bigbook:/tmp] sef% mdfind 'kMDItemDisplayName == "Safari"c'
/Library/Application Support/Apple/Safari
/Library/Apple/System/Library/Assistant/Plugins/Safari.assistantBundle/Contents/MacOS/Safari
/Users/Shared/Previously Relocated Items 1/Security/System/Library/AssetsV2/com_apple_MobileAsset_MacSoftwareUpdate/f7b05c91052116c046919f72de2c03a86cabcf3e.asset/AssetData/payloadv2/ecc_data/System/Library/Templates/Data/Applications/Safari.app
/Users/Shared/Previously Relocated Items/Security/Developer/SDKs/MacOSX10.6.sdk/System/Library/PrivateFrameworks/Safari.framework/Versions/A/Safari
/Users/Shared/Previously Relocated Items/Security/Developer/SDKs/MacOSX10.7.sdk/System/Library/PrivateFrameworks/Safari.framework/Versions/A/Safari
/Users/sef/Applications/Microsoft Office 2004/Office/Themes/safari
/Users/sef/Library/Application Support/SyncService/LastSync Data/Safari
And yet, /Applications/Safari.app is in fact missing from there.
Why? (This used to work. But then mds was broken on my machine, so I bit the bullet and upgraded to Monterey. Multiple Monterey systems are showing this weird behaviour.)
That's pretty much the question: we've got a tunnel provider, and I think the OS' ability to handle a captive portal situation is better than I could do, so is there a way to find out if we are in one, and if so wait for it to be handled by the user before we start doing things?
As I've said before, our product uses cmake for building, and vcpkg for 3rd party management. vcpkg does not (yet) support universal builds on the Mac; neither does HomeBrew, and MacPorts kinda does but some of the ports actually think "universal" is x86, x86_64, ppc, and ppc64 and won't build because you can't build ppc anymore.
So I have had serious talks with our build and we have reached a compromise where I can now build for arm64 or for x86_64. The next step would be to manually combine the executables, and then re-sign (using our Developer ID). Has anyone got suggestions on how to do that? I can just grab the codesign commands from the build output and use those; is that feasible?
(At some point I may insist on having a week or so to try getting vcpkg to build universal, but I don't have that week or so now, so that's not going to happen. I could potentially ditch cmake for the Mac builds, and then I think CocoaPods has all of the 3rd party libraries we depend on, but I'm not positive, and that then introduces guaranteed breakage when the Windows and macOS versions uses different sets of files and versions.)
I was surprised I could not find such a template in Instruments / xctrace; maybe it's in something else and I couldn't find it?
(I am trying to figure out why my throughput got slow. Is it because a mutex is too heavy? Or is there a lot of contention over the lock? How long do the locks tend to be held? Etc.)
On Apple Silicon only. It's a bad dereference, address 0xbeadddaf65d0 which looks fake.
What does hardening do differently that might cause that, any ideas?
Our transparent proxy provider sends flows to a daemon which analyzes and then does proxying. Works fine.
Except that sometimes it stops working. As far as I can tell, it's due to DNS not working. Queries hang -- we've got some internal ones we log, that have timed out after 20 or 30 seconds. Now, clearly, we're doing something bad (because if we kill the daemon and it restarts, everything goes back to working).
Unfortunately, I have forgotten so much I can't figure out how to see where it's broken! Things like dig @8.8.8.8 com. any fail -- I am presuming because it's trying to do a lookup of "8.8.8.8" and that fails, but I could be wrong. Admittedly, that one doesn't time out, it simply says no servers could be reached. Meanwhile, pinging that address works. (And, also, the local DNS host -- the one provided via DHCP and listed in /etc/resolv.conf and ipconfig getstatus -- behaves the same way.)
I haven't been able to reproduce this myself, unfortunately. Although I have, somewhat interestingly, had a similar issue, which was clearly due to a Google Home WiFi access point (as resetting it fixed the problem, as does moving to another area of the house such that a different AP in the mesh takes over).
On my FreeBSD systems, I'd run tcpdump and truss/ktrace on named, but as I said, I've forgotten so much about how macOS does DNS I'm flailing.
Help?