I have implemented Tor.framework on my MacOS app and it's been working for a while. After we released a few new versions we started to get reports of Tor circuit errors and when debugging we found that control_auth_cookie file is missing, then torController can't authenticate with cookie.
The directory is there at /Library/Containers/BundleIdentifier/Data/Library/Caches/tor/ but there's nothing inside it.
Pasting below the torBaseConfig:
private static let torBaseConf : TorConfiguration = {
let conf = TorConfiguration()
conf.cookieAuthentication = true
#if DEBUG
let logLocation = "notice stdout"
#else
let logLocation = "notice file /dev/null"
#endif
conf.arguments = [
"--allow-missing-torrc",
"--ignore-missing-torrc",
"--ClientOnly", "1",
"--AvoidDiskWrites", "1",
"--SocksPort", "127.0.0.1:39050",
"--ControlPort", "127.0.0.1:39060",
"--Log", logLocation,
"--ClientUseIPv6", "1"
]
// Store in <appdir>/Library/Caches/tor to persist descriptors etc
if let dataDir = FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask)
.first?.appendingPathComponent("tor", isDirectory: true) {
// Create data dir if necessary
try? FileManager.default.createDirectory(at: dataDir, withIntermediateDirectories: true)
// Create auth dir if necessary
let authDir = dataDir.appendingPathComponent("auth", isDirectory: true)
try? FileManager.default.createDirectory(at: authDir, withIntermediateDirectories: true)
conf.dataDirectory = dataDir
conf.arguments += ["--ClientOnionAuthDir", authDir.path]
}
return conf
}()
I have implemented Tor.framework on my MacOS app and it's been working for a while. After we released a few new versions we started to get reports of Tor circuit errors and when debugging we found that
control_auth_cookie
file is missing, thentorController
can't authenticate with cookie.The directory is there at
/Library/Containers/BundleIdentifier/Data/Library/Caches/tor/
but there's nothing inside it.Pasting below the torBaseConfig: