System Configuration

RSS for tag

System Configuration allows applications to access a device’s network configuration settings and determine the reachability of the device.

Posts under System Configuration tag

87 Posts

Post

Replies

Boosts

Views

Activity

SCDynamicstoreCopyConsoleUser returns an empty string
consoleUser = SCDynamicstoreCopyConsoleUser(NULL, &uid, &gid); the string is empty, but not NULL. uid and gid are set properly. Any idea why this would happen? NB: it only happens from a LaunchAgent, for some reason; if I isolate the code in question, and run it via CLI, it works exactly as expected. And it only seems to happen for one person -- but for him, it happens on both Intel and Apple Silicon.
5
0
1.2k
Sep ’22
MacOs Change Identifier
Hi. Is there any way to change macos Identifier (i mean this one) for some reasons. For example, telegram using this identifier to show you connection list: is there any way to specify (for example) A telegram that I'm connecting with a Macbook Pro 2019? In my understanding, I just need to change the macbook ID in the system. Even if i want to do this in virtual machine (parallels for example)
1
0
1.1k
Sep ’22
How to Disconnect Wi-Fi and Ethernet Interfaces
I want to be able to disconnect all available interfaces on a device running macOS 11 and above. For Wi-Fi interfaces I see that this is possible using the CoreWLAN framework. https://developer.apple.com/documentation/corewlan/cwinterface/1426422-disassociate However, how can I do something similar for an ethernet interface? I want to be able to reconnect the interface eventually as well. The reason I want to be able to do this is that I want to drop all existing connections on the device right after I start my content filter or when my filter rules have changed and my filter has already allowed the flow perviously.
1
0
1.1k
Aug ’22
Unregister Reachability event
Hi, I'm using the reachability framework in order to register network status event for a specific address (address_st in the code below)... I'd like to support change of address which will trigger unregister from the old address and register to the new one. How can it be done ? SCNetworkReachabilityRef reachabilityRef = SCNetworkReachabilityCreateWithAddress(NULL, reinterpret_cast<sockaddr *>(&address_st)); SCNetworkReachabilityContext context = {0, NULL, NULL, NULL, NULL}; SCNetworkReachabilitySetCallback(reachabilityRef, ReachabilityCallback, &context)) SCNetworkReachabilitySetDispatchQueue(reachabilityRef, dispatch_queue_create("com.reachability.test", nil)); thanks,
1
0
1.1k
Jun ’22
Using SCNetworkReachability from XPC Service
Hi, I'm writing an XPC Service hosted in a container app. This service is expected to trigger IPC when some URL of interest become reachable. I'm using SCNetworkReachability (Reachability class provided as sample code from Apple). The reachability notification runs fine when running from the container app. However the XPC Service is never triggered of any network change. I'm suspecting something related to RunLoop or RunLoopMode (XPCListener is instantiated with serviceListener) but cannot find any fix. I disabled sandboxing without success (and anyway it runs fine with sandboxed container + network client entitlement). Any suggestion ?
6
0
1.7k
Apr ’22
On iOS 13.1, CNCopyCurrentNetworkInfo occasionally doesn't work.
Altough we are using NEHotspotConfiguration API to configure the current Wi-Fi network, occasionally CNCopyCurrentNetworkInfo returns NULL. The only way to recover was rebooting the phone (I haven't tried resetting the network settings as was suggested else where). Regardless ,this sounds like a bug in the API and I was wondering if others see the same problem and/or if it's a known issue and is getting addressed.Thanks!
27
0
14k
Mar ’22
network preferences does not return VPN connections
Since 12.2, network preferences does not return VPN connections anymore. Therefore, VPN autoconnect scripts / Applications do not work anymore. tell application "System Events" tell current location of network preferences name of every service end tell end tell Returns: {"USB 10/100/1000 LAN", "WLAN", "iPhone-USB", "Thunderbolt Bridge"} Has the API changed?
1
0
840
Feb ’22
a way to do scutil --get and --set stuff without scutil
Sorry about the title, it's kind of awkward. Basically, I have an ASOC app that I'd like to port to swift as a learning excercise. it's pretty straightforward, it grabs the computer name, local host name, and host name via the scutil --get operations and lets you change those via the --set. doing this in ASOC is dead simple, yay do shell script, and I mostly found a way to do it via NSAppleScript, but it feels very...awkward. Is there a better framework to use for getting and setting this info? thanks! john
1
0
1.6k
Feb ’22
Route / NAT traffic from VPN server through iPhone
Hello everyone! We are trying to implement secure VPN application and need to route traffic from our internal VPN server to external wifi / cellular network of iOS device. On android we already done this with VPN client + proxy server running in background. Is there any way to do this on iOS? We think two ways of implementation: Configure SNAT + VPN on iOS Background proxyserver (or something that could forward packets) and VPN client on iOS.
1
0
1.5k
Jan ’22
GET SSID problems with CNCopyCurrentNetworkInfo
Hello, I try to get the WiFi SSID, from the iPhone, with the CNCopyCurrentNetworkInfo function. I become as interface "en0" and the error message: [43481:8106022] [] nehelper sent invalid result code [1] for Wi-Fi information request I don't no where is the problem. My function for the SSID request is this one:             for i in 0..<CFArrayGetCount(interface) {               let interfaceName: UnsafeRawPointer = CFArrayGetValueAtIndex(interface, i)                 print(interface)               let rec = unsafeBitCast(interfaceName, to: AnyObject.self)               if let unsafeInterfaceData = CNCopyCurrentNetworkInfo("\(rec)" as CFString), let interfaceData = unsafeInterfaceData as? [String : AnyObject] {                 // connected wifi                 print("BSSID: \(interfaceData["BSSID"]), SSID: \(interfaceData["SSID"]), SSIDDATA: \(interfaceData["SSIDDATA"])")               } else {                 // not connected wifi               }             }           } if you have any idea where is my problem pleas help me. With best regards Niklas
1
0
906
Jan ’22
Frequent network change detected in __SCNetworkReachability on Mobile network
Our VPN client rely on __SCNetworkReachability to detect any network change, It works fine normally but recently we have started seeing some issues with customer environment, Reachability goes down frequently. When we looked at logs we have seen host name resolved to two IP address one IPv4 address and other mapped IPv6 IP (i.e 64:ff9b::b96e:55c5). Irrespective of which IP is being used with Reachability class (IPv4 or mapped IPv6) problem is not going away. VPN connects fine and immediately within 1 or 2 secs reachability changes and this put the VPN back to connecting state. Note: This issue is not observed in WIFI or any mobile network doesn't provide mapped IP.
1
0
851
Jan ’22
Can I use NEHotspotConfigurationManager to prevent "The Wi-Fi network does not appear to be connected to the internet" prompt using Wi-Fi IoT Device
My users get a prompt that disrupts the use of my app. The prompt comes more than 10 seconds into using a remote controlled IoT device via WiFi. The device is a drone, so it's not plausible to pause and it's absurd to have them wait so long for this prompt to appear to begin flight safely. The Wi-Fi network "MySSID" does not appear to be connected to the Internet Do you want to temporarily use cellular data? Use Cellular Data Keep Trying Wi-Fi I connect with NEHotspotConfigurationManager https://developer.apple.com/documentation/networkextension/nehotspotconfigurationmanager     hotspotConfig = NEHotspotConfiguration(ssid: mySSID)     guard let hotspotConfig = hotspotConfig else {       print("Error while connecting to WiFi")       return     }     hotspotConfig.joinOnce = true     NEHotspotConfigurationManager.shared.removeConfiguration(forSSID: ssid)     NEHotspotConfigurationManager.shared.apply(hotspotConfig) { [self] (error) in       if let error = error {         print(self.handleConnectionError(error))         completion(false)       } else if self.wifiConnectionInfo() != nil {         completion(true)       } else {         completion(false)       }     } How do I prevent this? Or is there any workaround?
3
0
1.5k
Dec ’21
DNS in VPN split tunneling
Hi all. I have the following scenario; MacOs only with IPv6 support (IPv4 disabled). VPN application with both IPv4 and IPv6 support. My VPN app is creating three services thru NetworkConfiguration API; one is to register DNS (for IPv4 and IPv6), second is the IPv4 service with tunnel information (with override set to 0, because I have split tunnelling). Third is the IPv6 service, with tunnel IP also. I'm facing a problem with DNS, when the Override is set to true, I can see the DNS listed. But when override is set to disable, the DNS disappear. The idea is to have the IPv4 service with tunnel information, but with DNS configured. What is the best way to set the DNS when IPv4 and IPv6 tunnel are required?
1
0
1.1k
Oct ’21
Does Captive Network Assistant result in a network change event?
We started discussing how we'll deal with captive portals, and I realized I don't know if CNA results in network change events. Does it? (I don't have a captive network here, and lockdown makes it hard to go find one, and making one would be ... quite a bit of work.)
Replies
1
Boosts
0
Views
1.3k
Activity
Oct ’22
Disable Captive Network Assistant?
# how can we disable Captive Network Assistant on macOS Monterey 12.6? "sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.captive.control Active -boolean false" doesn't work anymore!!
Replies
1
Boosts
1
Views
1.6k
Activity
Oct ’22
Enabling SIP while disabling specific parts, is it safe?
Hi everybody! To make an "extra Finder application" work properly, I'd have to enable only parts of System Integrity Protection. sudo csrutil enable –without debug –without fs I've read that SIP must be enable for security reasons. Is it OK if it's only a part of it? Thank you!
Replies
4
Boosts
0
Views
1.3k
Activity
Oct ’22
SCDynamicstoreCopyConsoleUser returns an empty string
consoleUser = SCDynamicstoreCopyConsoleUser(NULL, &uid, &gid); the string is empty, but not NULL. uid and gid are set properly. Any idea why this would happen? NB: it only happens from a LaunchAgent, for some reason; if I isolate the code in question, and run it via CLI, it works exactly as expected. And it only seems to happen for one person -- but for him, it happens on both Intel and Apple Silicon.
Replies
5
Boosts
0
Views
1.2k
Activity
Sep ’22
MacOs Change Identifier
Hi. Is there any way to change macos Identifier (i mean this one) for some reasons. For example, telegram using this identifier to show you connection list: is there any way to specify (for example) A telegram that I'm connecting with a Macbook Pro 2019? In my understanding, I just need to change the macbook ID in the system. Even if i want to do this in virtual machine (parallels for example)
Replies
1
Boosts
0
Views
1.1k
Activity
Sep ’22
Is there an Apple old install disk archive for Developers?
Looking for install disks or .dmg for MacOS X Cheetah (10.0) and MacOS X Puma (10.1)
Replies
1
Boosts
0
Views
1.4k
Activity
Aug ’22
How to get iphone system last update time?
i want the last system update time on iphone by swift,but can not find any function.
Replies
4
Boosts
0
Views
1k
Activity
Aug ’22
How to Disconnect Wi-Fi and Ethernet Interfaces
I want to be able to disconnect all available interfaces on a device running macOS 11 and above. For Wi-Fi interfaces I see that this is possible using the CoreWLAN framework. https://developer.apple.com/documentation/corewlan/cwinterface/1426422-disassociate However, how can I do something similar for an ethernet interface? I want to be able to reconnect the interface eventually as well. The reason I want to be able to do this is that I want to drop all existing connections on the device right after I start my content filter or when my filter rules have changed and my filter has already allowed the flow perviously.
Replies
1
Boosts
0
Views
1.1k
Activity
Aug ’22
Can I tell if I'm in a captive portal?
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?
Replies
5
Boosts
0
Views
1.4k
Activity
Jun ’22
Unregister Reachability event
Hi, I'm using the reachability framework in order to register network status event for a specific address (address_st in the code below)... I'd like to support change of address which will trigger unregister from the old address and register to the new one. How can it be done ? SCNetworkReachabilityRef reachabilityRef = SCNetworkReachabilityCreateWithAddress(NULL, reinterpret_cast<sockaddr *>(&address_st)); SCNetworkReachabilityContext context = {0, NULL, NULL, NULL, NULL}; SCNetworkReachabilitySetCallback(reachabilityRef, ReachabilityCallback, &context)) SCNetworkReachabilitySetDispatchQueue(reachabilityRef, dispatch_queue_create("com.reachability.test", nil)); thanks,
Replies
1
Boosts
0
Views
1.1k
Activity
Jun ’22
Using SCNetworkReachability from XPC Service
Hi, I'm writing an XPC Service hosted in a container app. This service is expected to trigger IPC when some URL of interest become reachable. I'm using SCNetworkReachability (Reachability class provided as sample code from Apple). The reachability notification runs fine when running from the container app. However the XPC Service is never triggered of any network change. I'm suspecting something related to RunLoop or RunLoopMode (XPCListener is instantiated with serviceListener) but cannot find any fix. I disabled sandboxing without success (and anyway it runs fine with sandboxed container + network client entitlement). Any suggestion ?
Replies
6
Boosts
0
Views
1.7k
Activity
Apr ’22
On iOS 13.1, CNCopyCurrentNetworkInfo occasionally doesn't work.
Altough we are using NEHotspotConfiguration API to configure the current Wi-Fi network, occasionally CNCopyCurrentNetworkInfo returns NULL. The only way to recover was rebooting the phone (I haven't tried resetting the network settings as was suggested else where). Regardless ,this sounds like a bug in the API and I was wondering if others see the same problem and/or if it's a known issue and is getting addressed.Thanks!
Replies
27
Boosts
0
Views
14k
Activity
Mar ’22
network preferences does not return VPN connections
Since 12.2, network preferences does not return VPN connections anymore. Therefore, VPN autoconnect scripts / Applications do not work anymore. tell application "System Events" tell current location of network preferences name of every service end tell end tell Returns: {"USB 10/100/1000 LAN", "WLAN", "iPhone-USB", "Thunderbolt Bridge"} Has the API changed?
Replies
1
Boosts
0
Views
840
Activity
Feb ’22
a way to do scutil --get and --set stuff without scutil
Sorry about the title, it's kind of awkward. Basically, I have an ASOC app that I'd like to port to swift as a learning excercise. it's pretty straightforward, it grabs the computer name, local host name, and host name via the scutil --get operations and lets you change those via the --set. doing this in ASOC is dead simple, yay do shell script, and I mostly found a way to do it via NSAppleScript, but it feels very...awkward. Is there a better framework to use for getting and setting this info? thanks! john
Replies
1
Boosts
0
Views
1.6k
Activity
Feb ’22
Route / NAT traffic from VPN server through iPhone
Hello everyone! We are trying to implement secure VPN application and need to route traffic from our internal VPN server to external wifi / cellular network of iOS device. On android we already done this with VPN client + proxy server running in background. Is there any way to do this on iOS? We think two ways of implementation: Configure SNAT + VPN on iOS Background proxyserver (or something that could forward packets) and VPN client on iOS.
Replies
1
Boosts
0
Views
1.5k
Activity
Jan ’22
GET SSID problems with CNCopyCurrentNetworkInfo
Hello, I try to get the WiFi SSID, from the iPhone, with the CNCopyCurrentNetworkInfo function. I become as interface "en0" and the error message: [43481:8106022] [] nehelper sent invalid result code [1] for Wi-Fi information request I don't no where is the problem. My function for the SSID request is this one:             for i in 0..<CFArrayGetCount(interface) {               let interfaceName: UnsafeRawPointer = CFArrayGetValueAtIndex(interface, i)                 print(interface)               let rec = unsafeBitCast(interfaceName, to: AnyObject.self)               if let unsafeInterfaceData = CNCopyCurrentNetworkInfo("\(rec)" as CFString), let interfaceData = unsafeInterfaceData as? [String : AnyObject] {                 // connected wifi                 print("BSSID: \(interfaceData["BSSID"]), SSID: \(interfaceData["SSID"]), SSIDDATA: \(interfaceData["SSIDDATA"])")               } else {                 // not connected wifi               }             }           } if you have any idea where is my problem pleas help me. With best regards Niklas
Replies
1
Boosts
0
Views
906
Activity
Jan ’22
Frequent network change detected in __SCNetworkReachability on Mobile network
Our VPN client rely on __SCNetworkReachability to detect any network change, It works fine normally but recently we have started seeing some issues with customer environment, Reachability goes down frequently. When we looked at logs we have seen host name resolved to two IP address one IPv4 address and other mapped IPv6 IP (i.e 64:ff9b::b96e:55c5). Irrespective of which IP is being used with Reachability class (IPv4 or mapped IPv6) problem is not going away. VPN connects fine and immediately within 1 or 2 secs reachability changes and this put the VPN back to connecting state. Note: This issue is not observed in WIFI or any mobile network doesn't provide mapped IP.
Replies
1
Boosts
0
Views
851
Activity
Jan ’22
Can I use NEHotspotConfigurationManager to prevent "The Wi-Fi network does not appear to be connected to the internet" prompt using Wi-Fi IoT Device
My users get a prompt that disrupts the use of my app. The prompt comes more than 10 seconds into using a remote controlled IoT device via WiFi. The device is a drone, so it's not plausible to pause and it's absurd to have them wait so long for this prompt to appear to begin flight safely. The Wi-Fi network "MySSID" does not appear to be connected to the Internet Do you want to temporarily use cellular data? Use Cellular Data Keep Trying Wi-Fi I connect with NEHotspotConfigurationManager https://developer.apple.com/documentation/networkextension/nehotspotconfigurationmanager     hotspotConfig = NEHotspotConfiguration(ssid: mySSID)     guard let hotspotConfig = hotspotConfig else {       print("Error while connecting to WiFi")       return     }     hotspotConfig.joinOnce = true     NEHotspotConfigurationManager.shared.removeConfiguration(forSSID: ssid)     NEHotspotConfigurationManager.shared.apply(hotspotConfig) { [self] (error) in       if let error = error {         print(self.handleConnectionError(error))         completion(false)       } else if self.wifiConnectionInfo() != nil {         completion(true)       } else {         completion(false)       }     } How do I prevent this? Or is there any workaround?
Replies
3
Boosts
0
Views
1.5k
Activity
Dec ’21
DNS in VPN split tunneling
Hi all. I have the following scenario; MacOs only with IPv6 support (IPv4 disabled). VPN application with both IPv4 and IPv6 support. My VPN app is creating three services thru NetworkConfiguration API; one is to register DNS (for IPv4 and IPv6), second is the IPv4 service with tunnel information (with override set to 0, because I have split tunnelling). Third is the IPv6 service, with tunnel IP also. I'm facing a problem with DNS, when the Override is set to true, I can see the DNS listed. But when override is set to disable, the DNS disappear. The idea is to have the IPv4 service with tunnel information, but with DNS configured. What is the best way to set the DNS when IPv4 and IPv6 tunnel are required?
Replies
1
Boosts
0
Views
1.1k
Activity
Oct ’21