I want to set the nameserver of a specific domain to a custom value.
I want to write a reply to the DNS request for a specific domain. Can I do that in DNSProxyProvider? Please share the sample code If available.
Post
Replies
Boosts
Views
Activity
The other app which activated network extension uses only content filtering.
Is there any system extension that can be configured to resolve DNS for specific domains in macOS? (similar to defining resolver in /etc/resolver/)
Thanks for replying. No, I don't see any crash reports related to this in Console. FYI, I am running the app in debug mode, and SIP is enabled. When I run this command, systemextensionsctl list, I can see another app using the network extension ( network extension [activated enabled]). Is the another app causing this error?
What does this error code mean The operation couldn’t be completed. (OSSystemExtensionErrorDomain error 1.)?
Update:
I added OsSystemExtensionRequest.
But I'm getting this error
The operation couldn’t be completed. (OSSystemExtensionErrorDomain error 1.)
let log = OSLog(subsystem: "com.example.apple-samplecode.DNSTestBed", category: "app")
// let manager = NEDNSProxyManager()
var manager: NEDNSProxyManager?
private func installSystemExtension() {
os_log("DNSFProxy: installing system extension")
let request = OSSystemExtensionRequest.activationRequest(
forExtensionWithIdentifier: "bundle identifier",
queue: .main
)
request.delegate = self
OSSystemExtensionManager.shared.submitRequest(request)
}
private func configureProxy() {
os_log(.info, log: self.log, "will load configurations")
NSLog("QNEDNSProxy.Provider: controller")
NEDNSProxyManager.shared().loadFromPreferences { [weak self] error in
precondition(Thread.isMainThread)
}
os_log(.info, log: self.log, "logs indication the state of loading preferences")
}
override func viewDidLoad() {
super.viewDidLoad()
installSystemExtension()
// configureProxy()
// Do any additional setup after loading the view.
}
//
// override var representedObject: Any? {
// didSet {
// // Update the view, if already loaded.
// }
// }
}
extension ViewController: OSSystemExtensionRequestDelegate {
func request(_ request: OSSystemExtensionRequest, actionForReplacingExtension existing: OSSystemExtensionProperties, withExtension ext: OSSystemExtensionProperties) -> OSSystemExtensionRequest.ReplacementAction {
os_log("DNSProxy: Replacing extension %@ version %@ with version %@", request.identifier, existing.bundleShortVersion, ext.bundleShortVersion)
return .replace
}
func requestNeedsUserApproval(_ request: OSSystemExtensionRequest) {
os_log("DNSProxy: Extension %@ requires user approval", request.identifier)
}
func request(_ request: OSSystemExtensionRequest, didFailWithError error: Error) {
os_log("DNSProxy: System extension request failed: %@", error.localizedDescription)
}
/* Other delegate methods here */
func request(_ request: OSSystemExtensionRequest, didFinishWithResult result: OSSystemExtensionRequest.Result) {
switch result {
case .completed:
manager = NEDNSProxyManager.shared()
case .willCompleteAfterReboot:
os_log("DNSProxy: willCompleteAfterReboot")
@unknown default:
os_log("DNSProxy: default")
}
}
}
Hi,
I am getting the same error when I try to activate the network system extension. Is this issue solved?
Thank you for replying. What happens when one app is a VPN app?
Also, is it possible to do DNS resolution using the DNSProxyprovider system extension?
If not, Is there a way to do DNS resolution using the network extension?
My aim is to resolve all the domains with *example.com to a specific DNS server.