Specify Tor control port in TorSettings and require cookie authentication from Tor.
MODIFY
WalletWasabi.Tests/UnitTests/Tor/TorSettingsTests.cs
WalletWasabi.Tests/UnitTests/Tor/TorSettingsTests.cs
+using System.IO;
using System.Net;
using WalletWasabi.Tor;
using Xunit;
-using System.IO;
namespace WalletWasabi.Tests.UnitTests.Tor
{
@@ -25,6 +25,9 @@ namespace WalletWasabi.Tests.UnitTests.Tor
string expected = string.Join(
" ",
$"--SOCKSPort 127.0.0.1:9050",
+ $"--CookieAuthentication 1",
+ $"--ControlPort 37151",
+ $"--CookieAuthFile \"{Path.Combine("temp", "tempDataDir", "control_auth_cookie")}\"",
$"--DataDirectory \"{Path.Combine("temp", "tempDataDir", "tordata")}\"",
$"--GeoIPFile \"{Path.Combine("tempDistributionDir", "Tor", "Geoip", "geoip")}\"",
$"--GeoIPv6File \"{Path.Combine("tempDistributionDir", "Tor", "Geoip", "geoip6")}\"",

MODIFY
WalletWasabi/Tor/TorSettings.cs
WalletWasabi/Tor/TorSettings.cs
@@ -22,6 +22,7 @@ namespace WalletWasabi.Tor
TorBinaryDir = Path.Combine(MicroserviceHelpers.GetBinaryFolder(), "Tor");
TorDataDir = Path.Combine(dataDir, "tordata");
+ CookieAuthFilePath = Path.Combine(dataDir, "control_auth_cookie");
LogFilePath = logFilePath;
IoHelpers.EnsureContainingDirectoryExists(LogFilePath);
DistributionFolder = distributionFolderPath;
@@ -48,6 +49,12 @@ namespace WalletWasabi.Tor
/// <summary>Full path to executable file that is used to start Tor process.</summary>
public string TorBinaryFilePath { get; }
+ /// <summary>Full path to Tor cookie file.</summary>
+ public string CookieAuthFilePath { get; }
+
+ /// <summary>Tor control endpoint.</summary>
+ public IPEndPoint ControlEndpoint { get; } = new(IPAddress.Loopback, 37151);
+
private string GeoIpPath { get; }
private string GeoIp6Path { get; }
@@ -65,6 +72,9 @@ namespace WalletWasabi.Tor
return string.Join(
" ",
$"--SOCKSPort {torSocks5EndPoint}",
+ $"--CookieAuthentication 1",
+ $"--ControlPort {ControlEndpoint.Port}",
+ $"--CookieAuthFile \"{CookieAuthFilePath}\"",
$"--DataDirectory \"{TorDataDir}\"",
$"--GeoIPFile \"{GeoIpPath}\"",
$"--GeoIPv6File \"{GeoIp6Path}\"",

Specify Tor control port in TorSettings and require cookie authentication from Tor.